public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
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 3/4] pedit: Check for extended capability in protocol parser
Date: Sun, 14 May 2017 11:17:45 +0300	[thread overview]
Message-ID: <20170514081746.9010-4-amir@vadai.me> (raw)
In-Reply-To: <20170514081746.9010-1-amir@vadai.me>

Do not allow using eth and udp header types if non-extended pedit kABI
is being used. Other protocol parsers already have this check.

Signed-off-by: Amir Vadai <amir@vadai.me>
---
 tc/p_eth.c | 3 +++
 tc/p_udp.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/tc/p_eth.c b/tc/p_eth.c
index ad3e28f80eb6..2d2f96ca2f0f 100644
--- a/tc/p_eth.c
+++ b/tc/p_eth.c
@@ -34,6 +34,9 @@ parse_eth(int *argc_p, char ***argv_p,
 	if (argc < 2)
 		return -1;
 
+	if (!sel->extended)
+		return -1;
+
 	tkey->htype = TCA_PEDIT_KEY_EX_HDR_TYPE_ETH;
 
 	if (strcmp(*argv, "type") == 0) {
diff --git a/tc/p_udp.c b/tc/p_udp.c
index a56a1b519254..3916d9586040 100644
--- a/tc/p_udp.c
+++ b/tc/p_udp.c
@@ -34,6 +34,9 @@ parse_udp(int *argc_p, char ***argv_p,
 	if (argc < 2)
 		return -1;
 
+	if (!sel->extended)
+		return -1;
+
 	tkey->htype = TCA_PEDIT_KEY_EX_HDR_TYPE_UDP;
 
 	if (strcmp(*argv, "sport") == 0) {
-- 
2.12.2

  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 ` [PATCH iproute2 master 2/4] pedit: Do not allow using retain for too big fields Amir Vadai
2017-05-14  8:17 ` Amir Vadai [this message]
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-4-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