Closed Bug 650474 Opened 9 years ago Closed 9 years ago

AIX5 Firefox 3.6.17 or Thunderbird 3.1.10 cannot resolve hostnames

Categories

(NSPR :: NSPR, defect, P1)

4.8.7
PowerPC
AIX
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ul-mcamafia, Assigned: wtc)

References

Details

(Keywords: regression)

Attachments

(2 files, 3 obsolete files)

During testing of the release candidate source both Firefox 3.5.19, 3.6.17 and Thunderbird 3.1.10 won't connect to any host by name. Connecting by ipaddress works.
Firefox 3.5.19 built on AIX 4.3.3 seems to work so far.
Building on AIX 5.1 results in a 100% reproducable failure. 

I suspect the changes in prnetdb.c from NSPR 4.8.6 to NSPR 4.8.7
Blocks: 618660
This tiny patch makes NSPR 4.8.7 resolve hostnames when compiled only AIX 5.1
Regression of bug# 614526
Blocks: 614526
Keywords: regression
The patch is not needed on AIX 5.3TL11 and later. 
Therefore changing importance from major to normal.
Severity: major → normal
Uli: please find out what getaddrinfo() returns if AI_ADDRCONFIG is specified.
If getaddrinfo() returns EAI_BADFLAGS, then we can remove AI_ADDRCONFIG
from hints.ai_flags and call getaddrinfo() again.  Here is the patch:


Index: prnetdb.c
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/src/misc/prnetdb.c,v
retrieving revision 3.64
diff -u -r3.64 prnetdb.c
--- prnetdb.c	28 Jan 2011 22:59:04 -0000	3.64
+++ prnetdb.c	20 Apr 2011 01:35:51 -0000
@@ -2077,6 +2077,12 @@
         hints.ai_socktype = SOCK_STREAM;
 
         rv = GETADDRINFO(hostname, NULL, &hints, &res);
+#ifdef AI_ADDRCONFIG
+        if (rv == EAI_BADFLAGS) {
+            hints.ai_flags &= ~AI_ADDRCONFIG;
+            rv = GETADDRINFO(hostname, NULL, &hints, &res);
+        }
+#endif
         if (rv == 0)
             return (PRAddrInfo *) res;
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → 4.8.8
(In reply to comment #4)
> Uli: please find out what getaddrinfo() returns if AI_ADDRCONFIG is specified.
> If getaddrinfo() returns EAI_BADFLAGS, then we can remove AI_ADDRCONFIG
> from hints.ai_flags and call getaddrinfo() again.  Here is the patch:
> 
> 
> Index: prnetdb.c
> ===================================================================
> RCS file: /cvsroot/mozilla/nsprpub/pr/src/misc/prnetdb.c,v
> retrieving revision 3.64
> diff -u -r3.64 prnetdb.c
> --- prnetdb.c    28 Jan 2011 22:59:04 -0000    3.64
> +++ prnetdb.c    20 Apr 2011 01:35:51 -0000
> @@ -2077,6 +2077,12 @@
>          hints.ai_socktype = SOCK_STREAM;
> 
>          rv = GETADDRINFO(hostname, NULL, &hints, &res);
> +#ifdef AI_ADDRCONFIG
> +        if (rv == EAI_BADFLAGS) {
> +            hints.ai_flags &= ~AI_ADDRCONFIG;
> +            rv = GETADDRINFO(hostname, NULL, &hints, &res);
> +        }
> +#endif
>          if (rv == 0)
>              return (PRAddrInfo *) res;

wtc:
I have applied your patch against 4.8.7 tarball and it works.

The patched version test "getai" results: "PR_GetAddrInfoByName failed: (-5973, 7)"

Test results on AIX 5.1ML9 with IBM C/C++
The gethost test results:
h_name: mcom.com
h_addrtype: 2
h_length: 4
h_addr_list[0]: 205.188.98.215
reverse lookup
h_name: affinity-vd02.evip.aol.com
h_addrtype: 2
h_length: 4
h_addr_list[0]: 205.188.98.215
PR_GetIPNodeByName with PR_AF_INET
h_name: mcom.com
h_addrtype: 2
h_length: 4
h_addr_list[0]: 205.188.98.215
PR_GetIPNodeByName with PR_AF_INET6
h_name: mcom.com
h_addrtype: 24
h_length: 16
h_addr_list[0]: 0.0.0.0.0.0.0.0.0.0.255.255.205.188.98.215
PR_GetHostByAddr with PR_AF_INET6
reverse lookup
h_name: affinity-vd02.evip.aol.com
h_addrtype: 2
h_length: 4
h_addr_list[0]: 205.188.98.215
PR_GetHostByAddr with PR_AF_INET6 done
IPv4 INADDRANY: 0.0.0.0
IPv4 LOOPBACK: 127.0.0.1
IPv6 INADDRANY: ::
IPv6 LOOPBACK: ::1
IPv4-mapped IPv6 LOOPBACK: ::ffff:127.0.0.1
PASS
Attachment #526482 - Attachment is obsolete: true
Attachment #527744 - Flags: review?
Attachment #527744 - Flags: review? → review?(wtc)
Comment on attachment 527744 [details] [diff] [review]
Fixed according to wtc's comment

r=wtc.

Patch checked in (without the two blank lines) on the NSPR trunk.

Checking in prnetdb.c;
/cvsroot/mozilla/nsprpub/pr/src/misc/prnetdb.c,v  <--  prnetdb.c
new revision: 3.65; previous revision: 3.64
done
Attachment #527744 - Flags: review?(wtc) → review+
We can improve the patch by testing if AI_ADDRCONFIG is set:

        if (rv == EAI_BADFLAGS && (hints.ai_flags & AI_ADDRCONFIG)) {
Target Milestone: 4.8.8 → 4.8.9
Tested on AIX 5.1ML9 32bit and not to break anything on MacOSX 10.5.8 PowerPC,
removed #ifdef AI_ADDRCONFIG replaced by runtime test.
Attachment #530601 - Flags: review?(wtc)
Comment on attachment 530601 [details] [diff] [review]
refined patch according to comment# 8

r=wtc.

I copied the #ifdef AI_ADDRCONFIG from elsewhere:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/nsprpub/pr/src/misc/prnetdb.c&rev=3.65&mark=2044#2044

Now that I looked at the code, I don't understand why I used #ifdef AI_ADDRCONFIG
there.  I think that #ifdef AI_ADDRCONFIG should also be removed.
Attachment #530601 - Flags: review?(wtc) → review+
trunk with the patch passed all tests on AIX 5.1 and AIX 4.3.3
removed the #ifdef / #endif
Attachment #530601 - Attachment is obsolete: true
Attachment #530763 - Flags: review?(wtc)
trunk with patch attachment# 530763 [details] [diff] [review] passed all tests but dtoa on AIX 5.2TL10

Output from ./dtoa:
bash-3.2$ ./dtoa
Failed to convert numeric value 0.000000 8e-14
Failed to convert numeric value -0.000000 -2e-73
FAILED
bash-3.2$ 
This is unrelated to *this* bug.
Same test failure on AIX 5.3TL11 both 32- and 64bit.
dtoa passes on AIX 5.1 and earlier (where the libc misses some newer C99 library functions compared to AIX 5.2 and later).
Comment on attachment 527744 [details] [diff] [review]
Fixed according to wtc's comment

I pushed this patch to mozilla-central:
http://hg.mozilla.org/mozilla-central/rev/6e1f4652252d
Comment on attachment 530763 [details] [diff] [review]
refined patch according to comment# 8 and comment# 10

I looked into why #ifdef AI_ADDRCONFIG was added.

It wasn't in the very first patch in bug 614526 (see bug 614526 comment 15).
But Nelson Bolyard suggested it in the next comment (bug 614526 comment 16)
without explaining why.

AI_ADDRCONFIG was not in Windows XP, so #ifdef AI_ADDRCONFIG would allow
us to compile against an old Windows Platform SDK.  But I doubt that's why
Nelson suggested it.

I suggest that we remove #ifdef AI_ADDRCONFIG separately to reduce the risk.
This is the patch I checked in in rev. 3.66 of
mozilla/nsprpub/pr/src/misc/prnetdb.c.
Attachment #530763 - Attachment is obsolete: true
Attachment #530763 - Flags: review?(wtc)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Summary: AIX5 Firefox 3.6.17 or Thunderbird 3.1.10 cannot resolv hostnames → AIX5 Firefox 3.6.17 or Thunderbird 3.1.10 cannot resolve hostnames
You need to log in before you can comment on or make changes to this bug.