From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Guillaume Nault <gnault@redhat.com>,
David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
David Ahern <dsahern@kernel.org>,
Russell Strong <russell@strong.id.au>
Subject: Re: [PATCH net-next 0/4] inet: Separate DSCP from ECN bits using new dscp_t type
Date: Tue, 14 Dec 2021 01:16:43 +0100 [thread overview]
Message-ID: <87k0g8yr9w.fsf@toke.dk> (raw)
In-Reply-To: <cover.1638814614.git.gnault@redhat.com>
Guillaume Nault <gnault@redhat.com> writes:
> Following my talk at LPC 2021 [1], here's a patch series whose
> objective is to start fixing the problems with how DSCP and ECN bits
> are handled in the kernel. This approach seemed to make consensus among
> the participants, although it implies a few behaviour changes for some
> corner cases of ip rule and ip route. Let's see if this consensus can
> survive a wider review :).
I like the approach, although I must admit to not being too familiar
with the parts of the code you're touching in this series. But I think
the typedefs make sense, and I (still) think it's a good idea to do the
conversion. I think the main thing to ensure from a backwards
compatibility PoV is that we don't silently change behaviour in a way
that is hard to detect. I.e., rejecting invalid configuration is fine
even if it was "allowed" before, but, say, changing the matching
behaviour so an existing rule set will still run unchanged but behave
differently is best avoided.
> Note, this patch series differs slightly from that of the original talk
> (slide 14 [2]). For the talk, I just cleared the ECN bits, while in
> this series, I do a bit-shift. This way dscp_t really represents DSCP
> values, as defined in RFCs. Also I've renamed the helper functions to
> replace "u8" by "dsfield", as I felt "u8" was ambiguous. Using
> "dsfield" makes it clear that dscp_t to u8 conversion isn't just a
> plain cast, but that a bit-shift happens and the result has the two ECN
> bits.
I like the names, but why do the bitshift? I get that it's conceptually
"cleaner", but AFAICT the shifted values are not actually used for
anything other than being shifted back again? In which case you're just
adding operations in the fast path for no reason...
> The new dscp_t type is then used to convert several field members:
>
> * Patch 1 converts the tclass field of struct fib6_rule. It
> effectively forbids the use of ECN bits in the tos/dsfield option
> of ip -6 rule. Rules now match packets solely based on their DSCP
> bits, so ECN doesn't influence the result anymore. This contrasts
> with previous behaviour where all 8 bits of the Traffic Class field
> was used. It is believed this change is acceptable as matching ECN
> bits wasn't usable for IPv4, so only IPv6-only deployments could be
> depending on it (that is, it's unlikely enough that a someone uses
> ip6 rules matching ECN bits in production).
I think this is OK, cf the "break explicitly" thing I wrote above.
> * Patch 2 converts the tos field of struct fib4_rule. This one too
> effectively forbids defining ECN bits, this time in ip -4 rule.
> Before that, setting ECN bit 1 was accepted, while ECN bit 0 was
> rejected. But even when accepted, the rule wouldn't match as the
> packets would normally have their ECN bits cleared while doing the
> rule lookup.
As above.
> * Patch 3 converts the fc_tos field of struct fib_config. This is
> like patch 2, but for ip4 routes. Routes using a tos/dsfield option
> with any ECN bit set is now rejected. Before this patch, they were
> accepted but, as with ip4 rules, these routes couldn't match any
> real packet, since callers were supposed to clear their ECN bits
> beforehand.
Didn't work at all, so also fine.
> * Patch 4 converts the fa_tos field of struct fib_alias. This one is
> pure internal u8 to dscp_t conversion. While patches 1-3 dealed
> with user facing consequences, this patch shouldn't have any side
> effect and is just there to give an overview of what such
> conversion patches will look like. These are quite mechanical, but
> imply some code churn.
This is reasonable, and I think the code churn is worth the extra
clarity. You should probably spell out in the commit message that it's
not intended to change behaviour, though.
> Note that there's no equivalent of patch 3 for IPv6 (ip route), since
> the tos/dsfield option is silently ignored for IPv6 routes.
Shouldn't we just start rejecting them, like for v4?
-Toke
next prev parent reply other threads:[~2021-12-14 0:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 18:22 [PATCH net-next 0/4] inet: Separate DSCP from ECN bits using new dscp_t type Guillaume Nault
2021-12-06 18:22 ` [PATCH net-next 1/4] ipv6: Define dscp_t and stop taking ECN bits into account in ip6-rules Guillaume Nault
2021-12-06 18:22 ` [PATCH net-next 2/4] ipv4: Stop taking ECN bits into account in ip4-rules Guillaume Nault
2021-12-06 18:22 ` [PATCH net-next 3/4] ipv4: Reject routes specifying ECN bits in rtm_tos Guillaume Nault
2021-12-06 18:22 ` [PATCH net-next 4/4] ipv4: Use dscp_t in struct fib_alias Guillaume Nault
2021-12-06 19:57 ` [PATCH net-next 0/4] inet: Separate DSCP from ECN bits using new dscp_t type Guillaume Nault
2021-12-14 0:16 ` Toke Høiland-Jørgensen [this message]
2021-12-15 16:48 ` Guillaume Nault
2021-12-15 20:40 ` Dave Taht
2021-12-17 17:55 ` Toke Høiland-Jørgensen
2021-12-17 22:52 ` Guillaume Nault
-- strict thread matches above, loose matches on Subject: below --
2022-02-04 13:58 Guillaume Nault
2022-02-07 6:08 ` David Ahern
2022-02-07 19:03 ` Toke Høiland-Jørgensen
2022-02-08 5:10 ` patchwork-bot+netdevbpf
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=87k0g8yr9w.fsf@toke.dk \
--to=toke@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=gnault@redhat.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=russell@strong.id.au \
--cc=yoshfuji@linux-ipv6.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;
as well as URLs for NNTP newsgroup(s).