From: Amir Vadai <amir@vadai.me>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
Amir Vadai <amir@vadai.me>
Subject: [PATCH iproute2 master 2/4] pedit: Do not allow using retain for too big fields
Date: Sun, 14 May 2017 11:17:44 +0300 [thread overview]
Message-ID: <20170514081746.9010-3-amir@vadai.me> (raw)
In-Reply-To: <20170514081746.9010-1-amir@vadai.me>
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 | 3 ++-
tc/m_pedit.c | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/man/man8/tc-pedit.8 b/man/man8/tc-pedit.8
index 7f482eafc6c7..9c4d57b972cc 100644
--- a/man/man8/tc-pedit.8
+++ b/man/man8/tc-pedit.8
@@ -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,
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index 7ef2acc52bce..9b74c965932e 100644
--- a/tc/m_pedit.c
+++ b/tc/m_pedit.c
@@ -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;
--
2.12.2
next prev parent reply other threads:[~2017-05-14 8:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-14 8:17 [PATCH iproute2 master 0/4] pedit: Introduce IPv6 support + some minor fixes Amir Vadai
2017-05-14 8:17 ` [PATCH iproute2 master 1/4] pedit: Fix a typo in warning Amir Vadai
2017-05-14 8:17 ` Amir Vadai [this message]
2017-05-14 8:17 ` [PATCH iproute2 master 3/4] pedit: Check for extended capability in protocol parser Amir Vadai
2017-05-14 8:17 ` [PATCH iproute2 master 4/4] pedit: Introduce ipv6 support Amir Vadai
2017-05-15 22:06 ` [PATCH iproute2 master 0/4] pedit: Introduce IPv6 support + some minor fixes Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170514081746.9010-3-amir@vadai.me \
--to=amir@vadai.me \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox