From: David Ahern <dsahern@kernel.org>
To: Stephen Hemminger <stephen@networkplumber.org>,
Daniel Borkmann <daniel@iogearbox.net>
Cc: razor@blackwall.org, martin.lau@kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2 v2] ip, link: Add support for netkit
Date: Mon, 20 Nov 2023 13:40:42 -0800 [thread overview]
Message-ID: <40a74dfd-e7cf-46fc-9c79-517ce2d6c51b@kernel.org> (raw)
In-Reply-To: <20231120133037.7b86ec78@hermes.local>
On 11/20/23 1:30 PM, Stephen Hemminger wrote:
> On Mon, 20 Nov 2023 22:10:54 +0100
> Daniel Borkmann <daniel@iogearbox.net> wrote:
>
>> +static void netkit_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
>> +{
>> + if (!tb)
>> + return;
>> + if (tb[IFLA_NETKIT_MODE]) {
>> + __u32 mode = rta_getattr_u32(tb[IFLA_NETKIT_MODE]);
>> +
>> + print_string(PRINT_ANY, "mode", "mode %s ",
>> + netkit_mode_strings[mode]);
>
> What if kernel adds a new mode in future?
> Probably want something like:
>
> print_string(PRINT_ANY, "mode", "mode %s ",
> mode >= ARRAY_SIZE(netkit_mode_strings) ? "UNKNOWN" : netkit_mode_strings[mode]);
that is why I asked for a table driven helper. Helper handles the mode
>= ARRAY_SIZE.
next prev parent reply other threads:[~2023-11-20 21:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 21:10 [PATCH iproute2 v2] ip, link: Add support for netkit Daniel Borkmann
2023-11-20 21:16 ` Nikolay Aleksandrov
2023-11-20 21:30 ` Stephen Hemminger
2023-11-20 21:40 ` David Ahern [this message]
2023-11-20 22:05 ` Daniel Borkmann
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=40a74dfd-e7cf-46fc-9c79-517ce2d6c51b@kernel.org \
--to=dsahern@kernel.org \
--cc=daniel@iogearbox.net \
--cc=martin.lau@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=razor@blackwall.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).