Possible culprit might be the pr_icmph function in ping.c, lines 1250 -
1259:

                {
                        struct sockaddr_in sin = {
                                .sin_family = AF_INET,
                                .sin_addr =  {
                                        icp ? icp->un.gateway : info
                                }
                        };

                        printf(_("(New nexthop: %s)\n"), pr_addr(&sin, sizeof 
sin));
                }

Are you sure the variables used for .sin_addr input are guaranteed to be
in network byte order?

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to iputils in Ubuntu.
https://bugs.launchpad.net/bugs/1892108

Title:
  ping prints ip address octets backwards on host redirect

Status in iputils package in Ubuntu:
  New

Bug description:
  Description:  Ubuntu 20.04.1 LTS
  Release:      20.04

  Just noticed a weird thing with ping on Ubuntu 20.04, which I recently
  updated to.

  This is what I get when pinging a host on my network:

  user@ubuntu2004:~$ ping 10.156.0.63
  PING 10.156.0.63 (10.156.0.63) 56(84) bytes of data.
  From 10.15.0.1 icmp_seq=2 Redirect Host(New nexthop: 2.0.15.10)

  The ubuntu2004 machine is located in the 10.15.0.x network.
  10.15.0.1 is a DSL router.
  10.15.0.2 is a firewall between multiple networks.
  10.156.0.63 is a machine on a different local network.

  All traffic not destined for the internet is routed from 10.15.0.1 to
  10.15.0.2, so I would expect the printout to read "New nexthop:
  10.15.0.2".

  However, as you can see this is not the case. Instead the octets are
  printed in reverse order.

  To verify this I tried the same on another machine in the same
  network, running Ubuntu 18.04:

  user@ubuntu1804:~$ ping 10.156.0.63
  PING 10.156.0.63 (10.156.0.63) 56(84) bytes of data.
  From 10.15.0.1: icmp_seq=2 Redirect Host(New nexthop: 10.15.0.2)

  As you can see, the printout is correct here: "New nexthop: 10.15.0.2"

  I further verified the discrepancy by using tcpdump to interpret the
  ICMP packets on the ubuntu2004 machine, and there seems to be no
  problem for tcpdump to display the correct IP address.

  My assumption is that there is something wrong in the print function
  which displays the IP address for a host redirect.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/iputils/+bug/1892108/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to