Re: notion of a local address [was: Re: ioctl SIOCGIFNETMASK: ip aliasbug 2.4.9 and 2.2.19]

From: Julian Anastasov (ja@ssi.bg)
Date: Fri Sep 07 2001 - 07:08:05 EST


        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.

> > 127.0.0.1). Hm, may be then a bind() call to the same IP will be required
> > before connecting? If bind fails, then the address is not local. If
> > not, connect() should succeed and getsockname should return the same
> > IP (the preferred source will not be considered in this case from
> > the kernel).
>
> I would say that using of bound sockets is a bit risky.
> I'm not sure whether such a connect may succeed with 2.2 kernels and
> transparent proxy support, for example.

        Oh, yes, the tproxy ... the connect call should be without bind,
so this soulution is not entirely perfect when "local networks" are
used (on lo) or when the above feature is considered a bug. Agreed for
the next part of the mail... Hm, time to go to netdev

> Andrey

Regards

--
Julian Anastasov <ja@ssi.bg>

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Sep 07 2001 - 21:00:39 EST