[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231120133037.7b86ec78@hermes.local>
Date: Mon, 20 Nov 2023 13:30:37 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: razor@...ckwall.org, martin.lau@...nel.org, dsahern@...nel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH iproute2 v2] ip, link: Add support for netkit
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]);
Powered by blists - more mailing lists