diff mbox series

[API-NEXT,v8,15/16] linux-gen: ipsec: correct frag_offset for tunneled packets

Message ID 1510444815-25058-16-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v8,1/16] linux-gen: ipsec: use counter instead of random IV for GCM | expand

Commit Message

Github ODP bot Nov. 12, 2017, midnight UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Generated outer header should have frag_offset = 0, MF = 0. Change code
accordingly.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: 9ff682c8d0315f3f1921d5b9fe13d62897c78710
 ** Merge commit sha: 38c770f1444aeb3ede5313b7304a1161277ae0b5
 **/
 platform/linux-generic/odp_ipsec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c
index e6fb276a6..107b54917 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -677,10 +677,10 @@  static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,
 		out_ip.id = odp_atomic_fetch_add_u32(&ipsec_sa->out.tun_hdr_id,
 						     1);
 		if (ipsec_sa->copy_df)
-			out_ip.frag_offset = ip->frag_offset;
+			out_ip.frag_offset = ip->frag_offset & 0x4000;
 		else
-			out_ip.frag_offset = (ip->frag_offset & ~0x4000) |
-					     (ipsec_sa->out.tun_df << 14);
+			out_ip.frag_offset =
+				((uint16_t)ipsec_sa->out.tun_df) << 14;
 		out_ip.ttl = ipsec_sa->out.tun_ttl;
 		out_ip.proto = _ODP_IPV4;
 		/* Will be filled later by packet checksum update */