naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

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

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