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.laha...@netronome.com>
Signed-off-by: Benjamin LaHaise <b...@kvack.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;

Reply via email to