assert in pt_GetPeerName on 2.4.3 IPv6 kernel

RESOLVED FIXED in 4.2

Status

P2
normal
RESOLVED FIXED
18 years ago
18 years ago

People

(Reporter: jgmyers, Assigned: wtc)

Tracking

4.0.2
x86
Linux

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

18 years ago
On Linux with a 2.4.3 kernel with IPv6 enabled, I'm getting an assert in 
pt_GetPeerName() with the IsValidNetAddrLen() check.

In /usr/include, sizeof(sockaddr_in6) is 24.  In the kernel, it is 28 as a 
32-bit scope_id field has been appended.

For linux at least we need to be able to accept both lengths.  Any ideas how to 
conditionalize this?
(Reporter)

Comment 1

18 years ago
This happens when connecting to an IMAP/SSL server, as the SSL handshake code 
calls the getpeername() method on the lower PRFileDesc.
(Assignee)

Comment 2

18 years ago
John,

Are you saying that we pass addrlen (where *addrlen is 24) to
getpeername(), but on return *addrlen is 28?  It would be wrong
for the kernel to do this.
(Reporter)

Comment 3

18 years ago
No, we pass an addr_len of sizeof(PRNetAddr), which is significantly larger than 
28.  We then get upset that the kernel returned a value other than 24.
(Reporter)

Comment 4

18 years ago
Created attachment 33001 [details] [diff] [review]
Proposed fix

Comment 5

18 years ago
I just applied John's patch and it seems to work for me.

Comment 6

18 years ago
reassign to wtc
Need a little better fix than the proposed patch.
Assignee: larryh → wtc
(Assignee)

Comment 7

18 years ago
Created attachment 35732 [details] [diff] [review]
wtc's proposed patch.  conditionalized the assertion to accept both sockaddr_in6 lengths.
(Assignee)

Updated

18 years ago
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → 4.2
Version: 3.0 → 4.0.2
(Assignee)

Comment 8

18 years ago
Patch 35732 has been checked in on the trunk and
NSPRPUB_CLIENT_BRANCH of NSPR.

I'm going to attach another patch that conditionalizes
the workaround for glibc 2.1 only because glibc 2.2 or
newer doesn't need it.
Target Milestone: 4.2 → 4.1.2
(Assignee)

Comment 9

18 years ago
Created attachment 37282 [details] [diff] [review]
Patch to conditionalize the workaround for glibc 2.1 only.
(Assignee)

Comment 10

18 years ago
I would appreciate it if you could give the new patch
(applied to NSPRPUB_CLIENT_BRANCH) a try.
(Assignee)

Comment 11

18 years ago
I checked in the following patch on the trunk of NSPR.  This workaround
is only needed for glibc 2.1 because glibc 2.0 does not have struct
sockaddr_in6 and glibc 2.2 has the RFC 2553 compliant struct sockaddr_in6.

Index: mozilla/nsprpub/pr/src/io/prsocket.c
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/src/io/prsocket.c,v
retrieving revision 3.46
diff -u -r3.46 prsocket.c
--- prsocket.c  2001/05/23 04:17:31     3.46
+++ prsocket.c  2001/06/08 19:38:46
@@ -65,7 +65,7 @@
             && (addr->raw.family != AF_UNIX)
 #endif
             && (PR_NETADDR_SIZE(addr) != addr_len)) {
-#if defined(LINUX)
+#if defined(LINUX) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 1
         /*
          * In glibc 2.1, struct sockaddr_in6 is 24 bytes.  In glibc 2.2
          * and in the 2.4 kernel, struct sockaddr_in6 has the scope_id
Index: mozilla/nsprpub/pr/src/pthreads/ptio.c
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/src/pthreads/ptio.c,v
retrieving revision 3.68
diff -u -r3.68 ptio.c
--- ptio.c      2001/05/23 04:17:33     3.68
+++ ptio.c      2001/06/08 19:38:47
@@ -236,7 +236,7 @@
     if ((addr != NULL)
             && (addr->raw.family != AF_UNIX)
             && (PR_NETADDR_SIZE(addr) != addr_len)) {
-#if defined(LINUX)
+#if defined(LINUX) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 1
         /*
          * In glibc 2.1, struct sockaddr_in6 is 24 bytes.  In glibc 2.2
          * and in the 2.4 kernel, struct sockaddr_in6 has the scope_id
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED
Target Milestone: 4.1.2 → 4.2
You need to log in before you can comment on or make changes to this bug.