Bug 122038 - ping accepts wacky octal/hex in IP addresses
ping accepts wacky octal/hex in IP addresses
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: iputils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Radek Vokal
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2004-04-29 17:03 EDT by Steve Bonneville
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-11 06:39:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Steve Bonneville 2004-04-29 17:03:03 EDT
The ping utility accepts some wacky "numbers" as IP addresses.
Arguably, the following example might make a weird sort of sense:

[root@server1 /]# ping 0xc0a800fe
PING 0xc0a800fe ( 56(84) bytes of data.
64 bytes from icmp_seq=0 ttl=0 time=0.087 ms

as 0xC0A800FE is hex for  But should you really be able
to say this?

[root@server1 /]# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=0 ttl=0 time=0.078 ms

Or this?

[root@server1 /]# ping
PING ( 56(84) bytes of data.
         ^^^ ^^^          ^ ^

Or this?

[root@server1 /]# ping 192.168.011
PING 192.168.011 ( 56(84) bytes of data.

Version-Release number of selected component (if applicable):
Comment 1 Mike McLean 2004-04-29 18:00:45 EDT
This behavior lies in the inet_aton (glibc) function, not in the ping
utility.  Any utility that passes such strings directly to inet_aton
will exhibit this behavior (such as arping, nc, tcpdump, ftp,
wget,...). I personally don't consider this a bug.
Comment 2 Steve Bonneville 2004-04-30 01:03:50 EDT
Yes, now that you mention it, POSIX does say inet_aton() should accept
decimal, hex, or octal as any part of a dotted quad IPv4 address.  But
should ping do this?  This was originally brought to my attention by a
end user that was confused by this behavior (the last example above is
the one he showed me, typo for
Comment 3 Radek Vokal 2004-10-11 06:39:30 EDT
This is feature of many network tools, not only iputils but also
traceroute and other tools resolving ip adresses. I don't think it has
to be removed but I agree it should be more documented. 

Note You need to log in before you can comment on or make changes to this bug.