[qca-nss-ecm] Add dummy fragment header detection.

Change-Id: Idc067ac16aa69de87052a2b3c3c23f24d5b648d5
Signed-off-by: Manish Verma <maniverm@codeaurora.org>
diff --git a/ecm_tracker.c b/ecm_tracker.c
index 999c76d..c6c371a 100644
--- a/ecm_tracker.c
+++ b/ecm_tracker.c
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2014-2015, The Linux Foundation.  All rights reserved.
+ * Copyright (c) 2014-2015, 2018, The Linux Foundation.  All rights reserved.
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * above copyright notice and this permission notice appear in all copies.
@@ -699,6 +699,9 @@
 	struct ipv6_gen_hdr {
 		uint8_t next_protocol;
 		uint8_t reserved;
+#ifdef ECM_INTERFACE_MAP_T_ENABLE
+		__be16 frag_off;
+#endif
 	} gen_header_buffer;
 	struct ipv6_gen_hdr *gen_header;
 
@@ -723,6 +726,21 @@
 	 */
 	ip_hdr->fragmented = true;
 
+#ifdef ECM_INTERFACE_MAP_T_ENABLE
+	/*
+	 * In general, any IPv6 packet with fragment header is a fragment
+	 * packet.
+	 * But, packet with dummy fragment header is an exception to this case
+	 * and represent a complete IPv6 packet.
+	 * So, below is a check to identify the presence of dummy fragment
+	 * header, and if present, unset the fragment flag.
+	 */
+	if ((gen_header->frag_off & htons(IP6_OFFSET | IP6_MF)) == 0) {
+		DEBUG_TRACE("Pkt has dummy header\n");
+		ip_hdr->fragmented = false;
+	}
+#endif
+
 	etiph->protocol_number = protocol;
 	etiph->header_size = 8;
 	etiph->size = 8;