Closed
Bug 25127
Opened 26 years ago
Closed 26 years ago
PR_StringToNetaddr for non-Ipv6 platforms
Categories
(NSPR :: NSPR, defect, P3)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: srinivas, Assigned: wtc)
Details
Attachments
(4 files)
|
1.17 KB,
text/plain
|
Details | |
|
13.63 KB,
patch
|
Details | Diff | Splinter Review | |
|
4.70 KB,
patch
|
Details | Diff | Splinter Review | |
|
6.99 KB,
patch
|
Details | Diff | Splinter Review |
PR_StringToNetAddr needs to modified to work on non-Ipv6 platforms for Ipv6
addresses. It is probably better to introduce a new function that accepts an
address family parameter.
Who wants to work on this?
Comment 1•26 years ago
|
||
PR_StringToNetAddr() should work the same on both ipv6 and non-ipv6 platforms.
The reason to introduce a new function would be to get inputs like "205.13.41.1"
to produce an ipv4 mapped ipv6 function.
Comment 3•26 years ago
|
||
Updated•26 years ago
|
Status: NEW → ASSIGNED
Comment 4•26 years ago
|
||
Comment 5•26 years ago
|
||
Reassign for review and checkin
Assignee: jgmyers → srinivas
Status: ASSIGNED → NEW
| Assignee | ||
Comment 7•26 years ago
|
||
| Assignee | ||
Comment 8•26 years ago
|
||
Comments on my proposed changes to StringToV6Addr()
(attachment 4837 [details] [diff] [review]):
1. Added comments to explain the return value and
the two main variables ('section' and 'double_colon')
of the function.
2. Check for input that is too long at the beginning
of the while loop to also catch the double colon
case. The original code fails to catch
"1:2:3:4:5:6:7::8".
3. Make sure there are digits between ':' and '.'.
The original code parses "::.1.2.3" as a valid
string.
4. Stretch the double colon at the end, for trailing
v4 format addresses too. Store the v4 address
byte by byte.
Comment 9•26 years ago
|
||
Per my reading of the draft, a v4 format address is only legal at the end.
| Assignee | ||
Comment 10•26 years ago
|
||
jgmyers@netscape.com wrote:
> Per my reading of the draft, a v4 format address is
> only legal at the end.
This is correct. What I meant is that we only need
to stretch the double colon at the end of the
StringToV6Addr() function. (The original code has
two copies of the double colon stretching code.)
It is okay to convert the v4 format address first,
before stretching the double colon.
The v4 format address conversion code already
makes sure that the v4 format address is at
the end of the string:
if (*s) return 0; /* must have exactly 4 decimal numbers */
| Assignee | ||
Comment 11•26 years ago
|
||
| Assignee | ||
Comment 12•26 years ago
|
||
The only new thing in this patch is to
change V6AddrToString to match inet_ntop
closer. I also added some comments to
aid (my own) understanding.
Excellent piece of code you wrote in just
one day, John!
Comment 13•26 years ago
|
||
You may want to add a comment that double_colon_length is used to select the
longest sequence of zeros.
| Assignee | ||
Comment 14•26 years ago
|
||
I checked in my proposed changes (attachment 4844 [details] [diff] [review]),
plus a comment about double_colon_length that jgmyers
suggested. I also added a test program based on
jgmyers's test cases (attachment 4591 [details]). Note that
this test is not added to the test harness runtests.ksh
because the inet_pton() function is broken on Linux and
AIX.
NSPRPUB_RELEASE_4_0_BRANCH:
/cvsroot/mozilla/nsprpub/pr/src/misc/prnetdb.c, revision 3.11.4.13
/cvsroot/mozilla/nsprpub/pr/tests/addrstr.c, revision 1.1.2.1 (new file)
/cvsroot/mozilla/nsprpub/pr/tests/Makefile, revision 3.47.2.2
/cvsroot/mozilla/nsprpub/pr/tests/Makefile.in, revision 1.10.6.1
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•