From owner-freebsd-net@FreeBSD.ORG Fri Jul 22 06:28:54 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 9A197106564A; Fri, 22 Jul 2011 06:28:54 +0000 (UTC) (envelope-from rea@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 1431B8FC13; Fri, 22 Jul 2011 06:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codelabs.ru; s=two; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=0JzVxuJQaoa/jSAWGlvjyr3BxaAxrzKqb8kFCLe+lsc=; b=fk5IFiFSbs6pANztcWC5Et0wulinLgbGnnKC95F5QgJLq0ScpkG9R1/AR9a9qeXNXnslVml2Fs4w3ye/RbwGmWr0++XpOAsGJbfGUa+jwQvpJIltcZOjudN0Ccw2i8ZGlvtzTEKQr2CkB+jEXxO6HRWUu76Na7vfF7y3jAof4bEMjnAKMZaQw5hhldUQ6cbNXE4ikRLVU6IovGJLoWbOch2YOTeYdZOlq8PeIea+triGhArled/Q8FbJIjlzs/f2sfsO+3fO3BWj+0v0VM55fwO2UB2wOwyzsoEDB1PFttfFKfRU6LHoTV0zZtV/CYQOts+vs4ss5Tvwe+Qt9QFxIw==; Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1Qk9EC-000AqV-A2; Fri, 22 Jul 2011 10:28:52 +0400 Date: Fri, 22 Jul 2011 10:28:50 +0400 From: Eygene Ryabinkin To: Daniel Braniss Message-ID: References: <20110718203215.GM54929@MacBook-Eygene-Ryabinkin.local> <20110719172455.GP54929@MacBook-Eygene-Ryabinkin.local> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tsOsTdHNUZQcU9Ye" Content-Disposition: inline In-Reply-To: Sender: rea@codelabs.ru 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: Fri, 22 Jul 2011 06:28:54 -0000 --tsOsTdHNUZQcU9Ye Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Wed, Jul 20, 2011 at 12:34:38PM +0300, Daniel Braniss wrote: > from the diskless: > els-01# ifconfig > vr0: flags=3D8843 metric 0 mtu 15= 00 > options=3D8280b > 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=3D8049 metric 0 mtu 16384 > options=3D3 > inet 127.0.0.1 netmask 0xff000000=20 > els-01# netstat -rn > Routing tables >=20 > 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 >=20 > from the non-diskless: > wrap-1# ifconfig > sis0: flags=3D8943 metric= 0 mtu=20 > 1500 > options=3D83808 > 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=3D8802 metric 0 mtu 1500 > options=3D83808 > ether 00:0d:b9:00:72:a9 > media: Ethernet autoselect (none) > status: no carrier > lo0: flags=3D8049 metric 0 mtu 16384 > options=3D3 > inet 127.0.0.1 netmask 0xff000000=20 >=20 > wrap-1# netstat -rn > Routing tables >=20 > 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 The only difference I see is the absence of the 'S' flag on the default route for the diskless case. Will try to create the testbed. > > Yes, it is. But ip_output.c has the following code, > > {{{ > > if (rte->rt_flags & RTF_GATEWAY) > > dst =3D3D (struct sockaddr_in *)rte->rt_gateway; > > if (rte->rt_flags & RTF_HOST) > > isbroadcast =3D3D (rte->rt_flags & RTF_BROADCAS= T); > > else > > isbroadcast =3D3D in_broadcast(dst->sin_addr, i= fp); > > }}} > >=20 > > 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. >=20 > so it boils down to a problem in selecting the route? More-or-less so: for default gateways there will never be any L2-broadcasts, for host routes the L2-broadcasts are governed by the 'B' route flag and for other routes the destination address governs the behaviour (INADDR_ANY & INADDR_BROADCAST as the destination will enable L2-broadcast unconditionally /but most likely we will hit the default route earlier for this case/, interface broadcast address /132.65.95.255 in your case/ will enable L2-brodcast via the corresponding interface). --=20 Eygene Ryabinkin ,,,^..^,,, [ Life's unfair - but root password helps! | codelabs.ru ] [ 82FE 06BC D497 C0DE 49EC 4FF0 16AF 9EAE 8152 ECFB | freebsd.org ] --tsOsTdHNUZQcU9Ye Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iF4EAREIAAYFAk4pGKIACgkQFq+eroFS7Pu6QAD+JAIkX+Rv5wNg4mFn3+nh9ost FXzLZwEAjbdAiLqWAn0A/iyXAYHFpLK5DE5RfQCrSxcFojKaOkotKazyrncZpvU+ =b8c0 -----END PGP SIGNATURE----- --tsOsTdHNUZQcU9Ye--