php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #53851 socket_create protocol int (IPv6)
Submitted: 2011-01-26 23:36 UTC Modified: 2017-10-24 07:56 UTC
Votes:6
Avg. Score:4.2 ± 1.5
Reproduced:3 of 4 (75.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: spandit at stealth dot net Assigned:
Status: Open Package: Sockets related
PHP Version: 5.3.5 OS: FreeBSD 8.x
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: spandit at stealth dot net
New email:
PHP Version: OS:

 

 [2011-01-26 23:36 UTC] spandit at stealth dot net
Description:
------------
---
From manual page: http://www.php.net/function.socket-create#Parameters
---

The protocol section needs to be updated to account for the IPv6 protocol numbers.  
For example, calling getprotobyname('icmp') returns 1; or users would enter '1' 
for ICMP.  For IPv6, this would be '58'. To open a raw socket for a ICMPv6, the 
command would be: socket_create(AF_INET6, SOCK_RAW, '58');


Test script:
---------------
<?php

$package = "\x08\x00\x7d\x4b\x00\x00\x00\x00Howdy";

// Write fails in this test
$socket = socket_create(AF_INET6, SOCK_RAW, 1);
socket_write($socket, $package, strlen($package));

// Write successful in this test
$socket = socket_create(AF_INET6, SOCK_RAW, 58);
socket_write($socket, $package, strlen($package)); 

Expected result:
----------------
See above

Actual result:
--------------
See above

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-26 23:39 UTC] spandit at stealth dot net
Discard;  Perhaps the doc should just be updated to include some IPv6 protocols 
(e.g. ipv6-icmp)
 [2011-01-27 18:45 UTC] spandit at stealth dot net
-Type: Documentation Problem +Type: Bug
 [2011-01-27 18:45 UTC] spandit at stealth dot net
I'd also like to add that the full IPv6 packet is not passed to socket_read() in 
this particular test.

socket_read() sees:
800046e200000000486f776479
810045e200000000486f776479

tcpdump sees:

12:44:30.720191 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 13) ::1 > 
::1: [icmp6 sum ok] ICMP6, echo request, length 13, seq 0
     0x0000:  6000 0000 000d 3a40 0000 0000 0000 0000  `.....:@........
     0x0010:  0000 0000 0000 0001 0000 0000 0000 0000  ................
     0x0020:  0000 0000 0000 0001 8000 46e2 0000 0000  ..........F.....
     0x0030:  486f 7764 79                             Howdy
12:44:30.720227 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 13) ::1 > 
::1: [icmp6 sum ok] ICMP6, echo reply, length 13, seq 0
     0x0000:  6000 0000 000d 3a40 0000 0000 0000 0000  `.....:@........
     0x0010:  0000 0000 0000 0001 0000 0000 0000 0000  ................
     0x0020:  0000 0000 0000 0001 8100 45e2 0000 0000  ..........E.....
     0x0030:  486f 7764 79                             Howdy
 [2011-01-28 00:36 UTC] aharvey@php.net
-Package: Documentation problem +Package: Sockets related
 [2011-01-28 00:36 UTC] aharvey@php.net
I don't think there's any great need to put specific IPv6 protocol
information into the manual page, but someone familiar with ICMP
should have a look at the other potential bug.
 [2011-03-15 10:44 UTC] cataphract@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: cataphract
 [2011-03-17 00:46 UTC] cataphract@php.net
-Type: Bug +Type: Documentation Problem
 [2017-10-24 07:56 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: cataphract +Assigned To:
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 00:01:27 2024 UTC