[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8d172a00-00a1-c636-4471-4b1a131a8975@iogearbox.net>
Date: Mon, 20 Nov 2023 23:05:31 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: David Ahern <dsahern@...nel.org>,
Stephen Hemminger <stephen@...workplumber.org>
Cc: razor@...ckwall.org, martin.lau@...nel.org, netdev@...r.kernel.org
Subject: Re: [PATCH iproute2 v2] ip, link: Add support for netkit
On 11/20/23 10:40 PM, David Ahern wrote:
> On 11/20/23 1:30 PM, Stephen Hemminger wrote:
>> On Mon, 20 Nov 2023 22:10:54 +0100
>> Daniel Borkmann <daniel@...earbox.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
Ok, fair, will add.
Thanks,
Daniel
Powered by blists - more mailing lists