loopback routes pinned by commit r326012 for FreeBSD 10 cannot be deleted
Eugene Grosbein
eugen at grosbein.net
Sat Feb 24 13:04:32 UTC 2018
24.02.2018 19:37, Andreas Longwitz wrote:
>> Please test the follwoind patch for the kernel:
>>
>> --- sys/net/if.c.orig 2018-02-24 08:00:34.578670000 +0700
>> +++ sys/net/if.c 2018-02-24 11:07:57.014318000 +0700
>> @@ -1699,7 +1699,7 @@ ifa_del_loopback_route(struct ifaddr *if
>> null_sdl.sdl_type = ifa->ifa_ifp->if_type;
>> null_sdl.sdl_index = ifa->ifa_ifp->if_index;
>> bzero(&info, sizeof(info));
>> - info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC;
>> + info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC | RTF_PINNED;
>> info.rti_info[RTAX_DST] = ia;
>> info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl;
>> error = rtrequest1_fib(RTM_DELETE, &info, NULL, ifa->ifa_ifp->if_fib);
>>
>
> This patch patch solves the problem for "ifconfig fxp0 delete": now the
> kernel removes the loopback route, tested on FreeBSD 10 r328260.
Glad to know that.
> But deleting the loopback route manually does not work anymore, is this
> intended behaviour ?
>
> I would like to control the routing table as much as possible.
This is side effect of loopback routes being intentionally protected with RTF_PINNED flag
in recent FreeBSD versions so that link routes can override ones installed by routing daemons.
Perhaps, ifconfig(8) utility should be extended to use RTF_PINNED to be able to modify such routes.
More information about the freebsd-net
mailing list