netdev
[Top] [All Lists]

Re: notion of a local address [was: Re: ioctl SIOCGIFNETMASK: ip aliasbu

To: Julian Anastasov <ja@xxxxxx>
Subject: Re: notion of a local address [was: Re: ioctl SIOCGIFNETMASK: ip aliasbug 2.4.9 and 2.2.19]
From: Andrey Savochkin <saw@xxxxxxxxxxxxx>
Date: Fri, 7 Sep 2001 13:48:29 +0400
Cc: netdev@xxxxxxxxxxx
In-reply-to: <Pine.LNX.4.33.0109071140010.1692-100000@xxxxxxxxxxxx>; from "Julian Anastasov" on Fri, Sep 07, 2001 at 12:08:05PM
References: <20010907124220.A27338@xxxxxxxxxxxxxxxxx> <Pine.LNX.4.33.0109071140010.1692-100000@xxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
On Fri, Sep 07, 2001 at 12:08:05PM +0000, Julian Anastasov wrote:
> 
>       Hello,
> 
> On Fri, 7 Sep 2001, Andrey Savochkin wrote:
> 
> > In my opinion, the priorities in address selection should be the following:
> >  1. always use prefsrc if it is specified
> >  2. then for local routes, use destination
> >  3. as a last resort, call that function guessing the address...
> 
>       So, you mean such change:
> 
>       if (!key.src)
>               key.src = key.dst;
> with
>       if (!key.src)
>               key.src = res.fi->fib_prefsrc ?: key.dst;
> 
>       key.dst is != 0, so, we don't need to call FIB_RES_PREFSRC
> and inet_select_addr, we prefer key.dst as source.

Yes, something like this.
I only wonder why there is a check `if (res.fi)' several lines below and
whether !res.fi can really happen in this place.
After that FIB_RES_PREFSRC is used without any precautions.

Dave, could you consider the patch, please?
"We used to ignore preferred source in local route, and this patch fixes it."

        Andrey
        
--- net/ipv4/route.c.x  Fri Sep  7 02:30:54 2001
+++ net/ipv4/route.c    Fri Sep  7 02:30:54 2001
@@ -1795,14 +1795,13 @@
 
        if (res.type == RTN_LOCAL) {
                if (!key.src)
-                       key.src = key.dst;
+                       key.src = res.fi->fib_prefsrc ? : key.dst;
                if (dev_out)
                        dev_put(dev_out);
                dev_out = &loopback_dev;
                dev_hold(dev_out);
                key.oif = dev_out->ifindex;
-               if (res.fi)
-                       fib_info_put(res.fi);
+               fib_info_put(res.fi);
                res.fi = NULL;
                flags |= RTCF_LOCAL;
                goto make_route;

<Prev in Thread] Current Thread [Next in Thread>