loopback routes pinned by commit r326012 for FreeBSD 10 cannot be deleted
Eugene Grosbein
eugen at grosbein.net
Sat Feb 24 13:22:18 UTC 2018
24.02.2018 20:04, Eugene Grosbein wrote:
>> 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.
I mean, route(8). Please try this patch that restores its ability to manually remove such routes.
Index: sbin/route/route.c
===================================================================
--- sbin/route/route.c (revision 329903)
+++ sbin/route/route.c (working copy)
@@ -1535,8 +1535,10 @@ rtmsg(int cmd, int flags, int fib)
so[RTAX_IFP].ss_len = sizeof(struct sockaddr_dl);
rtm_addrs |= RTA_IFP;
}
- } else
+ } else {
cmd = RTM_DELETE;
+ flags |= RTF_PINNED;
+ }
#define rtm m_rtmsg.m_rtm
rtm.rtm_type = cmd;
rtm.rtm_flags = flags;
More information about the freebsd-net
mailing list