netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [iproute PATCH 0/2] Fix and enhance link_gre6
@ 2017-09-01 14:08 Phil Sutter
  2017-09-01 14:08 ` [iproute PATCH 1/2] link_gre6: Fix for changing tclass/flowlabel Phil Sutter
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Phil Sutter @ 2017-09-01 14:08 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Changing a tunnel's flowlabel value was broken if it was set to a
non-zero value before. Since the same problem existed for tclass, patch
1 fixes both instances at once.

Patch 2 enhances 'ip link show' to also print the tclass value. This
change was necessary to properly test the first patch's result.

Phil Sutter (2):
  link_gre6: Fix for changing tclass/flowlabel
  link_gre6: Print the tunnel's tclass setting

 ip/link_gre6.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

-- 
2.13.1

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

* [iproute PATCH 1/2] link_gre6: Fix for changing tclass/flowlabel
  2017-09-01 14:08 [iproute PATCH 0/2] Fix and enhance link_gre6 Phil Sutter
@ 2017-09-01 14:08 ` Phil Sutter
  2017-09-01 14:08 ` [iproute PATCH 2/2] link_gre6: Print the tunnel's tclass setting Phil Sutter
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Phil Sutter @ 2017-09-01 14:08 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

When trying to change tclass or flowlabel of a GREv6 tunnel which has
the respective value set already, the code accidentally bitwise OR'ed
the old and the new value, leading to unexpected results. Fix this by
clearing the relevant bits of flowinfo variable prior to assigning the
new value.

Fixes: af89576d7a8c4 ("iproute2: GRE over IPv6 tunnel support.")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 ip/link_gre6.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ip/link_gre6.c b/ip/link_gre6.c
index 4d3d4b54210b9..447ac5d78ab7b 100644
--- a/ip/link_gre6.c
+++ b/ip/link_gre6.c
@@ -288,6 +288,7 @@ get_failed:
 			else {
 				if (get_u8(&uval, *argv, 16))
 					invarg("invalid TClass", *argv);
+				flowinfo &= ~IP6_FLOWINFO_TCLASS;
 				flowinfo |= htonl((__u32)uval << 20) & IP6_FLOWINFO_TCLASS;
 				flags &= ~IP6_TNL_F_USE_ORIG_TCLASS;
 			}
@@ -303,6 +304,7 @@ get_failed:
 					invarg("invalid Flowlabel", *argv);
 				if (uval > 0xFFFFF)
 					invarg("invalid Flowlabel", *argv);
+				flowinfo &= ~IP6_FLOWINFO_FLOWLABEL;
 				flowinfo |= htonl(uval) & IP6_FLOWINFO_FLOWLABEL;
 				flags &= ~IP6_TNL_F_USE_ORIG_FLOWLABEL;
 			}
-- 
2.13.1

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

* [iproute PATCH 2/2] link_gre6: Print the tunnel's tclass setting
  2017-09-01 14:08 [iproute PATCH 0/2] Fix and enhance link_gre6 Phil Sutter
  2017-09-01 14:08 ` [iproute PATCH 1/2] link_gre6: Fix for changing tclass/flowlabel Phil Sutter
@ 2017-09-01 14:08 ` Phil Sutter
  2017-09-01 19:10 ` [iproute PATCH 0/2] Fix and enhance link_gre6 Stephen Hemminger
  2017-09-01 19:13 ` Stephen Hemminger
  3 siblings, 0 replies; 6+ messages in thread
From: Phil Sutter @ 2017-09-01 14:08 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Print the value analogous to flowlabel. While being at it, also break
the overlong lines to not exceed 80 characters boundary.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 ip/link_gre6.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ip/link_gre6.c b/ip/link_gre6.c
index 447ac5d78ab7b..78b5215c65037 100644
--- a/ip/link_gre6.c
+++ b/ip/link_gre6.c
@@ -462,7 +462,14 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 	if (flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)
 		fprintf(f, "flowlabel inherit ");
 	else
-		fprintf(f, "flowlabel 0x%05x ", ntohl(flowinfo & IP6_FLOWINFO_FLOWLABEL));
+		fprintf(f, "flowlabel 0x%05x ",
+			ntohl(flowinfo & IP6_FLOWINFO_FLOWLABEL));
+
+	if (flags & IP6_TNL_F_USE_ORIG_TCLASS)
+		fprintf(f, "tclass inherit ");
+	else
+		fprintf(f, "tclass 0x%02x ",
+			ntohl(flowinfo & IP6_FLOWINFO_TCLASS) >> 20);
 
 	if (flags & IP6_TNL_F_RCV_DSCP_COPY)
 		fprintf(f, "dscp inherit ");
-- 
2.13.1

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

* Re: [iproute PATCH 0/2] Fix and enhance link_gre6
  2017-09-01 14:08 [iproute PATCH 0/2] Fix and enhance link_gre6 Phil Sutter
  2017-09-01 14:08 ` [iproute PATCH 1/2] link_gre6: Fix for changing tclass/flowlabel Phil Sutter
  2017-09-01 14:08 ` [iproute PATCH 2/2] link_gre6: Print the tunnel's tclass setting Phil Sutter
@ 2017-09-01 19:10 ` Stephen Hemminger
  2017-09-01 19:13 ` Stephen Hemminger
  3 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2017-09-01 19:10 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netdev

On Fri,  1 Sep 2017 16:08:07 +0200
Phil Sutter <phil@nwl.cc> wrote:

> Changing a tunnel's flowlabel value was broken if it was set to a
> non-zero value before. Since the same problem existed for tclass, patch
> 1 fixes both instances at once.
> 
> Patch 2 enhances 'ip link show' to also print the tclass value. This
> change was necessary to properly test the first patch's result.
> 
> Phil Sutter (2):
>   link_gre6: Fix for changing tclass/flowlabel
>   link_gre6: Print the tunnel's tclass setting
> 
>  ip/link_gre6.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 

Applied, thanks.

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

* Re: [iproute PATCH 0/2] Fix and enhance link_gre6
  2017-09-01 14:08 [iproute PATCH 0/2] Fix and enhance link_gre6 Phil Sutter
                   ` (2 preceding siblings ...)
  2017-09-01 19:10 ` [iproute PATCH 0/2] Fix and enhance link_gre6 Stephen Hemminger
@ 2017-09-01 19:13 ` Stephen Hemminger
  2017-09-01 20:42   ` Phil Sutter
  3 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2017-09-01 19:13 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netdev

On Fri,  1 Sep 2017 16:08:07 +0200
Phil Sutter <phil@nwl.cc> wrote:

> Changing a tunnel's flowlabel value was broken if it was set to a
> non-zero value before. Since the same problem existed for tclass, patch
> 1 fixes both instances at once.
> 
> Patch 2 enhances 'ip link show' to also print the tclass value. This
> change was necessary to properly test the first patch's result.
> 
> Phil Sutter (2):
>   link_gre6: Fix for changing tclass/flowlabel
>   link_gre6: Print the tunnel's tclass setting
> 
>  ip/link_gre6.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 

This doesn't work with net-next where json has been added.
I fixing it now

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

* Re: [iproute PATCH 0/2] Fix and enhance link_gre6
  2017-09-01 19:13 ` Stephen Hemminger
@ 2017-09-01 20:42   ` Phil Sutter
  0 siblings, 0 replies; 6+ messages in thread
From: Phil Sutter @ 2017-09-01 20:42 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Hi Stephen,

On Fri, Sep 01, 2017 at 12:13:33PM -0700, Stephen Hemminger wrote:
> On Fri,  1 Sep 2017 16:08:07 +0200
> Phil Sutter <phil@nwl.cc> wrote:
> 
> > Changing a tunnel's flowlabel value was broken if it was set to a
> > non-zero value before. Since the same problem existed for tclass, patch
> > 1 fixes both instances at once.
> > 
> > Patch 2 enhances 'ip link show' to also print the tclass value. This
> > change was necessary to properly test the first patch's result.
> > 
> > Phil Sutter (2):
> >   link_gre6: Fix for changing tclass/flowlabel
> >   link_gre6: Print the tunnel's tclass setting
> > 
> >  ip/link_gre6.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> 
> This doesn't work with net-next where json has been added.
> I fixing it now

Oh, thanks for that. I'm not used to having different states in master
and net-next. :)

Cheers, Phil

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

end of thread, other threads:[~2017-09-01 20:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-01 14:08 [iproute PATCH 0/2] Fix and enhance link_gre6 Phil Sutter
2017-09-01 14:08 ` [iproute PATCH 1/2] link_gre6: Fix for changing tclass/flowlabel Phil Sutter
2017-09-01 14:08 ` [iproute PATCH 2/2] link_gre6: Print the tunnel's tclass setting Phil Sutter
2017-09-01 19:10 ` [iproute PATCH 0/2] Fix and enhance link_gre6 Stephen Hemminger
2017-09-01 19:13 ` Stephen Hemminger
2017-09-01 20:42   ` Phil Sutter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).