public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <colomar.6.4.3@gmail.com>
To: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
	netdev@vger.kernel.org
Cc: linux-man <linux-man@vger.kernel.org>
Subject: [BUG?] ipv6.7: SOCK_DGRAM can accept different protocols?
Date: Thu, 16 Sep 2021 19:37:35 +0200	[thread overview]
Message-ID: <7e1d0cae-ebd0-d7b0-cfe3-80b38ea8fbfb@gmail.com> (raw)

Hi,

Reading a stackoverflow question 
<https://stackoverflow.com/questions/51996808/do-we-need-to-specify-protocol-when-type-is-sock-dgram-or-sock-stream-in-soc> 
it noted that, while ip(7) notes that protocol can be left as 0 for both 
SOCK_STREAM and SOCK_DGRAM, ipv6(7) is misleading and seems to suggest 
that protocol may be significant for SOCK_DGRAM (at least in the SYNOPSIS).

I guess that's not true, and it can be left as 0, but since I don't 
know, I'll ask.

Thanks,

Alex


--

IP(7)                Linux Programmer's Manual               IP(7)

NAME
        ip - Linux IPv4 protocol implementation

SYNOPSIS
        #include <sys/socket.h>
        #include <netinet/in.h>
        #include <netinet/ip.h> /* superset of previous */

        tcp_socket = socket(AF_INET, SOCK_STREAM, 0);
        udp_socket = socket(AF_INET, SOCK_DGRAM, 0);
        raw_socket = socket(AF_INET, SOCK_RAW, protocol);


--

IPV6(7)              Linux Programmer's Manual             IPV6(7)

NAME
        ipv6 - Linux IPv6 protocol implementation

SYNOPSIS
        #include <sys/socket.h>
        #include <netinet/in.h>

        tcp6_socket = socket(AF_INET6, SOCK_STREAM, 0);
        raw6_socket = socket(AF_INET6, SOCK_RAW, protocol);
        udp6_socket = socket(AF_INET6, SOCK_DGRAM, protocol);


-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

             reply	other threads:[~2021-09-16 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 17:37 Alejandro Colomar [this message]
2021-09-17  7:05 ` [BUG?] ipv6.7: SOCK_DGRAM can accept different protocols? Eugene Syromyatnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e1d0cae-ebd0-d7b0-cfe3-80b38ea8fbfb@gmail.com \
    --to=colomar.6.4.3@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox