Netdev Archive on lore.kernel.org
 help / color / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Thorsten Glaser <t.glaser@tarent.de>
Cc: 966459@bugs.debian.org, netdev <netdev@vger.kernel.org>
Subject: Re: Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards
Date: Sun, 02 Aug 2020 21:29:07 +0100
Message-ID: <e1beb0b98109d90738e054683f5eb1dd483011dd.camel@decadent.org.uk> (raw)
In-Reply-To: <Pine.BSM.4.64L.2008021919500.2148@herc.mirbsd.org>


[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]

On Sun, 2020-08-02 at 19:29 +0000, Thorsten Glaser wrote:
> Ben Hutchings dixit:
> 
> >ip(7) also doesn't document IP_PKTOPIONS.
> 
> Hmm, I don’t use IP_PKTOPIONS though. I’m not exactly sure I found
> the correct place in the kernel for what I do.

The first instance of put_cmsg(...IP_TOS...) you found in
net/ipv4/ip_sockglue.c implements that socket option.

[...]
> >I see no point in changing the IPv6 behaviour: it seems to be
> >consistent with itself and with the standard
> 
> Not really: if the kernel writes an int and userspace reads
> its first byte, it only works by accident on little endian,
> but not elsewhere.

The RFC says that the IPV6_TCLASS option's value is an int, and that
"the first byte of cmsg_data[] will be the *first byte of the integer*
traffic class" (my emphasis).  We can infer from "the first byte of"
that cmsg_data[] will hold more than one byte.  And "the integer"
suggests that it's a C int, like the socket option.

> >so only risks breaking user-space that works today.
> 
> Hrm. It risks breaking userspace that reads an int. But the
> RFC clearly says it should read the first byte, not an int.
[...]

No, the wording is *not* clear.

Ben.

-- 
Ben Hutchings
It is easier to write an incorrect program
than to understand a correct one.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <159596111771.2639.6929056987566441726.reportbug@tglase-nb.lan.tarent.de>
2020-08-02 17:49 ` Ben Hutchings
2020-08-02 19:29   ` Thorsten Glaser
2020-08-02 20:29     ` Ben Hutchings [this message]
2020-08-02 20:44       ` Thorsten Glaser
2020-08-03  3:32         ` Ben Hutchings
2020-08-03 16:58           ` Thorsten Glaser

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=e1beb0b98109d90738e054683f5eb1dd483011dd.camel@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=966459@bugs.debian.org \
    --cc=netdev@vger.kernel.org \
    --cc=t.glaser@tarent.de \
    /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

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git