All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2] tc: m_tunnel_key: fix geneve opt output
@ 2020-06-18 10:44 Hangbin Liu
  2020-06-18 10:51 ` Simon Horman
  2020-06-18 11:25 ` Davide Caratti
  0 siblings, 2 replies; 6+ messages in thread
From: Hangbin Liu @ 2020-06-18 10:44 UTC (permalink / raw)
  To: netdev
  Cc: Davide Caratti, lucien.xin, Simon Horman, Stephen Hemminger, Hangbin Liu

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@gmail.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];
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] tc: m_tunnel_key: fix geneve opt output
  2020-06-18 10:44 [PATCH iproute2] tc: m_tunnel_key: fix geneve opt output Hangbin Liu
@ 2020-06-18 10:51 ` Simon Horman
  2020-06-19  2:25   ` Hangbin Liu
  2020-06-18 11:25 ` Davide Caratti
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Horman @ 2020-06-18 10:51 UTC (permalink / raw)
  To: Hangbin Liu; +Cc: netdev, Davide Caratti, lucien.xin, Stephen Hemminger

On Thu, Jun 18, 2020 at 06:44:20PM +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@gmail.com>

Thanks Hangbin.

I agree that the patch in question did change the name of the option
as you describe, perhaps inadvertently. But I wonder if perhaps this fix
is too simple as the patch mentioned also:

1. Documents the option as geneve_opts
2. Adds vxlan_opts

So this patch invalidates the documentation and creates asymmetry between
the VXLAN and Geneve variants of this feature.

Another problem is that any user of geneve_opts will break.

Perhaps a way out of this mess is to:
1. make geneve_opt an alias for geneve_opts (i.e. two names for the same
   thing)
2. Document geneve_opt, possibly marking it as deprecated.

> ---
>  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];
> -- 
> 2.25.4
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] tc: m_tunnel_key: fix geneve opt output
  2020-06-18 10:44 [PATCH iproute2] tc: m_tunnel_key: fix geneve opt output Hangbin Liu
  2020-06-18 10:51 ` Simon Horman
@ 2020-06-18 11:25 ` Davide Caratti
  2020-06-19  2:29   ` Hangbin Liu
  1 sibling, 1 reply; 6+ messages in thread
From: Davide Caratti @ 2020-06-18 11:25 UTC (permalink / raw)
  To: Hangbin Liu, netdev; +Cc: lucien.xin, Simon Horman, Stephen Hemminger

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@gmail.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

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").

-- 
davide



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] tc: m_tunnel_key: fix geneve opt output
  2020-06-18 10:51 ` Simon Horman
@ 2020-06-19  2:25   ` Hangbin Liu
  2020-06-19  6:56     ` Simon Horman
  0 siblings, 1 reply; 6+ messages in thread
From: Hangbin Liu @ 2020-06-19  2:25 UTC (permalink / raw)
  To: Simon Horman; +Cc: netdev, Davide Caratti, lucien.xin, Stephen Hemminger

On Thu, Jun 18, 2020 at 12:51:08PM +0200, Simon Horman wrote:
> On Thu, Jun 18, 2020 at 06:44:20PM +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@gmail.com>
> 
> Thanks Hangbin.
> 
> I agree that the patch in question did change the name of the option
> as you describe, perhaps inadvertently. But I wonder if perhaps this fix
> is too simple as the patch mentioned also:
> 
> 1. Documents the option as geneve_opts
> 2. Adds vxlan_opts
> 
> So this patch invalidates the documentation and creates asymmetry between
> the VXLAN and Geneve variants of this feature.

Not sure if I understand you comment correctly. This patch only fix the cmd
output(revert to previous output format), The cmd option is not changed. e.g.

# tc actions add action tunnel_key set src_ip 1.1.1.1 dst_ip 2.2.2.2 id 42 \
     dst_port 6081 geneve_opts 0102:80:00880022 index 1
# tc actions get action tunnel_key index 1
total acts 0

        action order 1: tunnel_key  set
        src_ip 1.1.1.1
        dst_ip 2.2.2.2
        key_id 42
        dst_port 6081
        geneve_opt 0102:80:00880022
        csum pipe
         index 1 ref 1 bind 0

But this do make a asymmetry for vxlan and geneve output. I prefer
to let them consistent personally. Also it looks more reasonable
to output "geneve_opts" when we have parameter geneve_opts.

So I'm not going to fix it in iproute, but do as Davide mentioned, make
tdc test case accept both 'geneve_opts' and 'geneve_opt'.

Thanks
Hangbin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] tc: m_tunnel_key: fix geneve opt output
  2020-06-18 11:25 ` Davide Caratti
@ 2020-06-19  2:29   ` Hangbin Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Hangbin Liu @ 2020-06-19  2:29 UTC (permalink / raw)
  To: Davide Caratti; +Cc: netdev, lucien.xin, Simon Horman, Stephen Hemminger

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@gmail.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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] tc: m_tunnel_key: fix geneve opt output
  2020-06-19  2:25   ` Hangbin Liu
@ 2020-06-19  6:56     ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2020-06-19  6:56 UTC (permalink / raw)
  To: Hangbin Liu; +Cc: netdev, Davide Caratti, lucien.xin, Stephen Hemminger

On Fri, Jun 19, 2020 at 10:25:24AM +0800, Hangbin Liu wrote:
> On Thu, Jun 18, 2020 at 12:51:08PM +0200, Simon Horman wrote:
> > On Thu, Jun 18, 2020 at 06:44:20PM +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@gmail.com>
> > 
> > Thanks Hangbin.
> > 
> > I agree that the patch in question did change the name of the option
> > as you describe, perhaps inadvertently. But I wonder if perhaps this fix
> > is too simple as the patch mentioned also:
> > 
> > 1. Documents the option as geneve_opts
> > 2. Adds vxlan_opts
> > 
> > So this patch invalidates the documentation and creates asymmetry between
> > the VXLAN and Geneve variants of this feature.
> 
> Not sure if I understand you comment correctly. This patch only fix the cmd
> output(revert to previous output format), The cmd option is not changed. e.g.
> 
> # tc actions add action tunnel_key set src_ip 1.1.1.1 dst_ip 2.2.2.2 id 42 \
>      dst_port 6081 geneve_opts 0102:80:00880022 index 1
> # tc actions get action tunnel_key index 1
> total acts 0
> 
>         action order 1: tunnel_key  set
>         src_ip 1.1.1.1
>         dst_ip 2.2.2.2
>         key_id 42
>         dst_port 6081
>         geneve_opt 0102:80:00880022
>         csum pipe
>          index 1 ref 1 bind 0
> 
> But this do make a asymmetry for vxlan and geneve output. I prefer
> to let them consistent personally. Also it looks more reasonable
> to output "geneve_opts" when we have parameter geneve_opts.
> 
> So I'm not going to fix it in iproute, but do as Davide mentioned, make
> tdc test case accept both 'geneve_opts' and 'geneve_opt'.

Thanks. I agree this seems to be the best way forward.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-19  6:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 10:44 [PATCH iproute2] tc: m_tunnel_key: fix geneve opt output Hangbin Liu
2020-06-18 10:51 ` Simon Horman
2020-06-19  2:25   ` Hangbin Liu
2020-06-19  6:56     ` Simon Horman
2020-06-18 11:25 ` Davide Caratti
2020-06-19  2:29   ` Hangbin Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.