Red Hat Bugzilla – Bug 1362388
IPv4 vs IPv6 inconsistency on return value of ping
Last modified: 2017-08-01 16:47:16 EDT
Description of problem: the return value of ping for ipv4 and ipv6 isn't the same Version-Release number of selected component (if applicable): ping utility, iputils-s20160308 3.10.0-481.el7.x86_64 How reproducible: Always Steps to Reproduce: 1. add unreachable route for ipv4 2. ping unreachable dst 3. add unreachable route for ipv6 4. ping6 unreachable dst Actual results: return value in 2 is 2 return value in 4 is 1 Expected results: the return value should be the same 2 Additional info: [root@ibm-x3250m5-01 route_type]# uname -a Linux ibm-x3250m5-01.rhts.eng.pek2.redhat.com 3.10.0-481.el7.x86_64 #1 SMP Wed Jul 27 18:24:27 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux [root@ibm-x3250m5-01 route_type]# ping6 -V ping utility, iputils-s20160308 [root@ibm-x3250m5-01 route_type]# ip route add unreachable 2000::/64 [root@ibm-x3250m5-01 route_type]# ping6 2000::1 -c 1 PING 2000::1(2000::1) 56 data bytes ping: sendmsg: No route to host --- 2000::1 ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms [root@ibm-x3250m5-01 route_type]# echo $? 1 <======1 here [root@ibm-x3250m5-01 route_type]# ping 192.168.0.1 -c 1 connect: No route to host [root@ibm-x3250m5-01 route_type]# echo $? 2 <========2 here When use ping on rhel7.2GA whose version is iputils-s20121221,the return value is 2: [root@dhcp-13-64 ~]# uname -a Linux dhcp-13-64.nay.redhat.com 3.10.0-481.el7.x86_64 #1 SMP Wed Jul 27 18:24:27 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux [root@dhcp-13-64 ~]# ping -V ping utility, iputils-s20121221 [root@dhcp-13-64 ~]# ping6 2000::1 -c 1 connect: No route to host [root@dhcp-13-64 ~]# echo $? 2
https://github.com/iputils/iputils/issues/57
I'm getting "connect: Network is unreachable" in both cases and the return value is 2. Please specify *exactly* how you set up the network in both cases.
It seems to be caused by unification of the ping/ping6 code, i.e. the following upstream commit: https://github.com/iputils/iputils/commit/ebad35fee3de851b809c7b72ccc654a72b6af61d Before this commit it returned exit code 2 immediately, after this commit it returns exit code 1 after some timeout.
(In reply to Jan Synacek from comment #2) > I'm getting "connect: Network is unreachable" in both cases and the return > value is 2. Please specify *exactly* how you set up the network in both > cases. Hi Jan, No special set up, just as the steps in the Description: Boot up the system, then add unreachable route. ip route add unreachable 2000::/64 ping6 2000::1 -c 1 Do you use the same iputils as mine:iputils-s20160308?
I can reproduce this now... My machine was probably not set up properly.
https://github.com/iputils/iputils/pull/58
duplicate bug 1387317
Likely. I will verify that.
Oops, sorry, wrong bug.
*** Bug 1387317 has been marked as a duplicate of this bug. ***
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2017:1987