Support IPv6 on Linux,Solaris,Digital UNIX



19 years ago
17 years ago


(Reporter: John G. Myers, Assigned: srinivas)


Firefox Tracking Flags

(Not tracked)



(2 attachments)



19 years ago
Linux has native IPv6 support as a kernel compile-time option, with the
default of having the support off.  So, on Linux, NSPR will have to
probe for IPv6 support by calling socket() with AF_INET6; if that fails
with EINVAL then fall back to using the IPv6-to-IPv4 mapping layer.

Should this probing be done:

1) At NSPR initialization?
2) On the first (few) PR_Socket() calls; the fallback case setting a
global variable to suppress further probes?
3) Every time PR_Socket() is called to create a v6 socket?

I prefer (2).  I don't think the global variable needs to be protected
by a mutex, as cache coherency problems will only result in extra calls
to socket().

I propose to call the macro which indicates this probing behavior is
needed _PR_INET6_PROBE and the global variable _pr_ipv6_ipv6_not_present


19 years ago


19 years ago
Severity: normal → enhancement

Comment 1

19 years ago
_pr_ipv6_not_present should be tri-state (unknown, present, not-present) so that 
PR_GetIPNodeByName() can suppress returning IPv6 addresses when called with 
AI_ADDRCONFIG and kernel support is not present.

I would like some comments on the design before I start coding it up.

Comment 2

19 years ago
I think (3) is not worth considering.

(1) is simpler, but adds overhead to process
startup that some applications may not need
at all.

If I can be convinced that the global variable
does not need to be protected by a mutex, then
(2) is the best choice.  Otherwise I'd prefer (1).

Comment 3

19 years ago
I think the global variable doesn't need a mutex because the probing is 
idempotent and thread safe.  When multiple CPUs all see the uninitialized value, 
they will each try to create a v6 socket, get the same result, and store the 
same result into the global variable.

It's similar to the reason that the initialized member of a PRCallOnceType may 
be examined without acquiring a mutex.


Comment 4

19 years ago
I prefer to probe for native-ipv6-support at NSPR initialization, to 
keep things simple and because the additional cost should be negligible 
(compared to the cost of server startup).

The use of _PR_INET6_PROBE and _pr_ipv6_not_present should be fine. 
_PR_INET6_PROBE should be set for Linux and Solaris.
Also, shouldn't _pr_ipv6_not_present be a boolean? I don't understand what 
"unknown" state means?

Comment 5

19 years ago
The "unknown" state is only relevant for (2).  It means we haven't probed yet.

I'll code _PR_INET6_PROBE generically and test it on Linux/noipv6.  I'll let 
someone else try it out on Solaris.

Comment 6

19 years ago
Created attachment 4672 [details] [diff] [review]
proposed fix

Comment 7

19 years ago
Reassign for review and checkin.
Assignee: jgmyers → srinivas

Comment 8

19 years ago
I have made modifications to

1. detect ipv6 support at runtime on Solaris. This includes looking up the 
addresses of getipnodebyname and freehostent.
2. moved the test for Ipv6 sockets to md-specific files
3. set the scope_id and flowinfo fields to 0 in PR_EnumerateHostEnt and 
4. remove check fo AI_ALL in PR_GetIPNodeByName, when _PR_INET6_PROBE is 

The symbols used during compilation are:

_PR_INET6 - ipv6-support available during compilation
_PR_INET6_PROBE - check for ipv6 support at runtime

If _PR_INET6_PROBE is defined, but not _PR_INET6, the relevant Ipv6 symbols 
(AF_INET6, AF_V4MAPPED, etc) need to be defined in NSPR.
Summary: Support IPv6 on Linux → Support IPv6 on Linux,Solaris

Comment 9

19 years ago
Created attachment 4712 [details]
The patch is attached.

Comment 10

19 years ago
Patch checked in.

Files modified:

/cvsroot/mozilla/nsprpub/config/,v  <--
new revision:; previous revision: 3.15
/cvsroot/mozilla/nsprpub/pr/include/md/_linux.h,v  <--  _linux.h
new revision:; previous revision: 3.23
/cvsroot/mozilla/nsprpub/pr/include/md/_solaris.h,v  <--  _solaris.h
new revision:; previous revision:
/cvsroot/mozilla/nsprpub/pr/src/io/pripv6.c,v  <--  pripv6.c
new revision:; previous revision:
/cvsroot/mozilla/nsprpub/pr/src/io/prsocket.c,v  <--  prsocket.c
new revision:; previous revision:
/cvsroot/mozilla/nsprpub/pr/src/misc/prinit.c,v  <--  prinit.c
new revision:; previous revision: 3.18
/cvsroot/mozilla/nsprpub/pr/src/misc/prnetdb.c,v  <--  prnetdb.c
new revision:; previous revision:

Comment 11

19 years ago
Because _PR_INET6 is defined for Linux builds, ipv6-support is required at 
compile time. Is the ipv6 support available on older versions of RedHat Linux?

Comment 12

19 years ago
Marking the bug fixed.
Last Resolved: 19 years ago
Resolution: --- → FIXED

Comment 13

19 years ago
I added runtime detection of IPv6 support on Digital UNIX
/cvsroot/mozilla/nsprpub/pr/include/md/_osf1.h, revision
Summary: Support IPv6 on Linux,Solaris → Support IPv6 on Linux,Solaris,Digital UNIX
You need to log in before you can comment on or make changes to this bug.