Skip to content

Commit b8baac3

Browse files
committed
netfilter: flowtable: teardown flow if cached mtu is stale
Tear down the flow entry in the unlikely case that the interface mtu changes, this gives the flow a chance to refresh the cached mtu, otherwise such refresh does not occur until flow entry expires. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 03428ca commit b8baac3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

net/netfilter/nf_flow_table_ip.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,10 @@ static int nf_flow_offload_forward(struct nf_flowtable_ctx *ctx,
377377
flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
378378

379379
mtu = flow->tuplehash[dir].tuple.mtu + ctx->offset;
380-
if (unlikely(nf_flow_exceeds_mtu(skb, mtu)))
380+
if (unlikely(nf_flow_exceeds_mtu(skb, mtu))) {
381+
flow_offload_teardown(flow);
381382
return 0;
383+
}
382384

383385
iph = (struct iphdr *)(skb_network_header(skb) + ctx->offset);
384386
thoff = (iph->ihl * 4) + ctx->offset;
@@ -656,8 +658,10 @@ static int nf_flow_offload_ipv6_forward(struct nf_flowtable_ctx *ctx,
656658
flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
657659

658660
mtu = flow->tuplehash[dir].tuple.mtu + ctx->offset;
659-
if (unlikely(nf_flow_exceeds_mtu(skb, mtu)))
661+
if (unlikely(nf_flow_exceeds_mtu(skb, mtu))) {
662+
flow_offload_teardown(flow);
660663
return 0;
664+
}
661665

662666
ip6h = (struct ipv6hdr *)(skb_network_header(skb) + ctx->offset);
663667
thoff = sizeof(*ip6h) + ctx->offset;

0 commit comments

Comments
 (0)