Bug 274483 - route(8) change -interface is not effective
Summary: route(8) change -interface is not effective
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.2-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-15 09:38 UTC by Dirk Meyer
Modified: 2024-04-29 14:35 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Meyer freebsd_committer freebsd_triage 2023-10-15 09:38:14 UTC
FreeBSD 13.2-RELEASE-p1 releng/13.2-n254621-08b87f63a046 GENERIC amd64


Setup:
I route a public IP-network via gre tunnel.

For diagnostic reasons I switched routing over a second tunnel,
this failed to work.


Diagnostics:

# route get 192.0.2.128/25
   route to: 192.0.2.128
destination: 192.0.2.128
       mask: 255.255.255.128
        fib: 0
  interface: gre1
      flags: <UP,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1476         1         0


# route change 192.0.2.128/25 -interface gre2
change net 192.0.2.128: gateway gre2 fib 0


# route get 192.0.2.128/25
   route to: 192.0.2.128
destination: 192.0.2.128
       mask: 255.255.255.128
        fib: 0
  interface: gre1
      flags: <UP,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1476         1         0


Note this still shows "gre1" not "gre2"
The effective route is not changed as the output of route told above.


Workaround:

# route del 192.0.2.128/25
del net 192.0.2.128 fib 0
# route add 192.0.2.128/25 -interface gre2
add net 192.0.2.128: gateway gre2 fib 0

# route get 192.0.2.128/25
   route to: 192.0.2.128
destination: 192.0.2.128
       mask: 255.255.255.128
        fib: 0
  interface: gre2
      flags: <UP,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1476         1         0
Comment 1 Graham Perrin 2023-10-15 10:02:14 UTC
^Triage (hat on): 

* status
* assignee, probably net@
* avoid [tags] in summary lines

<https://wiki.freebsd.org/Bugzilla/DosAndDonts#tags> (please, do not …)

----

Hat off: I'll follow this report with interest.

<https://man.freebsd.org/cgi/man.cgi?query=route&sektion=8&manpath=freebsd-release>
Comment 2 Mike Karels freebsd_committer freebsd_triage 2024-04-29 14:35:03 UTC
Note, I don't think -interface is the keyword that you want here; it means that no gateway is used.  From route(8): "If the destination is directly reachable via an interface requiring no intermediary system to act as a gateway, the -interface modifier should be specified; the gateway given is the address of this host on the common network, indicating the interface to be used for transmission.  Alternately, if the interface is point to point the name of the interface itself may be given,"  In this case, the tunnel ignores the first-hop destination address, so this works by accident.  The -ifp modifier is intended for this usage, but is currently broken.