summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanielMartinBuckley <daniel.m.buckley@intel.com>2017-10-26 18:48:47 +0100
committerDanielMartinBuckley <daniel.m.buckley@intel.com>2017-11-01 15:23:56 +0000
commit2f1fa2c37697377aea015e7d82c49b3df2ae9111 (patch)
tree1a7d60e9538bc3f35562697e799a7d338f06b32e
parent504e70cbb19a3e65b1704ee085cd079d26cf16f8 (diff)
lw_AFTR: IP Checksum required on generated packet.
In lwAFTR (ipv6 de-encapsulate) the generated ipv4 packet requires an IP checksum, otherwise this packet is dropped in Openstack. (Openstack is much stricter than baremetal) Some fields in the header need to be initialized. Add flag in Makefile which when enabled will build to include the generate the IP checksum in the build. FLAG = GEN_DECAP_IPV6_TO_IPV4_CKSUM=y Not include in default build. Change-Id: If94e7cff64b03c66362021f05e48fb9265fc8210 Signed-off-by: Daniel Martin Buckley <daniel.m.buckley@intel.com>
-rw-r--r--VNFs/DPPD-PROX/Makefile5
-rw-r--r--VNFs/DPPD-PROX/handle_ipv6_tunnel.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/VNFs/DPPD-PROX/Makefile b/VNFs/DPPD-PROX/Makefile
index e9a4211b..3151f04f 100644
--- a/VNFs/DPPD-PROX/Makefile
+++ b/VNFs/DPPD-PROX/Makefile
@@ -105,6 +105,11 @@ else
CFLAGS += -DPROX_MAX_LOG_LVL=$(log)
endif
+# When ipv4 packet is de-encalpusled from ipv6 packet, genaerate IP checksum.
+ifeq ($(GEN_DECAP_IPV6_TO_IPV4_CKSUM),y)
+CFLAGS += -DGEN_DECAP_IPV6_TO_IPV4_CKSUM
+endif
+
# override any use-case/enviroment specific choices regarding crc and
# always use the sw implementation
ifeq ($(crc),soft)
diff --git a/VNFs/DPPD-PROX/handle_ipv6_tunnel.c b/VNFs/DPPD-PROX/handle_ipv6_tunnel.c
index a92f9cdc..3361a6a7 100644
--- a/VNFs/DPPD-PROX/handle_ipv6_tunnel.c
+++ b/VNFs/DPPD-PROX/handle_ipv6_tunnel.c
@@ -377,6 +377,8 @@ static int handle_ipv6_encap_bulk(struct task_base* tbase, struct rte_mbuf** mbu
static inline uint8_t handle_ipv6_decap(struct task_ipv6_decap* ptask, struct rte_mbuf* rx_mbuf, __attribute__((unused)) struct ipv6_tun_dest* tun_dest)
{
struct ether_hdr* peth = rte_pktmbuf_mtod(rx_mbuf, struct ether_hdr *);
+ struct task_ipv6_tun_base* tun_base = (struct task_ipv6_tun_base*)ptask;
+ struct ipv4_hdr* pip4 = NULL;
if (unlikely(peth->ether_type != ETYPE_IPv6)) {
plog_warn("Received non IPv6 packet on ipv6 tunnel port\n");
@@ -400,12 +402,20 @@ static inline uint8_t handle_ipv6_decap(struct task_ipv6_decap* ptask, struct rt
// Discard IPv6 encapsulation
rte_pktmbuf_adj(rx_mbuf, ipv6_hdr_len);
peth = rte_pktmbuf_mtod(rx_mbuf, struct ether_hdr *);
+ pip4 = (struct ipv4_hdr *)(peth + 1);
// Restore Ethernet header
ether_addr_copy(&ptask->base.src_mac, &peth->s_addr);
ether_addr_copy(&ptask->dst_mac, &peth->d_addr);
peth->ether_type = ETYPE_IPv4;
+#ifdef GEN_DECAP_IPV6_TO_IPV4_CKSUM
+ // generate an IP checksum for ipv4 packet
+ if (tun_base->runtime_flags & TASK_TX_CRC) {
+ prox_ip_cksum(rx_mbuf, pip4, sizeof(struct ether_hdr), sizeof(struct ipv4_hdr), ptask->base.offload_crc);
+ }
+#endif
+
return 0;
}