]> git.ipfire.org Git - thirdparty/linux.git/commit
net/sched: Fix ethx:ingress -> ethy:egress -> ethx:ingress mirred loop
authorJamal Hadi Salim <jhs@mojatatu.com>
Mon, 25 May 2026 12:25:52 +0000 (08:25 -0400)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 28 May 2026 10:26:36 +0000 (12:26 +0200)
commitdb875221ab08d213a83bf30196ae8b64d55a3403
tree1f3ae7de53efd7f9d9ab7457d5c4921973451a4f
parent9552b11e3edabc97cfcd9f29103d5afbce7ae183
net/sched: Fix ethx:ingress -> ethy:egress -> ethx:ingress mirred loop

When mirred redirects to ingress (from either ingress or egress) the loop
state from sched_mirred_dev array dev is lost because of 1) the packet
deferral into the backlog and 2) the fact the sched_mirred_dev array is
cleared. In such cases, if there was a loop we won't discover it.

Here's a simple test to reproduce:
ip a add dev port0 10.10.10.11/24

tc qdisc add dev port0 clsact
tc filter add dev port0 egress protocol ip \
   prio 10 matchall action mirred ingress redirect dev port1

tc qdisc add dev port1 clsact
tc filter add dev port1 ingress protocol ip \
   prio 10 matchall action mirred egress redirect dev port0

ping -c 1 -W0.01 10.10.10.10

Fixes: fe946a751d9b ("net/sched: act_mirred: add loop detection")
Tested-by: Victor Nogueira <victor@mojatatu.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/20260525122556.973584-6-jhs@mojatatu.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/sched/act_mirred.c