Date: Sun, 7 Jan 2007 14:51:58 +0300 From: Eygene Ryabinkin <rea-fbsd@codelabs.ru> To: "Bruce M. Simpson" <bms@FreeBSD.org> Cc: freebsd-net@freebsd.org, LI Xin <delphij@delphij.net> Subject: Re: Different behavior of ping'ing INADDR_BROADCAST? Message-ID: <20070107115158.GA63854@codelabs.ru> In-Reply-To: <459FEDBC.4070008@FreeBSD.org> References: <459D4D88.2030708@delphij.net> <459FEDBC.4070008@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce, good day! > 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. May be I didn't understood you, but you seems to be wrong: the ICMP packets with 255.255.255.255 as the destination will go through the full routing and will hit the 'else' statement at the line 224 of ip_output.c (citing revision 1.269). For me the routing gives the default gateway as the next hop, so the 'dst' will be rewritten at the line 241. > 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. I think that this confirms my findings. Have you tried to look at your packet with tcpdump? Link-level MAC should be set to your routers one, not to yhe 0xffffffff. > 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. Made the patch for 'ping': see my previous post in this thread. Testing is much welcome. > 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. May be it will be me, but not sure now :( -- Eygene
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070107115158.GA63854>