Re: ping -6 ignores -e parameter

From: Kubilay Kocak <koobs_at_FreeBSD.org>
Date: Sat, 18 Dec 2021 01:16:36 UTC
On 16/12/2021 9:30 pm, KOT MATPOCKuH wrote:
> Hello, Alan!
> 
> I'm sorry, I'm forget to add freebsd-stable@ to CC: list.
> 
> Yes, I'm using FreeBSD 13:
> 13.0-STABLE
> 
> Today I have a native IPv6 access and my inet6 routing table is:
> # netstat -rn6 | grep -v -e lo0
> Routing tables
> 
> Internet6:
> Destination                       Gateway                       Flags   
> Netif Expire
> default                           fe80::206:29ff:fee9:32a9%lan0 UG    lan0
> fd00:dead:beef:100::/64           link#5                        U    lan0
> fe80::%lan0/64                    link#5                        U    lan0
> fe80::%bridge0/64                 link#6                        U bridge0
> 
> This means my default gateway is reachable via lan0.
> A node which link-local address fe80::2a0:98ff:fe1d:e270 is reachable 
> via bridge0:
> # ping -c 1 fe80::2a0:98ff:fe1d:e270%bridge0
> PING6(56=40+8+8 bytes) fe80::5a9c:fcff:fe10:ff9e%bridge0 --> 
> fe80::2a0:98ff:fe1d:e270%bridge0
> 16 bytes from fe80::2a0:98ff:fe1d:e270%bridge0, icmp_seq=0 hlim=64 
> time=0.804 ms
> 
> But ping anyway sends packets via lan0.
> Also I tried to configure fd13:dead:beef::2 on bridge0, on corresponding 
> node I configured fd13:dead:beef::1, and then run a command:
> ping -6 -e fd13:dead:beef::1 google.com
> 
> In this way ping uses source IP address from bridge0 interface, but 
> sends via lan0 and to next-hop fe80::206:29ff:fee9:32a9%lan0:
> # tcpdump -epni lan0 icmp6
> 12:33:23.308763 8c:ec:4b:e9:28:23 > 00:06:29:e9:32:a9, ethertype IPv6 
> (0x86dd), length 70: fd13:dead:beef::2 > 2a00:1450:4010:c1e::8a: ICMP6, 
> echo request, seq 52, length 16
> 
> I'm wrote a simple script to check this problem. I checked this script 
> on image of VM from freebsd'site which FreeBSD-13.
> Please see attached file.
> 
> On 15/12/2021 21:32, Alan Somers wrote:
>> On Wed, Dec 15, 2021 at 11:16 AM KOT MATPOCKuH <matpockuh@gmail.com> 
>> wrote:
>>>
>>> Hello!
>>>
>>> In a man page for ping(8) and in it's help output I found option "-e":
>>>       -e gateway
>>>               Specifies to use gateway as the next hop to the 
>>> destination.  The
>>>               gateway must be a neighbor of the sending node.
>>>
>>> I tried to use this argument, ping ignores this parameter and sends 
>>> the packet via default gateway.
>>> For example I have a tun0 which has ipv6 default gw, and an 
>>> established bridge0 which has available some LL addresses:
>>> Neighbor                             Linklayer Address  Netif 
>>> Expire    S Flags
>>> fe80::2a0:98ff:fe1d:e270%bridge0     00:a0:98:1d:e2:70 bridge0 
>>> 23h56m34s S R
>>>
>>> I tried to run:
>>> ping -6 -e FE80::2A0:98FF:FE1D:E270%bridge0 google.com
>>> But the packet was sent via tun0 interface.
>>>
>>> What is wrong with it?
>>>
>>> -- 
>>> MATPOCKuH
>>
>> What version of FreeBSD are you using?  There was a major change to
>> ping's code in FreeBSD 13.  Please show the output of
>> 'freebsd-version' and 'netstat -rn'.
>> -Alan
>>
> 

Potentially relevant issue issue who's stable/13 merge landed 2021-12-13:

   https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258048

Is your uname -a version prior to or after this date?

If after, can you test reverting this revision?