netdev
[Top] [All Lists]

[PATCH] connect() return value.

To: netdev@xxxxxxxxxxx
Subject: [PATCH] connect() return value.
From: Geoffrey Lee <glee@xxxxxxxxxxxxxxx>
Date: Sat, 10 Aug 2002 20:24:41 +1000
Sender: owner-netdev@xxxxxxxxxxx
User-agent: Mutt/1.4i
Hi,


I posted this on linux-kernel but didn't get a reply.

Anyway here's a patch for it.



Problem:

(1)

While you try to connect() to port 0 on ipv4 / ipv6, it happily does it.
This doesn't seem to be correct, as I remember port 0 is reserved.
For reference FreeBSD / Solaris / OSF return -EADDRNOTAVAIL for this.

This is what my patch fixes, for ipv4 and ipv6 for both tcp and udp,
I don't know what should be done for the other protocols that is 
supported.


(2)

connect() doesn't return -EINTR on signal, rather it exits the signal
handler after processing it and returns an error if an error occurred
for the connection or does the connect to completion. The Linux man page 
implies that we don't ever return an -EINTR on Linux, but I don't know what 
is the correct behavior.  For reference, FreeBSD / Solaris / OSF return
-EINTR for an interrupted connect().

The patch also addresses this. However, it is noted on OSF that even
though connect() returns with -EINTR if the connection succeeds you can
still send and receive through that socket.


(Please CC:, not on list. Thanks).

        -- G.
        

Attachment: network-patch
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>