summaryrefslogtreecommitdiff
path: root/net/ipv4/esp4_offload.c
diff options
context:
space:
mode:
authorChristian Langrock <christian.langrock@secunet.com>2022-10-17 09:34:47 +0300
committerSteffen Klassert <steffen.klassert@secunet.com>2022-10-19 10:00:53 +0300
commit4b549ccce941798703f159b227aa28c716aa78fa (patch)
tree3fa86e1058150975d089ffa94dfe041fede45d0a /net/ipv4/esp4_offload.c
parentd83f7040e18489265b4b121f33f99b02e52dabda (diff)
downloadlinux-4b549ccce941798703f159b227aa28c716aa78fa.tar.xz
xfrm: replay: Fix ESN wrap around for GSO
When using GSO it can happen that the wrong seq_hi is used for the last packets before the wrap around. This can lead to double usage of a sequence number. To avoid this, we should serialize this last GSO packet. Fixes: d7dbefc45cf5 ("xfrm: Add xfrm_replay_overflow functions for offloading") Co-developed-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Christian Langrock <christian.langrock@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/ipv4/esp4_offload.c')
-rw-r--r--net/ipv4/esp4_offload.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c
index 170152772d33..3969fa805679 100644
--- a/net/ipv4/esp4_offload.c
+++ b/net/ipv4/esp4_offload.c
@@ -314,6 +314,9 @@ static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features_
xo->seq.low += skb_shinfo(skb)->gso_segs;
}
+ if (xo->seq.low < seq)
+ xo->seq.hi++;
+
esp.seqno = cpu_to_be64(seq + ((u64)xo->seq.hi << 32));
ip_hdr(skb)->tot_len = htons(skb->len);