naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

Blame SOURCES/0016-link_gre6-Fix-for-changing-tclass-flowlabel.patch

36cfb7
From 449517f7769dde4905564ce17e126bfd4e1f7147 Mon Sep 17 00:00:00 2001
36cfb7
From: Phil Sutter <psutter@redhat.com>
36cfb7
Date: Fri, 6 Oct 2017 17:27:09 +0200
36cfb7
Subject: [PATCH] link_gre6: Fix for changing tclass/flowlabel
36cfb7
36cfb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1487486
36cfb7
Upstream Status: iproute2.git commit e7fefb3214b5a
36cfb7
36cfb7
commit e7fefb3214b5a1ed030cab9df513560c503a9851
36cfb7
Author: Phil Sutter <phil@nwl.cc>
36cfb7
Date:   Fri Sep 1 16:08:08 2017 +0200
36cfb7
36cfb7
    link_gre6: Fix for changing tclass/flowlabel
36cfb7
36cfb7
    When trying to change tclass or flowlabel of a GREv6 tunnel which has
36cfb7
    the respective value set already, the code accidentally bitwise OR'ed
36cfb7
    the old and the new value, leading to unexpected results. Fix this by
36cfb7
    clearing the relevant bits of flowinfo variable prior to assigning the
36cfb7
    new value.
36cfb7
36cfb7
    Fixes: af89576d7a8c4 ("iproute2: GRE over IPv6 tunnel support.")
36cfb7
    Signed-off-by: Phil Sutter <phil@nwl.cc>
36cfb7
---
36cfb7
 ip/link_gre6.c | 2 ++
36cfb7
 1 file changed, 2 insertions(+)
36cfb7
36cfb7
diff --git a/ip/link_gre6.c b/ip/link_gre6.c
e138d9
index 76416b26ff0e9..fe3ab641a86c2 100644
36cfb7
--- a/ip/link_gre6.c
36cfb7
+++ b/ip/link_gre6.c
36cfb7
@@ -282,6 +282,7 @@ get_failed:
36cfb7
 			else {
36cfb7
 				if (get_u8(&uval, *argv, 16))
36cfb7
 					invarg("invalid TClass", *argv);
36cfb7
+				flowinfo &= ~IP6_FLOWINFO_TCLASS;
36cfb7
 				flowinfo |= htonl((__u32)uval << 20) & IP6_FLOWINFO_TCLASS;
36cfb7
 				flags &= ~IP6_TNL_F_USE_ORIG_TCLASS;
36cfb7
 			}
36cfb7
@@ -297,6 +298,7 @@ get_failed:
36cfb7
 					invarg("invalid Flowlabel", *argv);
36cfb7
 				if (uval > 0xFFFFF)
36cfb7
 					invarg("invalid Flowlabel", *argv);
36cfb7
+				flowinfo &= ~IP6_FLOWINFO_FLOWLABEL;
36cfb7
 				flowinfo |= htonl(uval) & IP6_FLOWINFO_FLOWLABEL;
36cfb7
 				flags &= ~IP6_TNL_F_USE_ORIG_FLOWLABEL;
36cfb7
 			}
36cfb7
-- 
e138d9
2.21.0
36cfb7