Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #67663

Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards

Path csiph.com!news.uzoreto.com!paganini.bofh.team!weretis.net!feeder7.news.weretis.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Thorsten Glaser <t.glaser@tarent.de>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards
Date Sun, 02 Aug 2020 21:50:01 +0200
Message-ID <Azs9z-1zu-3@gated-at.bofh.it> (permalink)
References <AxCG6-6la-9@gated-at.bofh.it> <Azqr7-vc-3@gated-at.bofh.it> <AxCG6-6la-9@gated-at.bofh.it> <Azqr7-vc-3@gated-at.bofh.it>
X-Mailbox-Line From debian-bugs-dist-request@lists.debian.org Sun Aug 2 19:45:09 2020
Old-Return-Path <debbugs@buxtehude.debian.org>
X-Spam-Flag NO
X-Spam-Score -0.699
Reply-To Thorsten Glaser <t.glaser@tarent.de>, 966459@bugs.debian.org
Resent-To debian-bugs-dist@lists.debian.org
Resent-Cc Debian Kernel Team <debian-kernel@lists.debian.org>
X-Debian-Pr-Message followup 966459
X-Debian-Pr-Package src:linux
X-Debian-Pr-Keywords upstream
X-Debian-Pr-Source linux
X-Spam-Bayes score:0.0000 Tokens: new, 29; hammy, 150; neutral, 239; spammy, 0. spammytokens: hammytokens:0.000-+--mirabilos, 0.000-+--*only*, 0.000-+--HContent-Language:de-DE-1901, 0.000-+--recvmsg, 0.000-+--H*RU:1f15
X-X-Sender tg@herc.mirbsd.org
Content-Language de-DE-1901, en-GB
X-Message-Flag Your mailer is broken. Get an update at http://www.washington.edu/pine/getpine/pcpine.html for free.
MIME-Version 1.0
Content-Type TEXT/PLAIN; charset=utf-8
Content-Transfer-Encoding QUOTED-PRINTABLE
X-Debian-Message from BTS
X-Mailing-List <debian-bugs-dist@lists.debian.org> archive/latest/1616681
List-ID <debian-bugs-dist.lists.debian.org>
List-URL <https://lists.debian.org/debian-bugs-dist/>
Approved robomod@news.nic.it
Lines 80
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Cc 966459@bugs.debian.org, netdev <netdev@vger.kernel.org>
X-Original-Date Sun, 2 Aug 2020 19:29:50 +0000 (UTC)
X-Original-Message-ID <Pine.BSM.4.64L.2008021919500.2148@herc.mirbsd.org>
X-Original-References <159596111771.2639.6929056987566441726.reportbug@tglase-nb.lan.tarent.de> <e67190b7de22fff20fb4c5c084307e0b76001248.camel@decadent.org.uk> <159596111771.2639.6929056987566441726.reportbug@tglase-nb.lan.tarent.de> <e67190b7de22fff20fb4c5c084307e0b76001248.camel@decadent.org.uk>
Xref csiph.com linux.debian.bugs.dist:1020204 linux.debian.kernel:67663

Cross-posted to 2 groups.

Show key headers only | View raw


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.

On the sending side, I use setsockopt with either
IPPROTO_IP,IP_TOS or IPPROTO_IPV6,IPV6_TCLASS to
set the default traffic class on outgoing packets.

On the receiving side I use setsockopt with either
IPPROTO_IP,IP_RECVTOS or IPPROTO_IPV6,IPV6_RECVTCLASS
to set up the socket then recvmsg to get a cmsg(3) of
IPPROTO_IP,IP_TOS/IPPROTO_IPV6,IPV6_TCLASS from which
I read the traffic class octet.

These are where I believe I found inconsistencies
between code and documentation.

>Those are two different APIs though: recvmsg() for datagram sockets, vs
>getsockopt(... IP_PKTOPTIONS ...) for stream sockets.  They obviously
>ought to be consistent, but mistakes happen.

OK, I’m currently looking at the datagram case only.
This may change later if there’s enough time.

>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.

>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.

>But you should know that the highest priority for Linux API
>compatibility is to avoid breaking currently working user-space.  That
>means that ugly and inconsistent APIs won't get fixed if it causes a
>regression for the programs people actually use.  If the API never
>worked like it was supposed to on some architectures, that's not a
>regression, and is lower priority.

This is why I just put this up for discussion instead of
requesting a specific change.

That being said, given that the IPv6 API is *only* documented
in the RFC and *not* documented in the Linux manpages…

(Perhaps codesearching for IPV6_TCLASS might also help.
It’s unclear how many users this has…)



In the end, what I really want, is clear documentation for
how I should implement the following file that it works on
Linux, and ideally also other systems implementing the RFC
API (FreeBSD supposedly does but needs testing):

https://github.com/tarent/ECN-Bits/blob/master/linux-c/lib/ecn.c

Given that there’s no documentation, trying to read the
coffee grounds from the kernel source, finding it doesn’t
even match the RFC (which, again, doesn’t match what itojun
proposed, for some reason), does not instigate trust in the
things I *think* I’ve found.

bye,
//mirabilos
-- 
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

Back to linux.debian.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards Thorsten Glaser <tg@mirbsd.de> - 2020-07-28 20:40 +0200
  Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards Ben Hutchings <ben@decadent.org.uk> - 2020-08-02 20:00 +0200
    Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards Thorsten Glaser <t.glaser@tarent.de> - 2020-08-02 21:50 +0200
      Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards Ben Hutchings <ben@decadent.org.uk> - 2020-08-02 22:40 +0200
        Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards Thorsten Glaser <t.glaser@tarent.de> - 2020-08-02 22:50 +0200
          Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards Ben Hutchings <ben@decadent.org.uk> - 2020-08-03 05:40 +0200
            Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards Thorsten Glaser <t.glaser@tarent.de> - 2020-08-03 19:10 +0200
              Bug#966459: linux: traffic class socket options (both IPv4/IPv6) inconsistent with docs/standards Thorsten Glaser <t.glaser@tarent.de> - 2020-08-04 21:10 +0200

csiph-web