From owner-freebsd-net@FreeBSD.ORG Tue Dec 7 14:59:37 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1AC9816A4FC; Tue, 7 Dec 2004 14:59:37 +0000 (GMT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id F378E43D49; Tue, 7 Dec 2004 14:59:35 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id iB7ExYRV087761; Tue, 7 Dec 2004 16:59:34 +0200 (EET) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 95690-13; Tue, 7 Dec 2004 16:59:33 +0200 (EET) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id iB7ExXXC087758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Dec 2004 16:59:33 +0200 (EET) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.1/8.13.1) id iB7ExWKs001567; Tue, 7 Dec 2004 16:59:32 +0200 (EET) (envelope-from ru) Date: Tue, 7 Dec 2004 16:59:32 +0200 From: Ruslan Ermilov To: Max Laier Message-ID: <20041207145932.GA1336@ip.net.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tjCHc7DPkfUGtrlw" Content-Disposition: inline User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at ip.net.ua cc: net@FreeBSD.org Subject: Another bug with netmasked aliases (with fix) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Dec 2004 14:59:37 -0000 --tjCHc7DPkfUGtrlw Content-Type: multipart/mixed; boundary="YiEDa0DAkWCtVeE4" Content-Disposition: inline --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Max, I played today with "netmasked aliases", and found what appears to be another bug. Adding an alias to the Ethernet interface with the same netmask results in this address not being pingable from this host -- it just spits ARP requests to the wire and never hears back (most Ethernets are simplex devices). I knew what the fix should look like, and then quickly found a ready to commit solution in OpenBSD rev. 1.47. When testing the attached patch, make sure you do *not* have a (host) route for the alias being added. Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Content-Transfer-Encoding: quoted-printable Index: if_ether.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v retrieving revision 1.131 diff -u -p -r1.131 if_ether.c --- if_ether.c 26 Oct 2004 03:31:58 -0000 1.131 +++ if_ether.c 7 Dec 2004 14:24:57 -0000 @@ -162,6 +162,7 @@ arp_rtrequest(req, rt, info) struct sockaddr *gate; struct llinfo_arp *la; static struct sockaddr_dl null_sdl =3D {sizeof(null_sdl), AF_LINK}; + struct in_ifaddr *ia; =20 RT_LOCK_ASSERT(rt); =20 @@ -250,8 +251,13 @@ arp_rtrequest(req, rt, info) } #endif =20 - if (SIN(rt_key(rt))->sin_addr.s_addr =3D=3D - (IA_SIN(rt->rt_ifa))->sin_addr.s_addr) { + TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) { + if (ia->ia_ifp =3D=3D rt->rt_ifp && + SIN(rt_key(rt))->sin_addr.s_addr =3D=3D + (IA_SIN(ia))->sin_addr.s_addr) + break; + } + if (ia) { /* * This test used to be * if (loif.if_flags & IFF_UP) --YiEDa0DAkWCtVeE4-- --tjCHc7DPkfUGtrlw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBtcVUqRfpzJluFF4RAsa7AJ448geE832N3HiApQ3HQuWrolupXgCgj7pk Z7MGBypn6gtAh7z72r7cY48= =JBx6 -----END PGP SIGNATURE----- --tjCHc7DPkfUGtrlw--