Date: Fri, 12 Nov 2004 10:30:14 +0200 From: Ruslan Ermilov <ru@freebsd.org> To: Max Laier <max@love2party.net> Cc: freebsd-arch@freebsd.org Subject: Re: in.c autoadding prefix route Message-ID: <20041112083014.GB41844@ip.net.ua> In-Reply-To: <200411112124.12616.max@love2party.net> References: <200411112124.12616.max@love2party.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--GID0FwUMdk1T2AWN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Max, On Thu, Nov 11, 2004 at 09:24:05PM +0100, Max Laier wrote: > I know I have sent this a couple of times before, but never got anywhere.= This=20 > time I am set to commit! >=20 Hey, you did it! ;) > The attached patch (http://people.freebsd.org/~mlaier/in.c.patch) derived= from=20 > WIDE via OpenBSD in.c, rev 1.21 improves the handling of automatic prefix= =20 > routes. >=20 > Right now you can't have two legs into the same network. If you want to, = you=20 > must give on of the interfaces a host address only (netmask /32). This wa= y it=20 > is not possible to hand over the route if one of the interfaces is=20 > "removed" (however this is done in the special case). >=20 > The patch allows to add more than on IPv4 address with the same prefix. I= n the=20 > case that there is a route already, we leave it alone and add the new add= ress=20 > without the IFA_ROUTE flag. When we remove an address later on, that has = a=20 > route associated, we try to find an alternative address to use for the ro= ute=20 > and hand it over. >=20 I cannot give your patch a thorough review at the moment, but I like the algorithm, and I don't see how it can hurt anything. > --- ../dist/sys/netinet/in.c Sat Nov 6 21:01:08 2004 > +++ sys/netinet/in.c Mon Nov 8 02:05:17 2004 > @@ -654,14 +684,7 @@ > register struct ifnet *ifp; > register struct in_ifaddr *ia; > { > - > - if ((ia->ia_flags & IFA_ROUTE) =3D=3D 0) > - return; > - if (ifp->if_flags & (IFF_LOOPBACK|IFF_POINTOPOINT)) > - rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST); > - else > - rtinit(&(ia->ia_ifa), (int)RTM_DELETE, 0); > - ia->ia_flags &=3D ~IFA_ROUTE; > + in_scrubprefix(ia); > } > =20 Looks like "ifp" argument is no longer needed for in_ifscrub(), perhaps it should be killed then. Also, there are a lot of style bugs (besides those that others have already mentioned), the most annoying is comments -- they should be written as per style(9) (make them look like the real sentences). Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --GID0FwUMdk1T2AWN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBlHSWqRfpzJluFF4RAsJbAJ9MrlyCTjeeC7Db9kC5iZ/xBrt8KQCeIdRy 3pYQvaSeF7SeF+iohADcOmM= =4Ken -----END PGP SIGNATURE----- --GID0FwUMdk1T2AWN--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041112083014.GB41844>