From owner-freebsd-bugs@FreeBSD.ORG Wed Sep 8 13:50:36 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E41916A4D9 for ; Wed, 8 Sep 2004 13:50:36 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1D72B43D41 for ; Wed, 8 Sep 2004 13:50:33 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i88DoWZu093129 for ; Wed, 8 Sep 2004 13:50:33 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i88DoW4e093128; Wed, 8 Sep 2004 13:50:32 GMT (envelope-from gnats) Date: Wed, 8 Sep 2004 13:50:32 GMT Message-Id: <200409081350.i88DoW4e093128@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Ruslan Ermilov Subject: Re: kern/71474: route lookup does not skip interfaces marked down X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Ruslan Ermilov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2004 13:50:36 -0000 The following reply was made to PR kern/71474; it has been noted by GNATS. From: Ruslan Ermilov To: Thomas Quinot Cc: bug-followup@FreeBSD.ORG Subject: Re: kern/71474: route lookup does not skip interfaces marked down Date: Wed, 8 Sep 2004 16:49:27 +0300 On Wed, Sep 08, 2004 at 03:06:48PM +0200, Thomas Quinot wrote: > * Ruslan Ermilov, 2004-09-08 : > > > > ifconfig I1 192.168.0.1 netmask 255.255.255.0 > > > ifconfig I1 down > > > ifconfig I2 192.168.0.2 netmask 255.255.255.0 > > > route add default 192.168.0.254 > > > > > > The default route will be set to 192.168.0.254 on I1, not on I2 as > > > expected. > > > > > It's still a misconfiguration -- if you do not bring the I1 interface > > down, the "interface" route for I2 will not be installed, and the > > ifconfig(8) command will be aborted. Anyway... > > I am not sure I get what you mean. The point of this PR is that I *do* > bring I1 down, that the kernel has an unambiguous indication of how to > reach the specified gateway ('ping 192.168.0.254' works in the example > described above), and in spite of that the wrong interface is selected > when creating a route. > This is a misconfiguration because you cannot expect two broadcast interfaces configured with the same IP network to work. The fact that it works at all, in a scenario you shown, is probably a bug. > > I reproduced this with two ng_eiface(4) nodes. There's still a useful > > option in the route(8) utility -- you can supply an explicit reference > > to the interface, like this: > > : route add default 192.168.0.254 -ifp I1 > > Right, I was not aware of that option. > > > This is also vaguely documented in the route(8) manpage, FWIW: > > *Vaguely* is the right term I think. :-) > > Having browsed through the code, I think the interface lookup for route > additions should use a modified version of ifa_ifwithaddr ignoring > non-up interfaces. > If we change ifa_ifwith*() to ignore !IFF_UP interfaces, I suspect this will break too many things. I think the correct change here would be to set the interface of the route to the interface of its gateway (if route is through the gateway (RTF_GATEWAY)). This should be easy to fix, but I don't have a time for this now. Cheers, -- Ruslan Ermilov ru@FreeBSD.org FreeBSD committer