naccyde / rpms / iproute

Forked from rpms/iproute 5 months ago
Clone

Blame SOURCES/0029-pedit-Do-not-allow-using-retain-for-too-big-fields.patch

cd1737
From 2bf855b076bbe5aa4665f7efd8bcaf882821cab5 Mon Sep 17 00:00:00 2001
cd1737
From: Kamal Heib <kheib@redhat.com>
cd1737
Date: Thu, 9 Nov 2017 04:44:32 -0500
cd1737
Subject: [PATCH] pedit: Do not allow using retain for too big fields
cd1737
cd1737
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1456539
cd1737
cd1737
commit cdca191862775c47533908301760edd55763e861
cd1737
Author: Amir Vadai <amir@vadai.me>
cd1737
Date:   Sun May 14 11:17:44 2017 +0300
cd1737
cd1737
    pedit: Do not allow using retain for too big fields
cd1737
cd1737
    Using retain for fields longer than 32 bits is not supported.
cd1737
    Do not allow user to do it.
cd1737
cd1737
    Signed-off-by: Amir Vadai <amir@vadai.me>
cd1737
cd1737
Signed-off-by: Kamal Heib <kheib@redhat.com>
cd1737
---
cd1737
 man/man8/tc-pedit.8 | 3 ++-
cd1737
 tc/m_pedit.c        | 6 ++++++
cd1737
 2 files changed, 8 insertions(+), 1 deletion(-)
cd1737
cd1737
diff --git a/man/man8/tc-pedit.8 b/man/man8/tc-pedit.8
cd1737
index 7f482ea..9c4d57b 100644
cd1737
--- a/man/man8/tc-pedit.8
cd1737
+++ b/man/man8/tc-pedit.8
cd1737
@@ -266,7 +266,8 @@ Keep the addressed data as is.
cd1737
 .BI retain " RVAL"
cd1737
 This optional extra part of
cd1737
 .I CMD_SPEC
cd1737
-allows to exclude bits from being changed.
cd1737
+allows to exclude bits from being changed. Supported only for 32 bits fields
cd1737
+or smaller.
cd1737
 .TP
cd1737
 .I CONTROL
cd1737
 The following keywords allow to control how the tree of qdisc, classes,
cd1737
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
cd1737
index 7ef2acc..9b74c96 100644
cd1737
--- a/tc/m_pedit.c
cd1737
+++ b/tc/m_pedit.c
cd1737
@@ -353,6 +353,12 @@ int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type, __u32 retain,
cd1737
 		argv++;
cd1737
 	}
cd1737
 
cd1737
+	if (len > 4 && retain != ~0) {
cd1737
+		fprintf(stderr,
cd1737
+			"retain is not supported for fields longer the 32 bits\n");
cd1737
+		return -1;
cd1737
+	}
cd1737
+
cd1737
 	if (type == TMAC) {
cd1737
 		res = pack_mac(sel, tkey, (__u8 *)val);
cd1737
 		goto done;
cd1737
-- 
cd1737
1.8.3.1
cd1737