Date: Sun, 03 Jul 2005 00:09:25 -0000 From: Max Laier <max@love2party.net> To: freebsd-net@freebsd.org Cc: Andrea Campi <andrea+freebsd_arch@webcom.it>, freebsd-arch@freebsd.org Subject: Re: in.c autoadding prefix route Message-ID: <200411120116.33771.max@love2party.net> In-Reply-To: <20041111215506.GA60227@webcom.it> References: <200411112124.12616.max@love2party.net> <20041111215506.GA60227@webcom.it>
next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart2998521.leMBpdJXmZ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 11 November 2004 22:55, Andrea Campi wrote: > On Thu, Nov 11, 2004 at 09:24:05PM +0100, Max Laier wrote: > > The attached patch (http://people.freebsd.org/~mlaier/in.c.patch) deriv= ed > > from WIDE via OpenBSD in.c, rev 1.21 improves the handling of automatic > > prefix routes. > > Sounds like a very useful change indeed. > > One comment though: > > @@ -743,26 +766,7 @@ > > return (0); > > flags |=3D RTF_HOST; > > } > > - > > - /*- > > - * Don't add host routes for interface addresses of > > - * 0.0.0.0 --> 0.255.255.255 netmask 255.0.0.0. This makes it > > - * possible to assign several such address pairs with consistent > > - * results (no host route) and is required by BOOTP. > > - * > > - * XXX: This is ugly ! There should be a way for the caller to > > - * say that they don't want a host route. > > - */ > > - if (ia->ia_addr.sin_addr.s_addr !=3D INADDR_ANY || > > - ia->ia_netmask !=3D IN_CLASSA_NET || > > - ia->ia_dstaddr.sin_addr.s_addr !=3D htonl(IN_CLASSA_HOST)) { > > - if ((error =3D rtinit(&ia->ia_ifa, (int)RTM_ADD, flags)) !=3D 0) { > > - ia->ia_addr =3D oldaddr; > > - return (error); > > - } > > - ia->ia_flags |=3D IFA_ROUTE; > > - } > > - > > + error =3D in_addprefix(ia, flags); > > /* > > * If the interface supports multicast, join the "all hosts" > > * multicast group on that interface. > > Are you sure you want to go on if you got an error? Regardless, you should > probably have an empty line after in_addrprefix. Not sure how to deal with the error case. All errors we should get are memo= ry=20 related (as we check carefully that the rtinit will success). This means th= at=20 the following in_addmulti will sleep if we hit it (in_addmulti mallocs with= =20 M_WAITOK) ... so I guess you are right and it's the least intrusive if we d= o=20 return. > > + TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) { > > + if (rtinitflags(ia)) > > + p =3D ia->ia_dstaddr.sin_addr; > > + else { > > The if() is misindented. Right, thanks. Patch at: http://people.freebsd.org/~mlaier/in.c.patch updated accordingly. =2D-=20 /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News --nextPart2998521.leMBpdJXmZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQBBlADhXyyEoT62BG0RAiqXAJ9vmIRYQO8Trr94o1cFZK3J7dv1CgCeOJcx yym8dnddM9LXO8FJPiWPt/c= =fe8I -----END PGP SIGNATURE----- --nextPart2998521.leMBpdJXmZ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411120116.33771.max>