From owner-freebsd-arch@FreeBSD.ORG Fri Nov 12 14:59:11 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 18C4716A4CE for ; Fri, 12 Nov 2004 14:59:11 +0000 (GMT) Received: from vampire.homelinux.org (p548082DF.dip.t-dialin.net [84.128.130.223]) by mx1.FreeBSD.org (Postfix) with ESMTP id AD2BE43D3F for ; Fri, 12 Nov 2004 14:59:09 +0000 (GMT) (envelope-from mlaier@vampire.homelinux.org) Received: (qmail 92219 invoked by uid 1001); 12 Nov 2004 14:58:14 -0000 Date: Fri, 12 Nov 2004 15:58:14 +0100 From: Max Laier To: Ruslan Ermilov Message-ID: <20041112145814.GA92163@router.laiers.local> References: <200411112124.12616.max@love2party.net> <20041112083014.GB41844@ip.net.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041112083014.GB41844@ip.net.ua> User-Agent: Mutt/1.4.2.1i cc: Max Laier cc: freebsd-net@freebsd.org cc: freebsd-arch@freebsd.org Subject: Re: in.c autoadding prefix route X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Nov 2004 14:59:11 -0000 On Fri, Nov 12, 2004 at 10:30:14AM +0200, Ruslan Ermilov wrote: > 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 > > time I am set to commit! > > > Hey, you did it! ;) > > > The attached patch (http://people.freebsd.org/~mlaier/in.c.patch) derived from > > WIDE via OpenBSD in.c, rev 1.21 improves the handling of automatic prefix > > routes. > > > > Right now you can't have two legs into the same network. If you want to, you > > must give on of the interfaces a host address only (netmask /32). This way it > > is not possible to hand over the route if one of the interfaces is > > "removed" (however this is done in the special case). > > > > The patch allows to add more than on IPv4 address with the same prefix. In the > > case that there is a route already, we leave it alone and add the new address > > without the IFA_ROUTE flag. When we remove an address later on, that has a > > route associated, we try to find an alternative address to use for the route > > and hand it over. > > > 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) == 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 &= ~IFA_ROUTE; > > + in_scrubprefix(ia); > > } > > > Looks like "ifp" argument is no longer needed for in_ifscrub(), > perhaps it should be killed then. As in_ifscrub() isn't static in in.c I think it must be considered kernel API and hence I will wait with this cleanup 'till after the MFC. I otherwise agree that it should be done. > 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). I updated the patch at: http://people.freebsd.org/~mlaier/in.c.patch with new comments. Can you be more specific about the other style(9) violations, as I don't seem to find them. K&R was choosen as the rest of in.c is K&R still and I think style(9) requires that the overall style of a file is maintained. Thanks. -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News