[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170119215159.GA32126@nvt-d.home.kvack.org>
Date: Thu, 19 Jan 2017 16:51:59 -0500
From: Benjamin LaHaise <benjamin.lahaise@...ronome.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org, bcrl@...ck.org
Subject: [PATCH iproute2] f_flower: don't set TCA_FLOWER_KEY_ETH_TYPE for
"protocol all"
When using the tc filter flower, rules marked with "protocol all" do not
actually match all packets. This is due to a bug in f_flower.c that passes
in ETH_P_ALL in the TCA_FLOWER_KEY_ETH_TYPE attribute when adding a rule.
Fix this by omitting TCA_FLOWER_KEY_ETH_TYPE if the protocol is set to
ETH_P_ALL.
Signed-off-by: Benjamin LaHaise <benjamin.lahaise@...ronome.com>
Signed-off-by: Benjamin LaHaise <bcrl@...ck.org>
diff --git a/tc/f_flower.c b/tc/f_flower.c
index 1dbc532..1f90da3 100644
--- a/tc/f_flower.c
+++ b/tc/f_flower.c
@@ -527,11 +527,13 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
parse_done:
addattr32(n, MAX_MSG, TCA_FLOWER_FLAGS, flags);
- ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type);
- if (ret) {
- fprintf(stderr, "Illegal \"eth_type\"(0x%x)\n",
- ntohs(eth_type));
- return -1;
+ if (eth_type != htons(ETH_P_ALL)) {
+ ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type);
+ if (ret) {
+ fprintf(stderr, "Illegal \"eth_type\"(0x%x)\n",
+ ntohs(eth_type));
+ return -1;
+ }
}
tail->rta_len = (((void *)n)+n->nlmsg_len) - (void *)tail;
Powered by blists - more mailing lists