Netdev Archive on
 help / color / Atom feed
From: Ben Hutchings <>
To: Thorsten Glaser <>
Cc:, netdev <>
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: <> (raw)
In-Reply-To: <>

[-- 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 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] <>
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:

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

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Netdev Archive on

Archives are clonable:
	git clone --mirror netdev/git/0.git
	git clone --mirror 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/ \
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone