Date: Tue, 7 Dec 2004 16:59:32 +0200 From: Ruslan Ermilov <ru@FreeBSD.org> To: Max Laier <mlaier@FreeBSD.org> Cc: net@FreeBSD.org Subject: Another bug with netmasked aliases (with fix) Message-ID: <20041207145932.GA1336@ip.net.ua>
next in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041207145932.GA1336>