Bug 803880

Summary: INET_rresolve() fails on 64bit, big-endian hosts
Product: Red Hat Enterprise Linux 6 Reporter: Kevin W. Rudd <solgato>
Component: net-toolsAssignee: Michal Ruprich <mruprich>
Status: CLOSED ERRATA QA Contact: Petr Sklenar <psklenar>
Severity: low Docs Contact:
Priority: low    
Version: 6.2CC: psklenar
Target Milestone: rcKeywords: FastFix, Patch
Target Release: ---   
Hardware: ppc64   
OS: Linux   
Whiteboard:
Fixed In Version: net-tools-1.60-112.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 09:25:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1373253    

Description Kevin W. Rudd 2012-03-15 19:42:35 UTC
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:

PTR? 0.0.0.0.in-addr.arpa.

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;

Comment 2 Jiri Popelka 2012-03-16 08:06:11 UTC
Thank you for the description and the patch !

Comment 4 RHEL Program Management 2012-09-07 05:01:26 UTC
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.

Comment 5 RHEL Program Management 2013-10-14 00:45:45 UTC
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.

Comment 14 errata-xmlrpc 2017-03-21 09:25:49 UTC
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://rhn.redhat.com/errata/RHBA-2017-0600.html