diff options
| author | Pablo Neira Ayuso <pablo@netfilter.org> | 2026-08-06 23:54:06 +0200 |
|---|---|---|
| committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2026-08-10 13:03:08 +0200 |
| commit | 0e42d4039cb41ae3101fc8df361df418e6ce59eb (patch) | |
| tree | eed5275fa7b838fced846f2a86a1be4f3dd83d00 | |
| parent | 609268d93dd1c64723f49c5c21fe530d8129801c (diff) | |
| download | linux-next-0e42d4039cb41ae3101fc8df361df418e6ce59eb.tar.gz linux-next-0e42d4039cb41ae3101fc8df361df418e6ce59eb.zip | |
netfilter: flowtable: detach layer 2 encapsulation parser from lookup
Move the layer 2 encapsulation header parser out of the lookup function
to prepare for IPv4 over IPv6 and SIT.
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
| -rw-r--r-- | net/netfilter/nf_flow_table_ip.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c index ff45f17f3c4a..c8c29a9a1684 100644 --- a/net/netfilter/nf_flow_table_ip.c +++ b/net/netfilter/nf_flow_table_ip.c @@ -459,12 +459,6 @@ nf_flow_offload_lookup(struct nf_flowtable_ctx *ctx, { struct flow_offload_tuple tuple = {}; - if (!nf_flow_skb_encap_protocol(ctx, skb)) - return NULL; - - if (unlikely(ctx->ether_type != htons(ETH_P_IP))) - return NULL; - if (nf_flow_tuple_ip(ctx, skb, &tuple) < 0) return NULL; @@ -877,6 +871,12 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb, }; int ret; + if (!nf_flow_skb_encap_protocol(&ctx, skb)) + return NF_ACCEPT; + + if (unlikely(ctx.ether_type != htons(ETH_P_IP))) + return NF_ACCEPT; + tuplehash = nf_flow_offload_lookup(&ctx, flow_table, skb); if (!tuplehash) return NF_ACCEPT; @@ -1117,12 +1117,6 @@ nf_flow_offload_ipv6_lookup(struct nf_flowtable_ctx *ctx, { struct flow_offload_tuple tuple = {}; - if (!nf_flow_skb_encap_protocol(ctx, skb)) - return NULL; - - if (unlikely(ctx->ether_type != htons(ETH_P_IPV6))) - return NULL; - if (nf_flow_tuple_ipv6(ctx, skb, &tuple) < 0) return NULL; @@ -1206,6 +1200,12 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb, }; int ret; + if (!nf_flow_skb_encap_protocol(&ctx, skb)) + return NF_ACCEPT; + + if (unlikely(ctx.ether_type != htons(ETH_P_IPV6))) + return NF_ACCEPT; + tuplehash = nf_flow_offload_ipv6_lookup(&ctx, flow_table, skb); if (!tuplehash) return NF_ACCEPT; |
