From owner-freebsd-net@FreeBSD.ORG Wed Jul 20 09:34:41 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 837C2106566C; Wed, 20 Jul 2011 09:34:41 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.16.84]) by mx1.freebsd.org (Postfix) with ESMTP id DB6F18FC13; Wed, 20 Jul 2011 09:34:40 +0000 (UTC) Received: from pampa.cs.huji.ac.il ([132.65.80.32]) by kabab.cs.huji.ac.il with esmtp id 1QjTAs-000IjW-Ba; Wed, 20 Jul 2011 12:34:38 +0300 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: Eygene Ryabinkin In-reply-to: <20110719172455.GP54929@MacBook-Eygene-Ryabinkin.local> References: <20110718203215.GM54929@MacBook-Eygene-Ryabinkin.local> <20110719172455.GP54929@MacBook-Eygene-Ryabinkin.local> Comments: In-reply-to Eygene Ryabinkin message dated "Tue, 19 Jul 2011 21:24:55 +0400." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 20 Jul 2011 12:34:38 +0300 From: Daniel Braniss Message-ID: Cc: freebsd-net@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: broadcast oddity X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2011 09:34:41 -0000 > 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 metric 0 mtu 1500 options=8280b ether 00:0d:b9:22:57:18 inet 132.65.91.1 netmask 0xfffff000 broadcast 132.65.95.255 media: Ethernet autoselect (100baseTX ) status: active lo0: flags=8049 metric 0 mtu 16384 options=3 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 metric 0 mtu 1500 options=83808 ether 00:0d:b9:00:72:a8 inet 132.65.80.181 netmask 0xfffff000 broadcast 132.65.95.255 media: Ethernet autoselect (100baseTX ) status: active sis1: flags=8802 metric 0 mtu 1500 options=83808 ether 00:0d:b9:00:72:a9 media: Ethernet autoselect (none) status: no carrier lo0: flags=8049 metric 0 mtu 16384 options=3 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