]> git.baikalelectronics.ru Git - kernel.git/commit
flow_dissector: Do not count vlan tags inside tunnel payload
authorQingqing Yang <qingqing.yang@broadcom.com>
Mon, 19 Sep 2022 07:48:08 +0000 (15:48 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 22 Sep 2022 01:36:57 +0000 (18:36 -0700)
commit8e0654b40bda0b81fae2ced8a56f9752ef03f15d
tree5a4a2ac2edc54597f4dba5499f36b78bd95f0880
parent9ab352f0e3bcd5b372693057cc3b8174c3361db8
flow_dissector: Do not count vlan tags inside tunnel payload

We've met the problem that when there is a vlan tag inside
GRE encapsulation, the match of num_of_vlans fails.
It is caused by the vlan tag inside GRE payload has been
counted into num_of_vlans, which is not expected.

One example packet is like this:
Ethernet II, Src: Broadcom_68:56:07 (00:10:18:68:56:07)
                   Dst: Broadcom_68:56:08 (00:10:18:68:56:08)
802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 100
Internet Protocol Version 4, Src: 192.168.1.4, Dst: 192.168.1.200
Generic Routing Encapsulation (Transparent Ethernet bridging)
Ethernet II, Src: Broadcom_68:58:07 (00:10:18:68:58:07)
                   Dst: Broadcom_68:58:08 (00:10:18:68:58:08)
802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 200
...
It should match the (num_of_vlans 1) rule, but it matches
the (num_of_vlans 2) rule.

The vlan tags inside the GRE or other tunnel encapsulated payload
should not be taken into num_of_vlans.
The fix is to stop counting the vlan number when the encapsulation
bit is set.

Fixes: f6a8c26d94a6 ("flow_dissector: Add number of vlan tags dissector")
Signed-off-by: Qingqing Yang <qingqing.yang@broadcom.com>
Reviewed-by: Boris Sukholitko <boris.sukholitko@broadcom.com>
Link: https://lore.kernel.org/r/20220919074808.136640-1-qingqing.yang@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/flow_dissector.c