Bug 278654 - The -ifa modifier to route(8) is ineffective
Summary: The -ifa modifier to route(8) is ineffective
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 14.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-29 17:29 UTC by Mike Karels
Modified: 2024-04-29 17:48 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 Mike Karels freebsd_committer freebsd_triage 2024-04-29 17:29:29 UTC
In 14.0 and -current as of this bug report, the -ifa modifier to route(8) has no effect.  For example, if 10.0.3.99 is an alias on vtnet0 or lo0, and a route is added via vtnet0 with -ifa 10.0.3.99, ping to that destination uses the primary address on vtnet0 as source. route get shows no indication of the ifa address.  ping -S 10.0.3.99 works as expected.

Details (this example from -current):

vmguest1# ifconfig lo0 alias 10.0.3.99/32
vmguest1# netstat -rnf inet
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            10.0.3.254         UGS      vtnet0
10.0.3.0/24        link#1             U        vtnet0
10.0.3.1           link#2             UHS         lo0
10.0.3.99          link#2             UH          lo0
127.0.0.1          link#2             UH          lo0
vmguest1# route add freebsd-test -ifa 10.0.3.99 -ifp 10.0.3.1 10.0.3.254
add host freebsd-test: gateway 10.0.3.254
vmguest1# route -n get freebsd-test
   route to: 10.0.2.21
destination: 10.0.2.21
    gateway: 10.0.3.254
        fib: 0
  interface: vtnet0
      flags: <UP,GATEWAY,HOST,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0
vmguest1# route delete freebsd-test
delete host freebsd-test
vmguest1# route add freebsd-test -ifa 10.0.3.99 -ifp 10.0.3.1 10.0.3.254
add host freebsd-test: gateway 10.0.3.254
vmguest1# route -nv get freebsd-test
   route to: 10.0.2.21
destination: 10.0.2.21
    gateway: 10.0.3.254
        fib: 0
  interface: vtnet0
      flags: <UP,GATEWAY,HOST,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0

ping 10.0.2.21 then uses a source address of 10.0.3.1.  The result is the same if the alias is placed on vtnet0.