Date: Wed, 20 Jul 2011 12:34:38 +0300 From: Daniel Braniss <danny@cs.huji.ac.il> To: Eygene Ryabinkin <rea@freebsd.org> Cc: freebsd-net@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: broadcast oddity Message-ID: <E1QjTAs-000IjW-Ba@kabab.cs.huji.ac.il> In-Reply-To: <20110719172455.GP54929@MacBook-Eygene-Ryabinkin.local> References: <E1QioQt-000MJQ-T9@kabab.cs.huji.ac.il> <20110718203215.GM54929@MacBook-Eygene-Ryabinkin.local> <E1Qj4uZ-0005nH-SR@kabab.cs.huji.ac.il> <20110719172455.GP54929@MacBook-Eygene-Ryabinkin.local>
next in thread | previous in thread | raw e-mail | index | archive | help
> Tue, Jul 19, 2011 at 10:40:11AM +0300, Daniel Braniss wrote: > > > And that non-broadcast ethernet address is the MAC of your > > > default router? > > yes. with dest_addr = INADDR_BROADCAST on the non diskless: 09:44:29.850576 00:0d:b9:00:72:a8 (oui Unknown) > 00:04:38:a0:c6:07 (oui Unknown), ethertype IPv4 (0x0800), length 61: wrap-1.cs.huji.ac.il.53016 > 255.255.255.255.12345: UDP, length 19 and 00:04:38:a0:c6:07 belongs to the router: wrap-1# arp -a | grep 00:04:38:a0:c6:07 router-80.cs.huji.ac.il (132.65.80.1) at 00:04:38:a0:c6:07 on sis0 expires in 1200 seconds [ethernet] > > Fine, that is more-or-less expected, since the network subsystem > just routes 255.255.255.255 to the default gateway. The issue > you're seeing were already seen before, > http://lists.freebsd.org/pipermail/freebsd-net/2005-October/008626.html > http://www.freebsd.org/cgi/query-pr.cgi?pr=3D72468 > http://lists.freebsd.org/pipermail/freebsd-net/2007-January/012874.html [= > 1] the more I read the more confused i get :-) > and bms@ told me that in this case the default gateway routing is the > correct historical behaviour of FreeBSD. > > [1] I finally remembered that I had seen this issue too ;)) > > > > What's your routing table (netstat -rn) for the PXE-booted host? > > > > it's ok, same in both cases. it's picked up via DHCP, in the diskless > > case by the boot/loader in the second via dhcpclient. > > Still, can you show both of them? from the diskless: els-01# ifconfig vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=8280b<RXCSUM,TXCSUM,VLAN_MTU,WOL_UCAST,WOL_MAGIC,LINKSTATE> ether 00:0d:b9:22:57:18 inet 132.65.91.1 netmask 0xfffff000 broadcast 132.65.95.255 media: Ethernet autoselect (100baseTX <full-duplex>) status: active lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=3<RXCSUM,TXCSUM> inet 127.0.0.1 netmask 0xff000000 els-01# netstat -rn Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire default 132.65.80.1 UG 0 16606 vr0 127.0.0.1 link#4 UH 0 36 lo0 132.65.80.0/20 link#1 U 0 86612 vr0 132.65.91.1 link#1 UHS 0 12 lo0 from the non-diskless: wrap-1# ifconfig sis0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=83808<VLAN_MTU,WOL_UCAST,WOL_MCAST,WOL_MAGIC,LINKSTATE> ether 00:0d:b9:00:72:a8 inet 132.65.80.181 netmask 0xfffff000 broadcast 132.65.95.255 media: Ethernet autoselect (100baseTX <full-duplex>) status: active sis1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=83808<VLAN_MTU,WOL_UCAST,WOL_MCAST,WOL_MAGIC,LINKSTATE> ether 00:0d:b9:00:72:a9 media: Ethernet autoselect (none) status: no carrier lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=3<RXCSUM,TXCSUM> inet 127.0.0.1 netmask 0xff000000 wrap-1# netstat -rn Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire default 132.65.80.1 UGS 0 16936 sis0 127.0.0.1 link#4 UH 0 76 lo0 132.65.80.0/20 link#1 U 0 67433 sis0 132.65.80.181 link#1 UHS 0 0 lo0 > > > > You nailed it: you should send packets to the network's broadcast, > > > not to the 0xffffffff. > > >=20 > > but I'm at the user/ip level!, have no way to set mac/ethernet address. > > I meant the IP's network broadcast and by 0xffffffff I meant > 255.255.255.255. Please, look at the posted code. > > > still, the question is why it works in one case, and failes in the other. > > Yes, it is. But ip_output.c has the following code, > {{{ > if (rte->rt_flags & RTF_GATEWAY) > dst =3D (struct sockaddr_in *)rte->rt_gateway; > if (rte->rt_flags & RTF_HOST) > isbroadcast =3D (rte->rt_flags & RTF_BROADCAST); > else > isbroadcast =3D in_broadcast(dst->sin_addr, ifp); > }}} > > So, if the route that is selected is the gateway, then there will be > no broadcast on the L2. At least in my understanding of the code. > Thus, I am interested in the routing tables and route flags. so it boils down to a problem in selecting the route? cheers, danny
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1QjTAs-000IjW-Ba>