Skip to content

Commit 1b9cd76

Browse files
committed
netfilter: flowtable: refresh timeout after dst and writable checks
Refresh the timeout (and retry hardware offload) once the skbuff dst is confirmed to be current and after the skbuff is made writable. Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent e5075c0 commit 1b9cd76

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/netfilter/nf_flow_table_ip.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
246246
if (nf_flow_state_check(flow, iph->protocol, skb, thoff))
247247
return NF_ACCEPT;
248248

249-
flow_offload_refresh(flow_table, flow);
250-
251249
if (!dst_check(&rt->dst, 0)) {
252250
flow_offload_teardown(flow);
253251
return NF_ACCEPT;
@@ -256,6 +254,8 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
256254
if (skb_try_make_writable(skb, thoff + hdrsize))
257255
return NF_DROP;
258256

257+
flow_offload_refresh(flow_table, flow);
258+
259259
iph = ip_hdr(skb);
260260
nf_flow_nat_ip(flow, skb, thoff, dir, iph);
261261

@@ -466,8 +466,6 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
466466
sizeof(*ip6h)))
467467
return NF_ACCEPT;
468468

469-
flow_offload_refresh(flow_table, flow);
470-
471469
if (!dst_check(&rt->dst, 0)) {
472470
flow_offload_teardown(flow);
473471
return NF_ACCEPT;
@@ -476,6 +474,8 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
476474
if (skb_try_make_writable(skb, sizeof(*ip6h) + hdrsize))
477475
return NF_DROP;
478476

477+
flow_offload_refresh(flow_table, flow);
478+
479479
ip6h = ipv6_hdr(skb);
480480
nf_flow_nat_ipv6(flow, skb, dir, ip6h);
481481

0 commit comments

Comments
 (0)