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;


_______________________________________________
freebsd-net@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to