Skip to content

Commit 89d8fd4

Browse files
ummakynesdavem330
authored andcommitted
netfilter: nft_payload: add C-VLAN offload support
Match on h_vlan_encapsulated_proto and set up protocol dependency. Check for protocol dependency before accessing the tci field. Allow to match on the encapsulated ethertype too. Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a82055a commit 89d8fd4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

net/netfilter/nft_payload.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,22 @@ static int nft_payload_offload_ll(struct nft_offload_ctx *ctx,
203203

204204
NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_VLAN, vlan,
205205
vlan_tpid, sizeof(__be16), reg);
206+
nft_offload_set_dependency(ctx, NFT_OFFLOAD_DEP_NETWORK);
207+
break;
208+
case offsetof(struct vlan_ethhdr, h_vlan_TCI) + sizeof(struct vlan_hdr):
209+
if (priv->len != sizeof(__be16))
210+
return -EOPNOTSUPP;
211+
212+
NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_CVLAN, vlan,
213+
vlan_tci, sizeof(__be16), reg);
214+
break;
215+
case offsetof(struct vlan_ethhdr, h_vlan_encapsulated_proto) +
216+
sizeof(struct vlan_hdr):
217+
if (priv->len != sizeof(__be16))
218+
return -EOPNOTSUPP;
219+
220+
NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_CVLAN, vlan,
221+
vlan_tpid, sizeof(__be16), reg);
206222
break;
207223
default:
208224
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)