Fix regression for IPv6 loopback routes.
After nexthop introduction, loopback routes for the interface addresses were created without embedding actual interface index in the gateway. The latter is needed to pass the IPv6 scope during loopback transmission.
Fix the regression by actually using passed gateway data with interface index.
Before:
ping6 -c1 fe80::5054:ff:fe14:e319%vtnet0 PING6(56=40+8+8 bytes) fe80::1%lo0 --> fe80::5054:ff:fe14:e319%vtnet0 ping6: sendmsg: No route to host
Note loopback address is used in SAS.
Destination Gateway Flags Nhop# Mtu Netif Expire ::/96 ::1 UGRS 6 16384 lo0 default 2a01:4f8:13a:70c:ffff::1 UGS 7 1500 vtnet0 ::1 link#2 UH 1 16384 lo0 ::ffff:0.0.0.0/96 ::1 UGRS 6 16384 lo0 2001:db8:6666::fffd:1:327 link#2 UHS 1 16384 lo0 2001:db8:6666::fffd:1:4b8 link#2 UHS 1 16384 lo0 2a01:4f8:13a:70c:ffff::/96 link#1 U 5 1500 vtnet0 2a01:4f8:13a:70c:ffff::8 link#2 UHS 1 16384 lo0 fe80::/10 ::1 UGRS 6 16384 lo0 fe80::%vtnet0/64 link#1 U 4 1500 vtnet0 fe80::5054:ff:fe14:e319%vtnet0 link#2 UHS 1 16384 lo0 fe80::%lo0/64 link#2 U 3 16384 lo0 fe80::1%lo0 link#2 UHS 2 16384 lo0 fe80::80:4ff:fec3:b20a%3 link#2 UHS 1 16384 lo0 fe80::ae:7ff:fec7:ed0a%3 link#2 UHS 1 16384 lo0 ff02::/16 ::1 UGRS 6 16384 lo0
Note all interface addresses have nexthop *1* specified, which correspond to transmit via loopback AND using lo0 as all inteface addresses.
22:00 [0] m@devel2 netstat -6onW Nexthop data Internet6: Idx Type IFA Gateway Flags Use Mtu Netif Addrif Refcnt Prepend 1 v6/resolve ::1 lo0/resolve H 8 16384 lo0 7 2 v6/resolve fe80::1%lo0 lo0/resolve HS 0 16384 lo0 1 3 v6/resolve fe80::1%lo0 lo0/resolve 0 16384 lo0 1 4 v6/resolve fe80::5054:ff:fe14:e319%vtnet0 vtnet0/resolve 0 1500 vtnet0 1 5 v6/resolve 2a01:4f8:13a:70c:ffff::8 vtnet0/resolve 0 1500 vtnet0 1 6 v6/gw ::1 ::1 GRS 0 16384 lo0 4 7 v6/gw 2a01:4f8:13a:70c:ffff::8 2a01:4f8:13a:70c:ffff::1 GS 51950 1500 vtnet0 2
After:
ping6 fe80::5054:ff:fe42:fef%vtnet0 PING6(56=40+8+8 bytes) fe80::5054:ff:fe42:fef%vtnet0 --> fe80::5054:ff:fe42:fef%vtnet0 16 bytes from fe80::5054:ff:fe42:fef%vtnet0, icmp_seq=0 hlim=64 time=0.066 ms
netstat -6onW Nexthop data Internet6: Idx Type IFA Gateway Flags Use Mtu Netif Addrif Refcnt Prepend 1 v6/resolve ::1 lo0/resolve H 81933 16384 lo0 16398 2 v6/resolve fe80::1%lo0 lo0/resolve HS 0 16384 lo0 1 3 v6/resolve fe80::1%lo0 lo0/resolve 0 16384 lo0 1 4 v6/resolve ::1 lo0/resolve HS 0 16384 lo0 vtnet0 2 5 v6/resolve 2a01:4f8:13a:70c:ffff::6 vtnet0/resolve 0 1500 vtnet0 1 6 v6/resolve fe80::5054:ff:fe42:fef%vtnet0 vtnet0/resolve 0 1500 vtnet0 1 7 v6/gw ::1 ::1 GRS 0 16384 lo0 4 8 v6/gw 2a01:4f8:13a:70c:ffff::6 2a01:4f8:13a:70c:ffff::1 GS 10514 1500 vtnet0 6 9 v6/resolve ::1 lo0/resolve HS 0 16384 lo0 epair0a 2 10 v6/resolve fe80::30:18ff:fe4f:600a%epair0a epair0a/resolve 0 1500 epair0a 1 11 v6/resolve 2001:db8:6666::fff6:1:28aa epair0a/resolve 0 1500 epair0a 1
Note Addrif column is not empty anymore.