[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a80c8fba-bf66-93ef-c54e-6648b3522e28@gmail.com>
Date: Tue, 5 Oct 2021 08:12:27 -0600
From: David Ahern <dsahern@...il.com>
To: Justin Iurman <justin.iurman@...ege.be>, netdev@...r.kernel.org
Cc: davem@...emloft.net, dsahern@...nel.org, stephen@...workplumber.org
Subject: Re: [PATCH iproute2-next 1/2] Add support for IOAM encap modes
On 10/4/21 7:06 AM, Justin Iurman wrote:
> diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
> index 218d5086..3641f9ef 100644
> --- a/ip/iproute_lwtunnel.c
> +++ b/ip/iproute_lwtunnel.c
> @@ -210,16 +210,54 @@ static void print_encap_rpl(FILE *fp, struct rtattr *encap)
> print_rpl_srh(fp, srh);
> }
>
> +static const char *ioam6_mode_types[] = {
I think you want to declare this of size IOAM6_IPTUNNEL_MODE_MAX + 1
> + [IOAM6_IPTUNNEL_MODE_INLINE] = "inline",
> + [IOAM6_IPTUNNEL_MODE_ENCAP] = "encap",
> + [IOAM6_IPTUNNEL_MODE_AUTO] = "auto",
> +};
> +
> +static const char *format_ioam6mode_type(int mode)
> +{
> + if (mode < IOAM6_IPTUNNEL_MODE_MIN ||
> + mode > IOAM6_IPTUNNEL_MODE_MAX ||
> + !ioam6_mode_types[mode])
otherwise this check is not sufficient.
> + return "<unknown>";
> +
> + return ioam6_mode_types[mode];
> +}
> +
Powered by blists - more mailing lists