]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
gre6/tunnel: Do not submit garbage in flowinfo
authorSerhey Popovych <serhe.popovych@gmail.com>
Wed, 27 Dec 2017 11:28:15 +0000 (13:28 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 27 Dec 2017 21:45:37 +0000 (13:45 -0800)
We always send flowinfo to the kernel. If flowlabel/tclass
was set first to non-inherit value and then reset to
inherit we do not clear flowlabel/tclass part in flowinfo,
send it to kernel and can get from the kernel back.

Even if we check for IP6_TNL_F_USE_ORIG_TCLASS and
IP6_TNL_F_USE_ORIG_FLOWLABEL when printing options
sending invalid flowlabel/tclass to the kernel seems
bad idea.

Note that ip6tnl always clean corresponding flowinfo
parts on inherit.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
ip/link_gre6.c

index a3e8e088378ed11c060ede62c789aa59b695e0a7..7ae4b4924433fac408dece8e3676039563a726b9 100644 (file)
@@ -251,12 +251,12 @@ get_failed:
                        __u8 uval;
 
                        NEXT_ARG();
+                       flowinfo &= ~IP6_FLOWINFO_TCLASS;
                        if (strcmp(*argv, "inherit") == 0)
                                flags |= IP6_TNL_F_USE_ORIG_TCLASS;
                        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;
                        }
@@ -265,6 +265,7 @@ get_failed:
                        __u32 uval;
 
                        NEXT_ARG();
+                       flowinfo &= ~IP6_FLOWINFO_FLOWLABEL;
                        if (strcmp(*argv, "inherit") == 0)
                                flags |= IP6_TNL_F_USE_ORIG_FLOWLABEL;
                        else {
@@ -272,7 +273,6 @@ 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;
                        }