From owner-freebsd-net@FreeBSD.ORG Fri Nov 12 00:16:26 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 EB91B16A4CE; Fri, 12 Nov 2004 00:16:25 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id 78F3043D39; Fri, 12 Nov 2004 00:16:23 +0000 (GMT) (envelope-from max@love2party.net) Received: from [212.227.126.208] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1CSP70-00052M-00; Fri, 12 Nov 2004 01:16:22 +0100 Received: from [84.128.130.223] (helo=donor.laier.local) by mrelayng.kundenserver.de with asmtp (TLSv1:RC4-MD5:128) (Exim 3.35 #1) id 1CSP70-0000rr-00; Fri, 12 Nov 2004 01:16:22 +0100 From: Max Laier To: freebsd-net@freebsd.org Date: Fri, 12 Nov 2004 01:16:31 +0100 User-Agent: KMail/1.7.1 References: <200411112124.12616.max@love2party.net> <20041111215506.GA60227@webcom.it> In-Reply-To: <20041111215506.GA60227@webcom.it> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2998521.leMBpdJXmZ"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200411120116.33771.max@love2party.net> X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:61c499deaeeba3ba5be80f48ecc83056 cc: freebsd-arch@freebsd.org cc: Andrea Campi Subject: Re: in.c autoadding prefix route 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: Fri, 12 Nov 2004 00:16:26 -0000 --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--