Open Bug 773959 Opened 12 years ago Updated 2 years ago

Fix mismatch of PRNetAddr and sockaddr on OS/2

Categories

(NSPR :: NSPR, defect)

3.5.1
x86
OS/2
defect

Tracking

(Not tracked)

People

(Reporter: komh, Unassigned)

Details

(Whiteboard: NPOTB, OS/2 only)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1
Build ID: 20120614114901
OS/2 32-bits TCP/IP puts 1 byte length field and 1 byte family field at first. But PRNetAddr puts 2 bytes family field at first.
Attachment #642226 - Flags: review?(daveryeo)
Component: General → Networking
OS: Windows 7 → OS/2
Hardware: x86_64 → x86
IIRC nsprpub patches must be cvs patches against nsprpub trunk but I don't remember the depositories URL.
Walter or Peter, do you remember?
While the patch is pretty well correct, I think it should be expanded to also remove TCPV40HDRS from the build system. The 32 bit stack is freely available and I believe most users have updated their stack or updated to eCS.
Once the patch[es} are finalized, review will have to be requested from one of the nsprpub maintainers.
Status: UNCONFIRMED → NEW
Ever confirmed: true
I think removing TCPV40HDRS from the build system is another problem.

So we should open another ticket for it after this patch is landed.

And provided you tell me the URL for nspurpub, I'll do that.
<https://developer.mozilla.org/en/NSPR_build_instructions> has info on CVS access and build of NSPR.
Comment on attachment 642226 [details] [diff] [review]
Fix mismatch of PRNetAddr and sockaddr

While the patch works to fix the 100% CPU issue and seems correct I don't have review rights so changing the requestee to Wan-Teh Chang.
Not sure if you should be doing a cvs diff from cvs-mirror.mozilla.org or if they followed through on their intention to turn off write access to cvs in the 2nd quarter of this year.
Attachment #642226 - Flags: review?(daveryeo) → review?(wtc)
Comment on attachment 642226 [details] [diff] [review]
Fix mismatch of PRNetAddr and sockaddr

Review of attachment 642226 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you for the patch.  I suggest an alternative fix below.

::: nsprpub/pr/include/prio.h
@@ +145,5 @@
>  union PRNetAddr {
>      struct {
> +#if defined(XP_OS2) && !defined(TCPV40HDRS)
> +        PRUint8 len;
> +        PRUint8 family;

We should not change PRNetAddr like this.  We want PRNetAddr
to be as cross-platform as possible.

The correct fix is as follows.

1. Add the following to mozilla/nsprpub/pr/include/md/_os2.h:

#if !defined(TCPV40HDRS)
#define _PR_HAVE_SOCKADDR_LEN
#endif

2. In the OS/2 socket code, convert PRNetAddr to struct sockaddr
if _PR_HAVE_SOCKADDR_LEN is defined.  You can see how this is done
for Unix in mozilla/nsprpub/pr/src/pthreads/ptio.c.  The following
IO methods need special handing for _PR_HAVE_SOCKADDR_LEN:

  bind
  accept
  connect
  recvfrom
  sendto
  getsockname
  getpeername

Sorry for the trouble, but all this complexity is needed to
avoid exposing a platform-dependent 'len' field in PRNetAddr.

Question: Is Mozilla still accepting patches for OS/2?  At some
point we'll need to drop OS/2 support.
Attachment #642226 - Flags: review?(wtc) → review-
(In reply to Wan-Teh Chang from comment #7)
> Question: Is Mozilla still accepting patches for OS/2?  At some
> point we'll need to drop OS/2 support.

Why is that?
(In reply to Wan-Teh Chang from comment #7)
[...]
> 
> Question: Is Mozilla still accepting patches for OS/2?

Yes

>  At some point we'll need to drop OS/2 support.

OS/2 is still being sold as an OEM version, http://ecomstation.com/ and updated to work on modern hardware though you have to be picky about hardware.
Attached patch v2 for PRNetAddrSplinter Review
Attachment #644548 - Flags: review?(wtc)
Ping ?
Whiteboard: NPOTB, OS/2 only
Ping2 ?
Not acceptable ?
Component: Networking → NSPR
Product: Core → NSPR
Version: Trunk → 3.5.1
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: