[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200205042239.322cc844@shemminger-XPS-13-9360>
Date: Wed, 5 Feb 2020 04:22:39 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Xin Long <lucien.xin@...il.com>
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 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);
Also, why the hex format, this is a an opaque user interface?
Powered by blists - more mailing lists