Skip to content

Commit 05ab86c

Browse files
committed
xfrm4: Invalidate all ipv4 routes on IPsec pmtu events
On IPsec pmtu events we can't access the transport headers of the original packet, so we can't find the socket that sent the packet. The only chance to notify the socket about the pmtu change is to force a relookup for all routes. This patch implenents this for the IPsec protocols. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent 5b653b2 commit 05ab86c

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

‎net/ipv4/ah4.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,12 @@ static void ah4_err(struct sk_buff *skb, u32 info)
420420
if (!x)
421421
return;
422422

423-
if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH)
423+
if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) {
424+
atomic_inc(&flow_cache_genid);
425+
rt_genid_bump(net);
426+
424427
ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_AH, 0);
425-
else
428+
} else
426429
ipv4_redirect(skb, net, 0, 0, IPPROTO_AH, 0);
427430
xfrm_state_put(x);
428431
}

‎net/ipv4/esp4.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,12 @@ static void esp4_err(struct sk_buff *skb, u32 info)
502502
if (!x)
503503
return;
504504

505-
if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH)
505+
if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) {
506+
atomic_inc(&flow_cache_genid);
507+
rt_genid_bump(net);
508+
506509
ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ESP, 0);
507-
else
510+
} else
508511
ipv4_redirect(skb, net, 0, 0, IPPROTO_ESP, 0);
509512
xfrm_state_put(x);
510513
}

‎net/ipv4/ipcomp.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
4747
if (!x)
4848
return;
4949

50-
if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH)
50+
if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) {
51+
atomic_inc(&flow_cache_genid);
52+
rt_genid_bump(net);
53+
5154
ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_COMP, 0);
52-
else
55+
} else
5356
ipv4_redirect(skb, net, 0, 0, IPPROTO_COMP, 0);
5457
xfrm_state_put(x);
5558
}

0 commit comments

Comments
 (0)