ping: When IPv6-in-IPv4 tunnel interface is specified as a source, link local IPv6 address is used
Username: ashway83
Origin: https://bugs.openwrt.org/index.php?do=details&task_id=2474
Environment:
OpenWrt 18.06.4 r7808-ef686b72 / LuCI openwrt-18.06 branch (git-19.170.32094-4d6d8bc)
Description:
When IPv6-in-IPv4 tunnel interface is specified as a source interface, link local IPv6 address is used instead of a public IPv6 address.
root@OpenWRT:~# ifconfig 6in4-wan6 Link encap:IPv6-in-IPv4 inet6 addr: fe80::xxxx:xxxx/64 Scope:Link inet6 addr: 2001:xxx:xx:xxx::2/64 Scope:Global UP POINTOPOINT RUNNING NOARP MTU:1280 Metric:1 RX packets:2551 errors:0 dropped:0 overruns:0 frame:0 TX packets:3885 errors:0 dropped:689 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:217476 (212.3 KiB) TX bytes:525551 (513.2 KiB)
ICMP request are sent with a link local address set as a source:
root@OpenWRT:~# ping -I 6in4-wan6 -c 3 2001:4860:4860::8888 PING 2001:4860:4860::8888 (2001:4860:4860::8888): 56 data bytes
--- 2001:4860:4860::8888 ping statistics --- 3 packets transmitted, 0 packets received, 100% packet loss
Expected behavior (public IPv6 address is used as a source address):
root@OpenWRT:~# ping -I 2001:xxx:xx:xxx::2 -c 3 2001:4860:4860::8888 PING 2001:4860:4860::8888 (2001:4860:4860::8888) from 2001:470:70:46b::2: 56 data bytes 64 bytes from 2001:4860:4860::8888: seq=0 ttl=58 time=15.708 ms 64 bytes from 2001:4860:4860::8888: seq=1 ttl=58 time=17.387 ms 64 bytes from 2001:4860:4860::8888: seq=2 ttl=58 time=15.723 ms
--- 2001:4860:4860::8888 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 15.708/16.272/17.387 ms