diff mbox series

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

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

Commit Message

Github ODP bot Nov. 12, 2017, 11 p.m. 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: a908a4dead95321e84d6a8a23de060051dcd8969
 ** Merge commit sha: 7261a0ce35cc31342937cb57dcc287aea0c59ede
 **/
 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 49bacae01..832c62c94 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 */