From: Petr Machata <petrm@nvidia.com>
To: Ido Schimmel <idosch@nvidia.com>
Cc: Petr Machata <petrm@nvidia.com>, <netdev@vger.kernel.org>,
<stephen@networkplumber.org>, <dsahern@gmail.com>,
<gnault@redhat.com>
Subject: Re: [PATCH iproute2-next 5/5] iprule: Add DSCP mask support
Date: Tue, 25 Feb 2025 09:58:19 +0100 [thread overview]
Message-ID: <877c5ejt69.fsf@nvidia.com> (raw)
In-Reply-To: <Z7yeDXAK26NOEue4@shredder>
Ido Schimmel <idosch@nvidia.com> writes:
> On Mon, Feb 24, 2025 at 03:35:51PM +0100, Petr Machata wrote:
>>
>> Ido Schimmel <idosch@nvidia.com> writes:
>>
>> > Add DSCP mask support, allowing users to specify a DSCP value with an
>> > optional mask. Example:
>> >
>> > # ip rule add dscp 1 table 100
>> > # ip rule add dscp 0x02/0x3f table 200
>> > # ip rule add dscp AF42/0x3f table 300
>> > # ip rule add dscp 0x10/0x30 table 400
>> >
>> > In non-JSON output, the DSCP mask is not printed in case of exact match
>> > and the DSCP value is printed in hexadecimal format in case of inexact
>> > match:
>> >
>> > $ ip rule show
>> > 0: from all lookup local
>> > 32762: from all lookup 400 dscp 0x10/0x30
>> > 32763: from all lookup 300 dscp AF42
>> > 32764: from all lookup 200 dscp 2
>> > 32765: from all lookup 100 dscp 1
>> > 32766: from all lookup main
>> > 32767: from all lookup default
>> >
>> > Dump can be filtered by DSCP value and mask:
>> >
>> > $ ip rule show dscp 1
>> > 32765: from all lookup 100 dscp 1
>> > $ ip rule show dscp AF42
>> > 32763: from all lookup 300 dscp AF42
>> > $ ip rule show dscp 0x10/0x30
>> > 32762: from all lookup 400 dscp 0x10/0x30
>> >
>> > In JSON output, the DSCP mask is printed as an hexadecimal string to be
>> > consistent with other masks. The DSCP value is printed as an integer in
>> > order not to break existing scripts:
>> >
>> > $ ip -j -p -N rule show dscp 0x10/0x30
>> > [ {
>> > "priority": 32762,
>> > "src": "all",
>> > "table": "400",
>> > "dscp": "16",
>> > "dscp_mask": "0x30"
>> > } ]
>> >
>> > The mask attribute is only sent to the kernel in case of inexact match
>> > so that iproute2 will continue working with kernels that do not support
>> > the attribute.
>> >
>> > Signed-off-by: Ido Schimmel <idosch@nvidia.com>
>>
>> Reviewed-by: Petr Machata <petrm@nvidia.com>
>>
>> > @@ -552,8 +560,24 @@ int print_rule(struct nlmsghdr *n, void *arg)
>> > if (tb[FRA_DSCP]) {
>> > __u8 dscp = rta_getattr_u8(tb[FRA_DSCP]);
>> >
>> > - print_string(PRINT_ANY, "dscp", " dscp %s",
>> > - rtnl_dscp_n2a(dscp, b1, sizeof(b1)));
>>
>> Hm, this should have been an integer under -N. Too late for that :-/
>
> I assume you mean 16 vs "16" in the last example? It is a deliberate
> decision:
>
> https://lore.kernel.org/netdev/d3cd276a-b3b0-4ccc-9b51-dbedd841d7af@kernel.org/
Yeah, that's what I meant. I agree that if `ip` has it like that
throughout, it's better to respect it.
prev parent reply other threads:[~2025-02-25 9:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 6:52 [PATCH iproute2-next 0/5] iprule: Add mask support for L4 ports and DSCP Ido Schimmel
2025-02-24 6:52 ` [PATCH iproute2-next 1/5] Sync uAPI headers Ido Schimmel
2025-02-24 6:52 ` [PATCH iproute2-next 2/5] iprule: Move port parsing to a function Ido Schimmel
2025-02-24 14:47 ` Petr Machata
2025-02-24 6:52 ` [PATCH iproute2-next 3/5] iprule: Allow specifying ports in hexadecimal notation Ido Schimmel
2025-02-24 14:47 ` Petr Machata
2025-02-24 6:52 ` [PATCH iproute2-next 4/5] iprule: Add port mask support Ido Schimmel
2025-02-24 14:03 ` Petr Machata
2025-02-24 16:17 ` Ido Schimmel
2025-02-24 6:52 ` [PATCH iproute2-next 5/5] iprule: Add DSCP " Ido Schimmel
2025-02-24 14:35 ` Petr Machata
2025-02-24 16:27 ` Ido Schimmel
2025-02-25 8:58 ` Petr Machata [this message]
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=877c5ejt69.fsf@nvidia.com \
--to=petrm@nvidia.com \
--cc=dsahern@gmail.com \
--cc=gnault@redhat.com \
--cc=idosch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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).