]> git.baikalelectronics.ru Git - kernel.git/commit
net/sched: act_skbmod: Skip non-Ethernet packets
authorPeilin Ye <peilin.ye@bytedance.com>
Mon, 19 Jul 2021 23:41:24 +0000 (16:41 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Jul 2021 14:13:51 +0000 (07:13 -0700)
commit727d6a8b7ef3d25080fad228b2c4a1d4da5999c6
tree85a48b63269cf535d057218abe3beef267d60375
parent7e777021780e9c373fc0c04d40b8407ce8c3b5d5
net/sched: act_skbmod: Skip non-Ethernet packets

Currently tcf_skbmod_act() assumes that packets use Ethernet as their L2
protocol, which is not always the case.  As an example, for CAN devices:

$ ip link add dev vcan0 type vcan
$ ip link set up vcan0
$ tc qdisc add dev vcan0 root handle 1: htb
$ tc filter add dev vcan0 parent 1: protocol ip prio 10 \
matchall action skbmod swap mac

Doing the above silently corrupts all the packets.  Do not perform skbmod
actions for non-Ethernet packets.

Fixes: 86da71b57383 ("net_sched: Introduce skbmod action")
Reviewed-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/act_skbmod.c