|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 18:00:01 2025 UTC |
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