diff mbox

esp: correct offset for ESN when using NAT-T

Message ID 20160612234814.15460-2-blair.steven@alliedtelesis.co.nz
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Blair Steven June 12, 2016, 11:48 p.m. UTC
The offset for calculating ESN was not taking into account the new UDP
header created for NAT-T.
---
 net/ipv4/esp4.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Miller June 14, 2016, 9:12 p.m. UTC | #1
From: Blair Steven <blair.steven@alliedtelesis.co.nz>
Date: Mon, 13 Jun 2016 11:48:14 +1200

> The offset for calculating ESN was not taking into account the new UDP
> header created for NAT-T.

All submissions must include a proper signoff.
diff mbox

Patch

diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 4779374..c84d1fc 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -223,6 +223,8 @@  static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
 		uh->len = htons(skb->len - skb_transport_offset(skb));
 		uh->check = 0;
 
+		skb_set_transport_header(skb, skb_transport_offset(skb) + sizeof(struct udphdr));
+
 		switch (encap_type) {
 		default:
 		case UDP_ENCAP_ESPINUDP: