naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

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

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