[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADvbK_eVkpGnJj5mQ19bXp+kzx0m9VSDfeMr09Fyp5jDk8FmAQ@mail.gmail.com>
Date: Mon, 10 Feb 2020 14:09:17 +0800
From: Xin Long <lucien.xin@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: network dev <netdev@...r.kernel.org>,
Simon Horman <simon.horman@...ronome.com>,
Pieter Jansen van Vuuren
<pieter.jansenvanvuuren@...ronome.com>
Subject: Re: [PATCH iproute2-next 2/7] iproute_lwtunnel: add options support
for vxlan metadata
On Wed, Feb 5, 2020 at 8:22 PM Stephen Hemminger
<stephen@...workplumber.org> wrote:
>
> On Mon, 3 Feb 2020 13:39:53 +0800
> Xin Long <lucien.xin@...il.com> wrote:
>
> > +static void lwtunnel_print_vxlan_opts(struct rtattr *attr, char *opt)
> > +{
> > + struct rtattr *tb[LWTUNNEL_IP_OPT_VXLAN_MAX + 1];
> > + __u32 gbp;
> > +
> > + parse_rtattr(tb, LWTUNNEL_IP_OPT_VXLAN_MAX, RTA_DATA(attr),
> > + RTA_PAYLOAD(attr));
> > + gbp = rta_getattr_u32(tb[LWTUNNEL_IP_OPT_VXLAN_GBP]);
> > + sprintf(opt, "%x", gbp);
> > + print_string(PRINT_FP, "enc_opt", "\n vxlan_opts %s ", opt);
>
> You need to handle single line mode and JSON.
>
> Proper way is something like:
>
> print_nl();
> print_0xhex(PRINT_ANY, "enc_opt", " vxlan_opts %#x", gpb);
>
yeah, right, didn't notice that, thanks.
> Also, why the hex format, this is a an opaque user interface?
>
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|G|R|R|R|I|R|R|R|R|D|R|R|A|R|R|R| Group Policy ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
This is the gbp field in vxlan header, defined in:
https://tools.ietf.org/html/draft-smith-vxlan-group-policy-05
I think 'hex' makes it clearer than decimal to see which bit is set
for users, no?
Powered by blists - more mailing lists