@@ -100,7 +100,9 @@ flower \- flow based traffic control filter
}
.IR OPTIONS " | "
.BR ip_flags
-.IR IP_FLAGS " }"
+.IR IP_FLAGS " | "
+.B l2_miss
+.IR L2_MISS " }"
.ti -8
.IR LSE_LIST " := [ " LSE_LIST " ] " LSE
@@ -493,6 +495,12 @@ respectively. firstfrag and nofirstfrag can be used to further distinguish
fragmented packet. firstfrag can be used to indicate the first fragmented
packet. nofirstfrag can be used to indicates subsequent fragmented packets
or non-fragmented packets.
+.TP
+.BI l2_miss " L2_MISS"
+Match on layer 2 miss in the bridge driver's FDB / MDB. \fIL2_MISS\fR may be 0
+or 1. When 1, match on packets that encountered a layer 2 miss. When 0, match
+on packets that were forwarded using an FDB / MDB entry. Note that broadcast
+packets do not encounter a miss since a lookup is not performed for them.
.SH NOTES
As stated above where applicable, matches of a certain layer implicitly depend
on the matches of the next lower layer. Precisely, layer one and two matches
@@ -91,6 +91,7 @@ static void explain(void)
" erspan_opts MASKED-OPTIONS |\n"
" gtp_opts MASKED-OPTIONS |\n"
" ip_flags IP-FLAGS |\n"
+ " l2_miss L2_MISS |\n"
" enc_dst_port [ port_number ] |\n"
" ct_state MASKED_CT_STATE |\n"
" ct_label MASKED_CT_LABEL |\n"
@@ -1520,6 +1521,15 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
fprintf(stderr, "Illegal \"ip_flags\"\n");
return -1;
}
+ } else if (strcmp(*argv, "l2_miss") == 0) {
+ __u8 l2_miss;
+
+ NEXT_ARG();
+ if (get_u8(&l2_miss, *argv, 10)) {
+ fprintf(stderr, "Illegal \"l2_miss\"\n");
+ return -1;
+ }
+ addattr8(n, MAX_MSG, TCA_FLOWER_L2_MISS, l2_miss);
} else if (matches(*argv, "verbose") == 0) {
flags |= TCA_CLS_FLAGS_VERBOSE;
} else if (matches(*argv, "skip_hw") == 0) {
@@ -2983,6 +2993,14 @@ static int flower_print_opt(struct filter_util *qu, FILE *f,
tb[TCA_FLOWER_KEY_FLAGS],
tb[TCA_FLOWER_KEY_FLAGS_MASK]);
+ if (tb[TCA_FLOWER_L2_MISS]) {
+ struct rtattr *attr = tb[TCA_FLOWER_L2_MISS];
+
+ print_nl();
+ print_uint(PRINT_ANY, "l2_miss", " l2_miss %u",
+ rta_getattr_u8(attr));
+ }
+
flower_print_ct_state(tb[TCA_FLOWER_KEY_CT_STATE],
tb[TCA_FLOWER_KEY_CT_STATE_MASK]);
flower_print_ct_zone(tb[TCA_FLOWER_KEY_CT_ZONE],
Add the ability to match on packets that encountered a layer 2 miss in bridge driver's FDB / MDB. Example: # tc filter add dev swp2 egress pref 1 proto all flower indev swp1 l2_miss 1 action drop # tc filter add dev swp2 egress pref 1 proto all flower indev swp1 l2_miss 0 action drop # tc filter show dev swp2 egress filter protocol all pref 1 flower chain 0 filter protocol all pref 1 flower chain 0 handle 0x1 indev swp1 l2_miss 1 not_in_hw action order 1: gact action drop random type none pass val 0 index 1 ref 1 bind 1 filter protocol all pref 1 flower chain 0 handle 0x2 indev swp1 l2_miss 0 not_in_hw action order 1: gact action drop random type none pass val 0 index 2 ref 1 bind 1 # tc -j -p filter show dev swp2 egress [ { "protocol": "all", "pref": 1, "kind": "flower", "chain": 0 },{ "protocol": "all", "pref": 1, "kind": "flower", "chain": 0, "options": { "handle": 1, "indev": "swp1", "keys": { "l2_miss": 1 }, "not_in_hw": true, "actions": [ { [...] } ] } },{ "protocol": "all", "pref": 1, "kind": "flower", "chain": 0, "options": { "handle": 2, "indev": "swp1", "keys": { "l2_miss": 0 }, "not_in_hw": true, "actions": [ { [...] } ] } } ] Signed-off-by: Ido Schimmel <idosch@nvidia.com> --- Notes: v2: * Use '%u' instead of '%d'. man/man8/tc-flower.8 | 10 +++++++++- tc/f_flower.c | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-)