naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

Blame SOURCES/0076-iproute_lwtunnel-csum_mode-value-checking-was-ineffe.patch

99be8f
From db11067fb37cc3a77cc70fb9233a454102c4854c Mon Sep 17 00:00:00 2001
99be8f
From: Andrea Claudi <aclaudi@redhat.com>
99be8f
Date: Mon, 29 Apr 2019 20:05:38 +0200
99be8f
Subject: [PATCH] iproute_lwtunnel: csum_mode value checking was ineffective
99be8f
99be8f
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
99be8f
Upstream Status: iproute2.git commit 08806fb0191e9
99be8f
Conflicts: adjust rta_addattr8() call to handle return value
99be8f
99be8f
commit 08806fb0191e9ee8769507dc93b722fd021feb34
99be8f
Author: Phil Sutter <phil@nwl.cc>
99be8f
Date:   Thu Aug 17 19:09:30 2017 +0200
99be8f
99be8f
    iproute_lwtunnel: csum_mode value checking was ineffective
99be8f
99be8f
    ila_csum_name2mode() returning -1 on error but being declared as
99be8f
    returning __u8 doesn't make much sense. Change the code to correctly
99be8f
    detect this issue. Checking for __u8 overruns shouldn't be necessary
99be8f
    though since ila_csum_name2mode() return values are well-defined.
99be8f
99be8f
    Signed-off-by: Phil Sutter <phil@nwl.cc>
99be8f
---
99be8f
 ip/iproute_lwtunnel.c | 8 ++++----
99be8f
 1 file changed, 4 insertions(+), 4 deletions(-)
99be8f
99be8f
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
99be8f
index 92ea2c87787ec..5da3a1b488cbd 100644
99be8f
--- a/ip/iproute_lwtunnel.c
99be8f
+++ b/ip/iproute_lwtunnel.c
99be8f
@@ -125,7 +125,7 @@ static char *ila_csum_mode2name(__u8 csum_mode)
99be8f
 	}
99be8f
 }
99be8f
 
99be8f
-static __u8 ila_csum_name2mode(char *name)
99be8f
+static int ila_csum_name2mode(char *name)
99be8f
 {
99be8f
 	if (strcmp(name, "adj-transport") == 0)
99be8f
 		return ILA_CSUM_ADJUST_TRANSPORT;
99be8f
@@ -348,7 +348,7 @@ static int parse_encap_ila(struct rtattr *rta, size_t len,
99be8f
 
99be8f
 	while (argc > 0) {
99be8f
 		if (strcmp(*argv, "csum-mode") == 0) {
99be8f
-			__u8 csum_mode;
99be8f
+			int csum_mode;
99be8f
 
99be8f
 			NEXT_ARG();
99be8f
 
99be8f
@@ -357,8 +357,8 @@ static int parse_encap_ila(struct rtattr *rta, size_t len,
99be8f
 				invarg("\"csum-mode\" value is invalid\n",
99be8f
 				       *argv);
99be8f
 
99be8f
-			ret = rta_addattr8(rta, len, ILA_ATTR_CSUM_MODE,
99be8f
-					   (__u8)csum_mode);
99be8f
+			ret = rta_addattr8(rta, 1024, ILA_ATTR_CSUM_MODE,
99be8f
+				     (__u8)csum_mode);
99be8f
 
99be8f
 			argc--; argv++;
99be8f
 		} else {
99be8f
-- 
d30c09
2.21.0
99be8f