Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
netfilter: nftables_offload: special ethertype handling for VLAN
The nftables offload parser sets FLOW_DISSECTOR_KEY_BASIC .n_proto to the ethertype field in in the ethertype frame. However: - FLOW_DISSECTOR_KEY_BASIC .n_proto field always stores either IPv4 or IPv6 ethertypes. - FLOW_DISSECTOR_KEY_VLAN .vlan_tpid stores either the 802.1q and 802.1ad ethertypes. Same as for C-VLAN. This function adjusts the flow dissector to handle three scenarios: 1) FLOW_DISSECTOR_KEY_VLAN and FLOW_DISSECTOR_KEY_CVLAN are set. Then, transfer the .n_proto field to FLOW_DISSECTOR_KEY_VLAN .tpid, and FLOW_DISSECTOR_KEY_VLAN .tpid to FLOW_DISSECTOR_KEY_CVLAN .tpid. Finally set .n_proto to FLOW_DISSECTOR_KEY_CVLAN .tpid. 2) FLOW_DISSECTOR_KEY_VLAN is set. Swap the .n_proto and the FLOW_DISSECTOR_KEY_VLAN .tpid fields. 3) ethertype is set to 802.1q or 802.1ad, in this case, transfer the .n_proto field to FLOW_DISSECTOR_KEY_VLAN .vlan_tpid. Fixes: a82055a ("netfilter: nft_payload: add VLAN offload support") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
- Loading branch information