[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170828120724.53904cbf@xeon-e3>
Date: Mon, 28 Aug 2017 12:07:24 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: David Lebrun <david.lebrun@...ouvain.be>
Cc: <netdev@...r.kernel.org>
Subject: Re: [PATCH iproute2 net-next 1/2] iproute: add support for seg6
l2encap mode
On Mon, 28 Aug 2017 20:05:24 +0100
David Lebrun <david.lebrun@...ouvain.be> wrote:
>
> +static const char *format_seg6mode_type(int mode)
> +{
> + if (mode == SEG6_IPTUN_MODE_ENCAP)
> + return "encap";
> + else if (mode == SEG6_IPTUN_MODE_INLINE)
> + return "inline";
> + else if (mode == SEG6_IPTUN_MODE_L2ENCAP)
> + return "l2encap";
> +
> + return "<unknown>";
> +}
> +
> +static int read_seg6mode_type(const char *mode)
> +{
> + if (strcmp(mode, "encap") == 0)
> + return SEG6_IPTUN_MODE_ENCAP;
> + else if (strcmp(mode, "inline") == 0)
> + return SEG6_IPTUN_MODE_INLINE;
> + else if (strcmp(mode, "l2encap") == 0)
> + return SEG6_IPTUN_MODE_L2ENCAP;
> +
> + return -1;
> +}
Since these values probably will grow over time, it would make
sense to have this a name/value table.
Powered by blists - more mailing lists