]> 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jul 2021 11:30:57 +0000 (13:30 +0200)
commit0f11b143226ed442d870abfc9790e1c2e15e9eb8
tree9cb7eba63657dae501c02bc211ce6a96e3b456a0
parent5357e96705373e6149d9f73103ce0c716c49099d
net/sched: act_skbmod: Skip non-Ethernet packets

[ Upstream commit 727d6a8b7ef3d25080fad228b2c4a1d4da5999c6 ]

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: 2dab165afa9d ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/act_skbmod.c