[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 19 Jun 2020 10:29:50 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Davide Caratti <dcaratti@...hat.com>
Cc: netdev@...r.kernel.org, lucien.xin@...il.com,
Simon Horman <simon.horman@...ronome.com>,
Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH iproute2] tc: m_tunnel_key: fix geneve opt output
On Thu, Jun 18, 2020 at 01:25:46PM +0200, Davide Caratti wrote:
> On Thu, 2020-06-18 at 18:44 +0800, Hangbin Liu wrote:
> > Commit f72c3ad00f3b changed the geneve option output from "geneve_opt"
> > to "geneve_opts", which may break the program compatibility. Reset
> > it back to geneve_opt.
> >
> > Fixes: f72c3ad00f3b ("tc: m_tunnel_key: add options support for vxlan")
> > Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> > ---
> > tc/m_tunnel_key.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tc/m_tunnel_key.c b/tc/m_tunnel_key.c
> > index bfec9072..0074f744 100644
> > --- a/tc/m_tunnel_key.c
> > +++ b/tc/m_tunnel_key.c
> > @@ -534,7 +534,7 @@ static void tunnel_key_print_geneve_options(struct rtattr *attr)
> > struct rtattr *i = RTA_DATA(attr);
> > int ii, data_len = 0, offset = 0;
> > int rem = RTA_PAYLOAD(attr);
> > - char *name = "geneve_opts";
> > + char *name = "geneve_opt";
> > char strbuf[rem * 2 + 1];
> > char data[rem * 2 + 1];
> > uint8_t data_r[rem];
>
> ... by the way, this patch does not look good to me. It fixes program
> compatibility for
>
> # tc action show
>
> but at the same time, I think it breaks program compatibility for
>
> # tc -j action show
Ah, sorry, I'm not familiar with json output and forgot to check it.
Thanks for the remind.
>
> see below: looking at commit f72c3ad00f3b,
>
> static void tunnel_key_print_tos_ttl(FILE *f, char *name,
> @@ -519,8 +586,7 @@ static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg)
> tb[TCA_TUNNEL_KEY_ENC_KEY_ID]);
> tunnel_key_print_dst_port(f, "dst_port",
> tb[TCA_TUNNEL_KEY_ENC_DST_PORT]);
> - tunnel_key_print_key_opt("geneve_opts",
> - tb[TCA_TUNNEL_KEY_ENC_OPTS]);
> + tunnel_key_print_key_opt(tb[TCA_TUNNEL_KEY_ENC_OPTS])
>
> here "name" was "geneve_opts", with the 's', and it was used here:
>
> open_json_array(PRINT_JSON, name);
>
> so, the proper way to restore script compatibility is to do something
> like:
>
> - print_string(PRINT_FP, name, "\t%s ", name);
> + print_string(PRINT_FP, NULL, "\t%s ", "geneve_opt");
>
> yes, we can "harmonize" like Simon proposed, but then the fix in the
> (currently broken) tdc test case should accept both 'geneve_opts' and
> 'geneve_opt'. Something similar has been done in the past for act_ife
> see net.git commit 91fa038d9446 ("selftests: tc-testing: fix parsing of
> ife type").
>From semantics, it looks more reasonable to output "geneve_opts" as the
parameter is "geneve_opts", which is also symmetry with vxlan.
So I'm going to fix the tdc to accept both 'geneve_opts' and 'geneve_opt'.
Thanks
Hangbin
Powered by blists - more mailing lists