From: Phil Sutter Date: Fri, 1 Sep 2017 14:08:08 +0000 (+0200) Subject: link_gre6: Fix for changing tclass/flowlabel X-Git-Tag: v4.13.0~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7fefb3214b5a1ed030cab9df513560c503a9851;p=thirdparty%2Fiproute2.git link_gre6: Fix for changing tclass/flowlabel 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 --- diff --git a/ip/link_gre6.c b/ip/link_gre6.c index 4d3d4b542..447ac5d78 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; }