#40674 [Opn->Fbk]: socket_bind on interface wont see broadcasts to 255.255.255.255
| From: | tony2001@php.net | Date: | Thu, 01 Mar 2007 09:01:10 +0000 |
| Subject: | #40674 [Opn->Fbk]: socket_bind on interface wont see broadcasts to 255.255.255.255 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-109737@lists.php.net to get a copy of this message | ||
ID: 40674
Updated by: tony2001@php.net
Reported By: matth at mystictrd dot com
-Status: Open
+Status: Feedback
Bug Type: Sockets related
Operating System: Debian 3.1
PHP Version: 5.2.1
New Comment:
And why do you think it's PHP related?
Previous Comments:
------------------------------------------------------------------------
[2007-03-01 00:41:33] matth at mystictrd dot com
Description:
------------
A SOCK_DGRAM SOL_UDP socket using socket_bind to an IP address
associated with an interface will not see UDP broadcasts destined to
255.255.255.255. I do not know if this is intended but you can see
them
when listening on 0.0.0.0
Reproduce code:
---------------
<?php
//listens for dhcp requests
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
//you must bind to 0.0.0.0 to actually see anything
socket_bind($socket, "10.66.66.1", 67);
while(1)
{
if($src = @socket_recv($socket, $data, 9999, 0))
{
echo "data!\n";
}
}
?>
Expected result:
----------------
When a DHCP request is made we should see "data!" echoed.
Actual result:
--------------
Nothing was read on the interface - it can only see localhost or direct
packets sent to it (destination interface IP address).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40674&edit=1