route(8) fails to delete routes when the interface is specified. Example route: # route show -inet default route to: default destination: default mask: default gateway: 10.0.5.1 fib: 0 interface: vmx0 flags: <UP,GATEWAY,DONE,STATIC> recvpipe sendpipe ssthresh rtt,msec mtu weight expire 0 0 0 0 1500 0 0 On FreeBSD 12.3-STABLE: # route del -inet default -iface vmx0 del net default: gateway vmx0 On FreeBSD 14.0-CURRENT: # route del -inet default -iface vmx0 route: route has not been found del net default: gateway vmx0 fib 0: not in table
is this with or without netlink?
In the 12.3 test, without netlink; in the 14.0 test, with netlink. Further tests indicate that it's only an issue with combining both "-inet" and "-iface" (IPv6 works), and only when the CIDR size is omitted. This works: # route del -inet 192.168.1.0/24 -iface vmx0
i seem to have figured most of that out, too, when writing this code https://github.com/canonical/cloud-init/blob/main/cloudinit/net/netops/bsd_netops.py#L35 (contrast the Linux Code here, it's based on: https://github.com/canonical/cloud-init/blob/main/cloudinit/net/netops/iproute2.py#L51 )
(In reply to mmendoza from comment #0) > Example route: > # route show -inet default > route to: default > destination: default > mask: default > gateway: 10.0.5.1 > fib: 0 > interface: vmx0 > flags: <UP,GATEWAY,DONE,STATIC> > recvpipe sendpipe ssthresh rtt,msec mtu weight expire 0 0 0 0 1500 0 0 Option `-iface` of route(8) is for directly connected route. In the above example, the `default` or `0.0.0.0/0` is not directly connected. It does not make sense if you try to delete it with option `-iface`. (In reply to mmendoza from comment #2) > Further tests indicate that it's only an issue with combining both "-inet" and > "-iface" (IPv6 works), and only when the CIDR size is omitted. This works: > # route del -inet 192.168.1.0/24 -iface vmx0 I bet your route `192.168.1.0/24` is directly connected. It may looks like: ``` route to: 192.168.1.0 destination: 192.168.1.0 mask: 255.255.255.0 fib: 0 interface: vmx0 flags: <UP,DONE,PINNED> recvpipe sendpipe ssthresh rtt,msec mtu weight expire 0 0 0 0 1500 1 0 ```
It fails either way.
(In reply to mmendoza from comment #5) Can you share your route table ?
(In reply to Zhenlei Huang from comment #6) The test was on a system with a single interface where "10.0.5.1" is the connected network and "192.168.1.0/24" is a manually-added static route. I can recreate the test and pull the output if needed.
Closing this as fixed - I am not able to reproduce it on more recent 14.0-ALPHA builds. For reference, it seems to have been fixed between src commits 680ad06f and b23dbabb.