Bug 204981

Summary: Information in udplite(7) and sctp(7) contradicts ip(7)
Product: Documentation Reporter: Martin Doucha (mdoucha)
Component: man-pagesAssignee: documentation_man-pages (documentation_man-pages)
Status: RESOLVED CODE_FIX    
Severity: low CC: mtk.manpages
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:

Description Martin Doucha 2019-09-24 12:45:50 UTC
ip(7) says that the only valid protocol values for socket(AF_INET, SOCK_STREAM, protocol) are 0 and IPPROTO_TCP. But sctp(7) says that IPPROTO_SCTP is also allowed.

Similarly, ip(7) says that the only valid protocol values for socket(AF_INET, SOCK_DGRAM, protocol) are 0 and IPPROTO_UDP. But udplite(7) says that IPPROTO_UDPLITE is also allowed.

Short test program which tries to open a socket with SOCK_STREAM+IPPROTO_SCTP or SOCK_DGRAM+IPPROTO_UDPLITE confirms that sctp(7) and udplite(7) are correct. Since ip(7) uses SOCK_STREAM and TCP interchangeably (similarly SOCK_DGRAM and UDP), this isn't trivial to fix so I should leave it to some better technical writer than me.

Quick links:
http://man7.org/linux/man-pages/man7/ip.7.html
http://man7.org/linux/man-pages/man7/udplite.7.html
http://man7.org/linux/man-pages/man7/sctp.7.html
Comment 1 Michael Kerrisk 2020-04-23 12:57:05 UTC
Thanks for the report. I confirmed the details. I reworked the relevant paragraphs of the manual page to say:

       Valid  socket  types  include SOCK_STREAM to open a stream socket,
       SOCK_DGRAM to open a datagram  socket,  and  SOCK_RAW  to  open  a
       raw(7) socket to access the IP protocol directly.

       protocol  is  the  IP  protocol in the IP header to be received or
       sent.  Valid values for protocol include:

       · 0 and IPPROTO_TCP for tcp(7) stream sockets;

       · 0 and IPPROTO_UDP for udp(7) datagram sockets;

       · IPPROTO_SCTP for sctp(7) stream sockets; and

       · IPPROTO_UDPLITE for udplite(7) datagram sockets.

Closing this report now. Please reopen if you think something is still lacking.