loopback routes miss RTF_PINNED flag

Rodney W. Grimes freebsd-rwg at pdx.rh.CN85.dnsmgr.net
Sat Oct 21 17:38:49 UTC 2017


> Hi!
> 
> When IP address is being added to an interface, a kernel installs loopback route.
> For P2P interfaces, we have local IP address and remote one.
> 
> A route to remote address is added with RTF_PINNED flag,
> so that it overrides any possibly existing route to that address added
> by a routing daemon and that's fine.
> 
> A route to local address created with ifa_maintain_loopback_route() function in
> https://svnweb.freebsd.org/base/head/sys/net/if.c?annotate=323170#l1711
> misess RTF_PINNED flag, so that it cannot override similar possibly existing route
> and that's not fine as rtrequest1_fib() returns EEXIST in such case.
> This error is then propagated back to userland ioctl SIOCAIFADD breaking
> interface configuration sequence. See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223129
> for real world example.
> 
> Is there a reason for such loopback routes to not have RTF_PINNED flag?

Is there a reason that the kernel is setting a policy at all?   These
_loopback_route routines are of dubious value and mostly interfere
with anyone running a real routing protocol.

My local tree removes this code.

The reasons claimed to it being added was if you downed/upped an
interface you lost these routes, which have traditionally been
installed at boot time by /etc/netstart.

IMHO this should be handled by code outside the kernel.

The only value in these routes is that you pickup the MTU of
lo0 for local sockets.

Rather than my reversion method of fixing this, they could
by wrapped in a #ifdef LO_ROUTES, with a sysctl inside that
giving 3 ways to deal with them for everyone, GENERIC
gets options LO_ROUTES, the sysctl defaults to on, leaving
things as they are now, someone who wants these off but
doesnt want to recompile can use the sysctl, and people like
me who find this code of no value can remove the option
from there kernel.

Your propossed RTF_PINNED I think actually just aggrivates
the problem with most routing daemons fighting the kernel
on adding/removing these routes.

bird is very noisy if you do not disable this code.

-- 
Rod Grimes                                                 rgrimes at freebsd.org


More information about the freebsd-net mailing list