]> git.droids-corp.org - dpdk.git/blobdiff - examples/ipsec-secgw/sa.c
examples/ipsec-secgw: support IPv6 options
[dpdk.git] / examples / ipsec-secgw / sa.c
index 8d47d1def48cc5f06898256d27a623383e564785..7262ccee83db1071a21fd9ce7435ebe6820efc60 100644 (file)
@@ -1228,10 +1228,7 @@ single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt,
        *sa_ret = NULL;
 
        ip = rte_pktmbuf_mtod(pkt, struct ip *);
-       if (ip->ip_v == IPVERSION)
-               esp = (struct rte_esp_hdr *)(ip + 1);
-       else
-               esp = (struct rte_esp_hdr *)(((struct ip6_hdr *)ip) + 1);
+       esp = rte_pktmbuf_mtod_offset(pkt, struct rte_esp_hdr *, pkt->l3_len);
 
        if (esp->spi == INVALID_SPI)
                return;