Hi! I have a router that nearly simultaneously creates two netgraph-based PPP VPN tunnels (ng_iface ngX) to the same remote router and establishes OSPF neighbourship over each tunnel to announce and receive some prefixes. It repeatedly falls to the same problem. Here is a scenario: 1. First PPP tunnel is created by first router and addresses are assigned: 192.168.71.9 for itself and 192.168.71.10 for second router. Addresses then accepted and successfully assigned by second router. 2. Second PPP tunnel is created and again, first router assignes addresses 192.168.71.13 for itself and 192.168.71.14 for part of the tunnel. First router announces 192.168.71.14/32 using OSPF over first tunnel and second router's ospfd process installs this route to the kernel using 192.168.71.9 as gateway: got message of size 184 on Fri Oct 20 14:54:15 2017 RTM_ADD: Add Route: len 184, pid: 90850, seq 44, errno 0, flags:<UP,GATEWAY,HOST,DONE,PROTO1> locks: inits: sockaddrs: <DST,GATEWAY> 192.168.71.14 192.168.71.9 3. Second router'd PPP daemon attempts to assign negotiated addresses 192.168.71.14 and 192.168.71.13 to the second ng_iface being configured with ioctl(SIOCAIFADDR): got message of size 164 on Fri Oct 20 16:04:59 2017 RTM_NEWADDR: address being added to iface: len 164, metric 0, flags: sockaddrs: <NETMASK,IFP,IFA,BRD> ng2 192.168.71.14 192.168.71.13 got message of size 224 on Fri Oct 20 16:04:59 2017 RTM_ADD: Add Route: len 224, pid: 0, seq 0, errno 0, flags:<UP,HOST,PINNED> locks: inits: sockaddrs: <DST,GATEWAY> 192.168.71.13 link#9 But kernel returns an error EEXIST (17) and writes to the log: kernel: ifa_maintain_loopback_route: insertion failed for interface ng2: 17 The kernel should allow PPP daemon (net/mpd5 in this case) to override dynamic route with PINNED address assignment.
Created attachment 187334 [details] proposed fix
Proposed one-line patch fixes the problem for me.
A commit references this bug: Author: eugen Date: Sun Nov 5 14:41:49 UTC 2017 New revision: 325436 URL: https://svnweb.freebsd.org/changeset/base/325436 Log: Allow a process to assign an IP address to local ppp interface even if kernel routing table already has a route to the address in question installed by some routing daemon (PR 223129). Also, allow loopback route deletion when stopping a VIMAGE jail (PR 222647). PR: 222647, 223129 Reviewed by: gnn Approved by: avg (mentor), mav (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12747 Changes: head/sys/net/if.c
A commit references this bug: Author: eugen Date: Mon Nov 20 09:23:09 UTC 2017 New revision: 326011 URL: https://svnweb.freebsd.org/changeset/base/326011 Log: MFC r325436: RTF_PINNED for an interface Allow a process to assign an IP address to local ppp interface even if kernel routing table already has a route to the address in question installed by some routing daemon (PR 223129). Also, allow loopback route deletion when stopping a VIMAGE jail (PR 222647). PR: 222647, 223129 Reviewed by: gnn Approved by: mav (mentor) Differential Revision: https://reviews.freebsd.org/D12747 Changes: _U stable/11/ stable/11/sys/net/if.c
A commit references this bug: Author: eugen Date: Mon Nov 20 09:24:02 UTC 2017 New revision: 326012 URL: https://svnweb.freebsd.org/changeset/base/326012 Log: MFC r325436: RTF_PINNED for an interface Allow a process to assign an IP address to local ppp interface even if kernel routing table already has a route to the address in question installed by some routing daemon (PR 223129). Also, allow loopback route deletion when stopping a VIMAGE jail (PR 222647). PR: 222647, 223129 Reviewed by: gnn Approved by: mav (mentor) Differential Revision: https://reviews.freebsd.org/D12747 Changes: _U stable/10/ stable/10/sys/net/if.c
Fixed with r325436 and MFC r326011, r326012.