LI Xin wrote:
Dear colleagues,
I have a strange question about our way of handling INADDR_BROADCAST,
the behavior looks different from all other operating systems I have
tried, except Mac OS X ;-)
By ping'ing 255.255.255.255 from FreeBSD (mostly RELENG_6 with some
unrelated patches) or Mac OS X, I got response from another subnet (I
guess that there is some configuration problem in the network, though),
but no boxes (running various operating systems) on local network
responds the ping.
However, with OpenBSD, Linux and Windows, ping'ing 255.255.255.255 would
get response from local network.
Just curious why there is such difference. Literally, I think
INADDR_BROADCAST is supposed to reach local network nodes, no?
With FreeBSD's stack, sending packets to the undirected broadcast
address INADDR_BROADCAST will result in the first ifnet with IPv4
configured and IFF_BROADCAST set being selected as the source ifnet. See
ip_output.c for details.
In my local network, pinging 255.255.255.255 from my FreeBSD laptop
(running 6.2-RC1) results in a single unicast ICMP reply from the edge
router, with its source address on the same LAN.
The IP_SENDONES socket option may be used to select the source interface
for undirected broadcasts, by sending to a directed broadcast address.
The stack will munge the directed address to 255.255.255.255 before it
goes on the wire. This came from BSD/OS; See ip(4) for details.
You might want to take a look at NetBSD's stack, which has recently had
IPv4 source address selection logic added to it to support schemes such
as link-local addressing (Zeroconf/Rendezvous).
It would be great if someone had time to look at this and perhaps port it.
Regards,
BMS
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"