From 7c616155a7a86024a60cc39e9b3e6981c4c9e7e2 Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Fri, 17 Mar 2017 13:24:36 +0100
Subject: [PATCH] f_flower: don't set TCA_FLOWER_KEY_ETH_TYPE for "protocol
all"
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1422629
Upstream Status: iproute2.git commit 4f7d406f5dc89
Conflicts: Context change due to already backported commit 08f66c80c094e
("tc: flower: Refactor matching flags to be more user
friendly").
commit 4f7d406f5dc89229d8aec8b723015c06db343e17
Author: Benjamin LaHaise <benjamin.lahaise@netronome.com>
Date: Fri Jan 20 14:07:38 2017 -0500
f_flower: don't set TCA_FLOWER_KEY_ETH_TYPE for "protocol all"
v2 - update to address changes in 00697ca19ae3e1118f2af82c3b41ac4335fe918b.
When using the tc flower filter, 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.
Fixes: 488b41d020fb ("tc: flower no need to specify the ethertype")
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Benjamin LaHaise <benjamin.lahaise@netronome.com>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
tc/f_flower.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tc/f_flower.c b/tc/f_flower.c
index ddf64c2..58a34ce 100644
--- a/tc/f_flower.c
+++ b/tc/f_flower.c
@@ -770,9 +770,11 @@ parse_done:
return ret;
}
- ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type);
- if (ret)
- return ret;
+ if (eth_type != htons(ETH_P_ALL)) {
+ ret = addattr16(n, MAX_MSG, TCA_FLOWER_KEY_ETH_TYPE, eth_type);
+ if (ret)
+ return ret;
+ }
tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail;
--
1.8.3.1