]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
pedit: Do not allow using retain for too big fields
authorAmir Vadai <amir@vadai.me>
Sun, 14 May 2017 08:17:44 +0000 (11:17 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 15 May 2017 22:05:20 +0000 (15:05 -0700)
Using retain for fields longer than 32 bits is not supported.
Do not allow user to do it.

Signed-off-by: Amir Vadai <amir@vadai.me>
man/man8/tc-pedit.8
tc/m_pedit.c

index 7f482eafc6c71a4fd0fd7389f4a5f4ef6cd4f258..9c4d57b972cc83c38ad0cd9289d04e1af69042ce 100644 (file)
@@ -266,7 +266,8 @@ Keep the addressed data as is.
 .BI retain " RVAL"
 This optional extra part of
 .I CMD_SPEC
-allows to exclude bits from being changed.
+allows to exclude bits from being changed. Supported only for 32 bits fields
+or smaller.
 .TP
 .I CONTROL
 The following keywords allow to control how the tree of qdisc, classes,
index 7ef2acc52bce5deb8eee8b69f3e5a4fff40fc1d9..9b74c965932e0ef545ddcde016f18cb852dcdbc7 100644 (file)
@@ -353,6 +353,12 @@ int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type, __u32 retain,
                argv++;
        }
 
+       if (len > 4 && retain != ~0) {
+               fprintf(stderr,
+                       "retain is not supported for fields longer the 32 bits\n");
+               return -1;
+       }
+
        if (type == TMAC) {
                res = pack_mac(sel, tkey, (__u8 *)val);
                goto done;