diff mbox series

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

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

Commit Message

Github ODP bot Nov. 13, 2017, 2 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: 845914564f2d99792452ac22a524279f44496a1d
 **/
 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 aadc671f9..4c032b9c0 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -663,10 +663,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 */