naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

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

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