ping6 doesn't handle IPv6 addresses well

Bug #1775891 reported by psl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
iputils (Ubuntu)
New
Undecided
Unassigned

Bug Description

ping6 utility, iputils-s20121221, Ubuntu 16.04.4 amd64

IPv6 address can have extension with local interface. It is required to ping link-level IPv6 addresses (fe80::/10).

Example,

ping6 fails, OS doesn't know where to route packets

user@test$ ping6 -c1 fe80::87f4:81fa:b481:d781
connect: Invalid argument

network interface is specified, ping6 works:

user@test$ ping6 -c1 fe80::87f4:81fa:b481:d781%enp4s0
PING fe80::87f4:81fa:b481:d781%enp4s0(fe80::87f4:81fa:b481:d781) 56 data bytes
64 bytes from fe80::87f4:81fa:b481:d781: icmp_seq=1 ttl=64 time=0.461 ms

--- fe80::87f4:81fa:b481:d781%enp4s0 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.461/0.461/0.461/0.000 ms

Ping loopback, it works

user@test$ ping6 -c1 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.039 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.039/0.039/0.039/0.000 ms

But when I add %lo, ping6 cannot handle it.... This is the issue I want to report.

user@test$ ping6 -c1 ::1%lo
unknown host

Other example with real IPv6 address

user@test$ ping6 -c1 2001:470:6e:66::2
PING 2001:470:6e:66::2(2001:470:6e:66::2) 56 data bytes
64 bytes from 2001:470:6e:66::2: icmp_seq=1 ttl=64 time=0.054 ms

--- 2001:470:6e:66::2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.054/0.054/0.054/0.000 ms

user@test$ ping6 -c1 2001:470:6e:66::2%sit1
unknown host

BTW, CURL can do it...

user@test$ curl http://[::1%lo]/test.htm
<html><body>TEST</body></html>

user@test$ curl http://[2001:470:6e:66::2%sit1]/test.html
curl: (7) Failed to connect to 2001:470:6e:66::2 port 80: Connection refused

Yes, curl fails in this case but there is no http server configured at that IPv6 address... Important point is it tries to connect. Here is a proof:

user@test$ curl http://[2001:470:6e:66::2%sit1]:22/test.html
SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
Protocol mismatch.
curl: (56) Recv failure: Connection reset by peer

Here is a reference to RFC
https://tools.ietf.org/html/rfc4007

psl (slansky)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.