Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Mar 2001 17:23:55 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Alexander Leidinger <Alexander@leidinger.net>
Cc:        net@FreeBSD.org
Subject:   Re: Recent interface/routing changes breaks on-demand PPP (+sppp)
Message-ID:  <20010330172355.A94198@sunbay.com>
In-Reply-To: <200103301339.f2UDdro62427@Magelan.Leidinger.net>; from Alexander@leidinger.net on Fri, Mar 30, 2001 at 03:39:40PM %2B0200
References:  <20010330152132.C82273@sunbay.com> <200103301339.f2UDdro62427@Magelan.Leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
[Redirected to -net]

On Fri, Mar 30, 2001 at 03:39:40PM +0200, Alexander Leidinger wrote:
> On 30 Mar, Ruslan Ermilov wrote:
> 
> >> What to do in this situation? I didn't want add the defaultroute
> >> everytime (POLA).
> >> 
> > But if we don't do this, we may end up using the wrong source IP
> > address.  Without my fixes, try this:
> > 
> > 1)  ifconfig isp1 X.X.X.1 ....
> > 2)  route add default -iface isp1
> > 3)  ifconfig isp1 X.X.X.2
> > 4)  ping some outside host
> > 5)  watch the packets will go from the wrong address (X.X.X.1)
> 
> If I use
>   route add default -interface isp1
> I wan't to have the packets routed trough isp1. I don't care about how
> the routing table is held consistent, but I if the route is discarded
> without my interaction it not only violates POLA, in this case it's
> prohibits a valid use of the -interface feature (dial on demand via sppp
> is broken at the moment).
> 
OK, finally got it.  When the interface goes down, the address is still
valid, and there is no reason to delete (static?) routes that use this
address, but the new code does.  I was confused by the code comment below
for the rip_ctlinput() function in raw_ip.c.  The old code actually only
deleted dynamically creates routes (ARP cache, etc.).  IOW, that could be
used as some sort of flush.

: /*
:  * This function exists solely to receive the PRC_IFDOWN messages which
:  * are sent by if_down().  It looks for an ifaddr whose ifa_addr is sa,
:  * and calls in_ifadown() to remove all routes corresponding to that address.
                                      ^^^^^^^^^^
:  * It also receives the PRC_IFUP messages from if_up() and reinstalls the
:  * interface routes.
:  */

I then modified in_ifadown() so that it deletes static routes as well
that use this address.

I will probably implement in_ifadelete() that will be called when the
interface address is actually deleted (in_control(); SIOCDIFADDR),
and restore the old behavior of in_ifadown().

This will take some time.  Meanwhile, the following patch could be used
as the temporary workaround:

Index: raw_ip.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/raw_ip.c,v
retrieving revision 1.75
diff -u -p -r1.75 raw_ip.c
--- raw_ip.c	2001/03/16 20:00:53	1.75
+++ raw_ip.c	2001/03/30 14:09:20
@@ -398,7 +398,9 @@ rip_ctlinput(cmd, sa, vip)
 				 * thing to do, but at least if we are running
 				 * a routing process they will come back.
 				 */
+#if 0
 				in_ifadown(&ia->ia_ifa);
+#endif
 				break;
 			}
 		}


Let me know if it works for you.


Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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