#35490 [Opn->Csd]: socket_sendto() unable to handle IPv6 addresses
ID: 35490
Updated by: tony2001@php.net
Reported By: Xavier dot Redon at polytech-lille dot fr
-Status: Open
+Status: Closed
Bug Type: Sockets related
Operating System: Linux 2.6
PHP Version: 5.1.1
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-11-30 14:55:45] Xavier dot Redon at polytech-lille dot fr
Description:
------------
When executing the script below an error occurs.
A trace with strace show that the struct sockaddr of the system call
sendto is uninitialized (or badly initialized) :
sendto(3, "Test Message", 12, 0, {sa_family=0x45a0 /* AF_??? */,
sa_data="<\10\20\0\0\0\20\0\0\0\250\376\343\277"}, 16) = -1 EINVAL
(Invalid argument)
Reproduce code:
---------------
<?
$sh = socket_create(AF_INET6,SOCK_DGRAM,0);
if (socket_bind($sh, '::1', 4242)) {
echo "Socket ok\n";
}
$buf = 'Test Message';
$len = strlen($buf);
if (socket_sendto($sh, $buf, $len, 0x00, '::1', 4000) !== FALSE) {
echo "Message sent\n";
}
socket_close($sh);
?>
Expected result:
----------------
an IPv6 UDP datagram should be sent to the IPv6 loopback address.
Actual result:
--------------
Warning: socket_sendto(): unable to write to socket [22]: Invalid
argument in /tmp/toto.php on line 12
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35490&edit=1
Thread (2 messages)