Bug 39652

Summary: connect (2) under IPv6 has an incomplete list of returnable error numbers
Product: Documentation Reporter: kernel (kernel)
Component: man-pagesAssignee: documentation_man-pages (documentation_man-pages)
Status: NEW ---    
Severity: normal CC: erik, xerofoify
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.37 Subsystem:
Regression: No Bisected commit-id:

Description kernel@chappell-family.com 2011-07-20 17:54:59 UTC
I believe this applies to many 2.6.xx kernel documentation sets.

The man-page for connect (2) has an incomplete list of potential error reasons (indicated in errno) and their descriptive causes when attempting to connect to a remote IPv6 server and the return value indicates an error (-1).

Observed by testing with 2.6.37:

ENETUNREACH – reason should additionally include reference to the receipt of an ICMPv6 type 1 code 0 (no route to destination) response.

EACCES – reason should additionally include reference to the receipt of an ICMPv6 type 1 code 1 (Administratively prohibited) response.

EHOSTUNREACH – this isn't documented as a potential reason at present, but I believe it should be added and the causes are ICMPv6 type 1 code 3 (Address unreachable - I've verified this to be the case) or ICMPv6 type 3 (Time exceeded – I haven't verified this case - please check source code).

ECONNREFUSED – reason should additionally include reference to the receipt of an ICMPv6 type 1 code 4 (Port unreachable) or TCP RST/ACK response.

Having looked through v2.6.31 source it appears that potentially the following could also occur although I haven't verified this to be the case:

EMSGSIZE – ICMPv6 type 2 – ICMPv6 type 2 (Packet too big)
EPROTO – ICMPv6 type 4 – ICMPv6 type 4 (Parameter problem)

Thanks.
Comment 1 xerofoify 2014-06-25 16:02:13 UTC
Please test this bug against a newer version of man-pages to see if it's
fixed.
Thanks Nick
Comment 2 kernel@chappell-family.com 2014-06-25 20:03:16 UTC
Nick,

Thanks for the reply. I've just tested this with version 3.53 of the man pages and it now seems correct, apart from:

1. EHOSTUNREACH - this is still missing as a potential reason. I believe it should be added and the causes are ICMPv6 type 1 code 3 (Address unreachable - I've verified this to be the case) or ICMPv6 type 3 (Time exceeded – I haven't verified this case - please check source code).

2. There's also no mention of:

EMSGSIZE or EPROTO - did you check these? I haven't rechecked the source since I originally raised the issue.

Best wishes,

Tim.
Comment 3 Erik Rigtorp 2020-08-03 19:54:30 UTC
EHOSTUNREACH is described in the manpage at least since 2020-04-11 (https://man7.org/linux/man-pages/man2/connect.2.html)