mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-27 15:17:04 -04:00
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user