Red Hat Bugzilla – Bug 803880
INET_rresolve() fails on 64bit, big-endian hosts
Last modified: 2017-03-21 05:25:49 EDT
net-tool utilities that use INET_rresolve() (like netstat) will
fail to resolve hostnames from the IP addresses on big-endian hosts
(e.g. ppc64, s390x). The DNS query that is sent out ends up being:
This is because "ad" and "host_ad" are being incorrectly set to "unsigned
long". sin->sin_addr.s_addr and the return from ntohl() are uint32_t.
On 64bit, big-endian architectures, the gethostbyaddr() call is looking
at the upper 4 bytes (which are zero in this situation).
The following change resolves (pardon the pun) this issue:
--- net-tools-1.60.orig/lib/inet.c 2012-03-15 12:16:04.403849459 -0700
+++ net-tools-1.60/lib/inet.c 2012-03-15 12:18:46.503205339 -0700
@@ -144,7 +144,7 @@
struct hostent *ent;
struct netent *np;
struct addr *pn;
- unsigned long ad, host_ad;
+ uint32_t ad, host_ad;
int host = 0;
Thank you for the description and the patch !
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.
Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
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.