Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Nov 2004 10:36:36 +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:  <20041112083636.GC41844@ip.net.ua>
In-Reply-To: <200411120116.33771.max@love2party.net>
References:  <200411112124.12616.max@love2party.net> <20041111215506.GA60227@webcom.it> <200411120116.33771.max@love2party.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--+nBD6E3TurpgldQp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Nov 12, 2004 at 01:16:31AM +0100, Max Laier wrote:
> 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) der=
ived
> > > from WIDE via OpenBSD in.c, rev 1.21 improves the handling of automat=
ic
> > > 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 sho=
uld
> > probably have an empty line after in_addrprefix.
>=20
> Not sure how to deal with the error case. All errors we should get are me=
mory=20
> related (as we check carefully that the rtinit will success). This means =
that=20
> the following in_addmulti will sleep if we hit it (in_addmulti mallocs wi=
th=20
> M_WAITOK) ... so I guess you are right and it's the least intrusive if we=
 do=20
> return.
>=20
The old code did:

	if ((error =3D rtinit()) !=3D 0)
		return (error);

Why the new code should behave differently, I fail to see?  in_addprefix()
is just a wrapper around rtinit(), after all.


Cheers,
--=20
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer

--+nBD6E3TurpgldQp
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)

iD8DBQFBlHYUqRfpzJluFF4RAgy6AJ4qwETEoghRRzlWwtnipxrcIhU9SQCgiDGY
A3PGCLtB+a+fLw3TCwlLfmc=
=a0HD
-----END PGP SIGNATURE-----

--+nBD6E3TurpgldQp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041112083636.GC41844>