[Bug 273640] route delete fails when specifying both -inet and -iface

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 09 Sep 2023 10:26:38 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273640

--- Comment #4 from Zhenlei Huang <zlei@FreeBSD.org> ---
(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
```

-- 
You are receiving this mail because:
You are the assignee for the bug.