[Bug 278654] The -ifa modifier to route(8) is ineffective

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 29 Apr 2024 17:29:29 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278654

            Bug ID: 278654
           Summary: The -ifa modifier to route(8) is ineffective
           Product: Base System
           Version: 14.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: karels@freebsd.org

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.

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