Closed Bug 587426 Opened 10 years ago Closed 9 years ago

HP-UX without IPv6 support is broken

Categories

(NSPR :: NSPR, defect, P2, minor)

HP
HP-UX

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ul-mcamafia, Assigned: wtc)

References

Details

Attachments

(1 file, 1 obsolete file)

When build any recent version of NSPR on HP-UX B.11.00 or B.11.11 without IPv6 add-on I get the following error:

cc -Ae -Ae -o prnetdb.o -c      +DAportable +Olit=all -O +Z  -UDEBUG  -DMOZILLA_CLIENT=1 -DNDEBUG=1 -DXP_UNIX=1 -DHPUX=1 -D_HPUX_SOURCE=1 -D_PR_POLL_WITH_SELECT=1 -D_USE_BIG_FDS=1 -Dhppa=1 -DHAVE_POINTER_LOCALTIME_R=1 -DHPUX10=1 -DHPUX11=1 -D_LARGEFILE64_SOURCE=1 -D_PR_HAVE_OFF64_T=1 -DHAVE_FCNTL_FILE_LOCKING=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -D_POSIX_C_SOURCE=199506L -D_PR_HAVE_THREADSAFE_GETHOST=1  -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -D_NSPR_BUILD_ -I/home/ulink/ffbuild/mozilla/obj-hppa1.1-hp-hpux11.00/dist/include/nspr -I/home/ulink/ffbuild/mozilla/nsprpub/pr/include -I/home/ulink/ffbuild/mozilla/nsprpub/pr/include/private  /home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 533: error 1588: "AF_INET6" undefined.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 533: error 1563: Expression in if must be scalar.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 862: error 1588: "AI_V4MAPPED" undefined.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 864: error 1588: "AI_ADDRCONFIG" undefined.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 866: error 1588: "AI_ALL" undefined.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 868: error 1588: "AF_INET6" undefined.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 1029: error 1588: "AF_INET6" undefined.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 1049: error 1588: "AF_INET6" undefined.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 1049: error 1563: Expression in if must be scalar.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2096: error 1574: Unknown size for "hints".
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2105: error 1594: The sizeof operator cannot be applied to types with unknown size.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2106: error 1530: Undefined struct or union.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2106: error 1588: "AI_CANONNAME" undefined.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2107: error 1530: Undefined struct or union.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2116: error 1530: Undefined struct or union.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2161: error 1530: Undefined struct or union.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2167: error 1530: Undefined struct or union.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2167: warning 563: Argument #2 is not the correct type.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2167: error 1530: Undefined struct or union.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2167: warning 563: Argument #3 is not the correct type.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2168: error 1530: Undefined struct or union.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2168: error 1532: Reference through a non-pointer.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2169: error 1530: Undefined struct or union.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2169: error 1563: Expression in if must be scalar.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2170: error 1530: Undefined struct or union.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2170: warning 563: Argument #1 is not the correct type.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2170: error 1530: Undefined struct or union.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2170: warning 563: Argument #3 is not the correct type.
cc: "/home/ulink/ffbuild/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2198: error 1530: Undefined struct or union.
gmake[3]: *** [prnetdb.o] Error 1

I have to backout the combined patch from
https://bugzilla.mozilla.org/show_bug.cgi?id=329807

but then I will later run into linker error in NSS
https://bugzilla.mozilla.org/show_bug.cgi?id=586790
Blocks: 586790
Depends on: 329807
Thanks for the bug report.

The intention of NSPR's HP-UX code is to assume IPv6
exists on HP-UX 11.23 or later, and do "IPv6 probing"
on older releases:

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/nsprpub/configure.in&rev=1.289&mark=1370,1372-1374#1370

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/nsprpub/pr/include/md/_hpux.h&rev=3.23&mark=109,111-112#109

If _PR_INET6_PROBE is defined, we do IPv6 probing.
There are two styles of IPv6 probing:
1. If _PR_INET6 is also defined, the IPv6 socket
API is known to exist, so we merely need to detect
if we can actually create an IPv6 socket.
2. If _PR_INET6 is not defined, we need to detect
if the IPv6 socket API exists (by looking up the
function symbols, etc.).

For older HP-UX versions, we need to do the latter
style of IPv6 probing.  I checked the Solaris code,
and I believe we need to add define those undefined
macros like this:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/nsprpub/pr/include/md/_solaris.h&rev=3.30&mark=100,102,104-105,116-119#100

Note: we do IPv6 probing on *all* versions of Solaris.
Do not copy that to _hpux.h.

You need to get the values of AF_INET6, AI_V4MAPPED,
AI_ADDRCONFIG, AI_ALL, and AI_CANONNAME from HP-UX 11.23.
Wan-Teh,
don't have a machine with 11.23, but I have downloaded the IPv6 addon product for 11.11. Will try to follow comment #1 approach and see if I can fix it.Will report back in September, as I'm on vacation very soon :-) And I need to reinstall my dev workstation with 11.11 to.
This is lowest priority/nice to have for 11.00, but I would expect 11.11 working.
Severity: normal → minor
Uli,

You can use the values of AF_INET6, AI_V4MAPPED, AI_ADDRCONFIG,
AI_ALL, and AI_CANONNAME from the IPv6 addon product for HP-UX
11.11.  Those values should be the same for backward compatibility.
After installing the IPv6 addon NSPR builds fine on both PA1.1 and PA2.0 targets.
So minimum HP-UX is B.11.11 with IPv6 add-on.
Will try on HP-UX B.11.00 with the values from <sys/socket.h> for the macros in comment# 3 with #ifndef before.

I don't know a reliant way to determine the HP-UX release by some predefined macros, as I would do on AIX.

THX wtc for the help :-) 
If you need some testing on AIX or HP-UX, drop me a note (I have some really strange UNICes in my collection).
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Uli: you're welcome.

If you can compile the tip of NSPR and NSS regularly
on the latest versions of AIX and HP-UX, that'll be a
big help to me.  I don't want to support old versions
such as HP-UX 10.20 though :-)
Was easy to fix: taken the values from HP-UX 11.11 (with optional IPv6 installed) headers.

This compiles with or without IPv6 installed. So even HP-UX 11.00 can be used again.
Attachment #476625 - Flags: review?
Attachment #476625 - Flags: review? → review?(wtc)
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Target Milestone: --- → 4.8.7
Comment on attachment 476625 [details] [diff] [review]
Fixing HP-UX support without IPv6 installed

Uli,

Thanks for the patch.

>+#ifndef AF_INET6
>+#define AF_INET6       22
>+#undef _PR_HAVE_GETADDRINFO
>+#endif

You should not need to undefine _PR_HAVE_GETADDRINFO.
Are you sure it's necessary?

Can you just define all the macros as follows?

> #ifdef _PR_INET6
> #define _PR_HAVE_INET_NTOP
> #else
> #define _PR_INET6_PROBE
>+
>+/* for HP-UX 11.11 without IPv6 */
>+#define AF_INET6       22
>+#define AI_CANONNAME   2
>+#define AI_NUMERICHOST 4
>+#define AI_NUMERICSERV 8
>+#define AI_V4MAPPED    0x00000010
>+#define AI_ADDRCONFIG  0x00000040
>+#define AI_ALL         0x00000020
>+#define AI_DEFAULT     (AI_V4MAPPED|AI_ADDRCONFIG)

This is what we do on other platforms (_osf1, _solaris.h,
and _win95.h).
(In reply to comment #7)

> >+#ifndef AF_INET6
> >+#define AF_INET6       22
> >+#undef _PR_HAVE_GETADDRINFO
> >+#endif
> 
> You should not need to undefine _PR_HAVE_GETADDRINFO.
> Are you sure it's necessary?
> 

Without it does not compile (patched as you suggested):

cc -Ae -o prnetdb.o -c      +DAportable +DS2.0 +Olit=all -O +Z  -UDEBUG  -DNDEBUG=1 -DXP_UNIX=1 -DHPUX=1 -D_HPUX_SOURCE=1 -D_PR_POLL_WITH_SELECT=1 -D_USE_BIG_FDS=1 -Dhppa=1 -DHAVE_POINTER_LOCALTIME_R=1 -DHPUX10=1 -DHPUX11=1 -D_LARGEFILE64_SOURCE=1 -D_PR_HAVE_OFF64_T=1 -DHAVE_FCNTL_FILE_LOCKING=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -D_POSIX_C_SOURCE=199506L -D_PR_HAVE_THREADSAFE_GETHOST=1  -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -D_NSPR_BUILD_ -I/home/ulink/Src/nss-3.12.8/mozilla/security/nss/../../dist/HP-UXB.11.00_OPT.OBJ/include -I../../../../pr/include -I../../../../pr/include/private  ../../../../pr/src/misc/prnetdb.c
cc: "../../../../pr/src/misc/prnetdb.c", line 2032: error 1574: Unknown size for "hints".
cc: "../../../../pr/src/misc/prnetdb.c", line 2041: error 1594: The sizeof operator cannot be applied to types with unknown size.
cc: "../../../../pr/src/misc/prnetdb.c", line 2042: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2043: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2052: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2097: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2101: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2101: error 1564: Expression in while must be scalar.
cc: "../../../../pr/src/misc/prnetdb.c", line 2102: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2106: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2106: warning 563: Argument #2 is not the correct type.
cc: "../../../../pr/src/misc/prnetdb.c", line 2106: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2106: warning 563: Argument #3 is not the correct type.
cc: "../../../../pr/src/misc/prnetdb.c", line 2107: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2107: error 1532: Reference through a non-pointer.
cc: "../../../../pr/src/misc/prnetdb.c", line 2112: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2112: error 1563: Expression in if must be scalar.
cc: "../../../../pr/src/misc/prnetdb.c", line 2113: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2113: warning 563: Argument #1 is not the correct type.
cc: "../../../../pr/src/misc/prnetdb.c", line 2113: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2113: warning 563: Argument #3 is not the correct type.
cc: "../../../../pr/src/misc/prnetdb.c", line 2141: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2151: error 1574: Unknown size for "hints".
cc: "../../../../pr/src/misc/prnetdb.c", line 2156: error 1594: The sizeof operator cannot be applied to types with unknown size.
cc: "../../../../pr/src/misc/prnetdb.c", line 2157: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2158: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2159: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2169: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2169: warning 563: Argument #2 is not the correct type.
cc: "../../../../pr/src/misc/prnetdb.c", line 2169: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2169: warning 563: Argument #3 is not the correct type.
cc: "../../../../pr/src/misc/prnetdb.c", line 2170: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2170: error 1532: Reference through a non-pointer.
cc: "../../../../pr/src/misc/prnetdb.c", line 2170: error 1563: Expression in if must be scalar.
cc: "../../../../pr/src/misc/prnetdb.c", line 2176: error 1530: Undefined struct or union.
cc: "../../../../pr/src/misc/prnetdb.c", line 2176: error 1532: Reference through a non-pointer.
cc: "../../../../pr/src/misc/prnetdb.c", line 2176: error 1563: Expression in if must be scalar.
cc: "../../../../pr/src/misc/prnetdb.c", line 2281: error 1588: "NI_NUMERICHOST" undefined.
cc: "../../../../pr/src/misc/prnetdb.c", line 2280: warning 563: Argument #7 is not the correct type.
gmake[4]: *** [prnetdb.o] Error 1
gmake[4]: Leaving directory `/home/ulink/Src/nss-3.12.8/mozilla/nsprpub/HP-UXB.11.00_OPT.OBJ/pr/src/misc'

Maybe it's better fixed in a different place?
Thanks for testing.  I think you need to define struct addrinfo.
Your build output shows that you also need to define NI_NUMERICHOST.

See these examples.  In particular, _win95.h defines both
struct addrinfo and NI_NUMERICHOST.

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/nsprpub/pr/include/md/_osf1.h&rev=3.17&mark=78-87#72

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/nsprpub/pr/include/md/_solaris.h&rev=3.30&mark=106-115#102

http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/nsprpub/pr/include/md/_win95.h&rev=3.39&mark=75-85#67
Now with the missing struct addrinfo and NI_NUMERICHOST copied from HPUX 11.11 header with IPv6 /usr/include/netdb.h
Tested NSPR 4.8.6 on HPUX 11.00 (without IPv6) and HPUX 11.11 with IPv6 addon installed.
Thx for the hints.
Attachment #476625 - Attachment is obsolete: true
Attachment #494108 - Flags: review?
Attachment #476625 - Flags: review?(wtc)
Attachment #494108 - Flags: review? → review?(wtc)
Comment on attachment 494108 [details] [diff] [review]
Revised patch, compiles on HPUX 11.00 and 11.11 with IPv6

r=wtc.

>+/* for HP-UX 11.11 without IPv6 */
>+#ifndef AF_INET6
>+#define AF_INET6       22
>+#define AI_CANONNAME   2
>+#define AI_NUMERICHOST 4
...

Is the "#ifndef AF_INET6" test necessary?

Do you need the test so that you can compile on
HP-UX 11.11 both with and without IPv6?
Attachment #494108 - Flags: review?(wtc) → review+
(In reply to comment #11)

> >+/* for HP-UX 11.11 without IPv6 */
> >+#ifndef AF_INET6
> >+#define AF_INET6       22
> ...
> 
> Is the "#ifndef AF_INET6" test necessary?
> 
> Do you need the test so that you can compile on
> HP-UX 11.11 both with and without IPv6?

The HP-UX aCC compiler dislikes macro redefinition, which will happen without the #ifndef AF_INET6
Haven't found a more significant define. A configure test maybe a more clean solution.
I will check in Uli's patch after NSPR 4.8.7 is released.
Status: REOPENED → ASSIGNED
Target Milestone: 4.8.7 → 4.8.8
Patch checked in on the NSPR trunk (NSPR 4.8.8).

Checking in _hpux.h;
/cvsroot/mozilla/nsprpub/pr/include/md/_hpux.h,v  <--  _hpux.h
new revision: 3.24; previous revision: 3.23
done
Status: ASSIGNED → RESOLVED
Closed: 9 years ago9 years ago
Priority: -- → P2
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.