Skip to content

Commit eb53f7a

Browse files
Ivan Veceradavem330
authored andcommitted
net/sched: cls_u32: fix cls_u32 on filter replace
The following sequence is currently broken: # tc qdisc add dev foo ingress # tc filter replace dev foo protocol all ingress \ u32 match u8 0 0 action mirred egress mirror dev bar1 # tc filter replace dev foo protocol all ingress \ handle 800::800 pref 49152 \ u32 match u8 0 0 action mirred egress mirror dev bar2 Error: cls_u32: Key node flags do not match passed flags. We have an error talking to the kernel, -1 The error comes from u32_change() when comparing new and existing flags. The existing ones always contains one of TCA_CLS_FLAGS_{,NOT}_IN_HW flag depending on offloading state. These flags cannot be passed from userspace so the condition (n->flags != flags) in u32_change() always fails. Fix the condition so the flags TCA_CLS_FLAGS_NOT_IN_HW and TCA_CLS_FLAGS_IN_HW are not taken into account. Fixes: 24d3dc6 ("net/sched: cls_u32: Reflect HW offload status") Signed-off-by: Ivan Vecera <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3968523 commit eb53f7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/sched/cls_u32.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,8 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
955955
return -EINVAL;
956956
}
957957

958-
if (n->flags != flags) {
958+
if ((n->flags ^ flags) &
959+
~(TCA_CLS_FLAGS_IN_HW | TCA_CLS_FLAGS_NOT_IN_HW)) {
959960
NL_SET_ERR_MSG_MOD(extack, "Key node flags do not match passed flags");
960961
return -EINVAL;
961962
}

0 commit comments

Comments
 (0)