Edit report at http://bugs.php.net/bug.php?id=53851&edit=1
ID: 53851 Updated by: ahar...@php.net Reported by: spandit at stealth dot net Summary: socket_create protocol int (IPv6) Status: Open Type: Bug -Package: Documentation problem +Package: Sockets related Operating System: FreeBSD 8.x PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2011-01-27 18:45:05] 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-26 23:39:29] spandit at stealth dot net Discard; Perhaps the doc should just be updated to include some IPv6 protocols (e.g. ipv6-icmp) ------------------------------------------------------------------------ [2011-01-26 23:36:22] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53851&edit=1