Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/55241/?format=api
http://patches.dpdk.org/api/patches/55241/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190624134000.2456-4-marcinx.smoczynski@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20190624134000.2456-4-marcinx.smoczynski@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190624134000.2456-4-marcinx.smoczynski@intel.com", "date": "2019-06-24T13:39:59", "name": "[v2,3/4] examples/ipsec-secgw: add support for ipv6 options", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "5513ff3b548400e8559de36e94b3965ce8d6d6d9", "submitter": { "id": 1293, "url": "http://patches.dpdk.org/api/people/1293/?format=api", "name": "Marcin Smoczynski", "email": "marcinx.smoczynski@intel.com" }, "delegate": { "id": 6690, "url": "http://patches.dpdk.org/api/users/6690/?format=api", "username": "akhil", "first_name": "akhil", "last_name": "goyal", "email": "gakhil@marvell.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190624134000.2456-4-marcinx.smoczynski@intel.com/mbox/", "series": [ { "id": 5130, "url": "http://patches.dpdk.org/api/series/5130/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5130", "date": "2019-06-24T13:39:56", "name": "IPv6 with options support for IPsec transport", "version": 2, "mbox": "http://patches.dpdk.org/series/5130/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/55241/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/55241/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 903AA1BF14;\n\tMon, 24 Jun 2019 15:43:05 +0200 (CEST)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 347BF1BF04\n\tfor <dev@dpdk.org>; Mon, 24 Jun 2019 15:43:03 +0200 (CEST)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Jun 2019 06:43:02 -0700", "from msmoczyx-mobl.ger.corp.intel.com ([10.103.104.100])\n\tby fmsmga001.fm.intel.com with ESMTP; 24 Jun 2019 06:43:00 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.63,412,1557212400\"; d=\"scan'208\";a=\"182637020\"", "From": "Marcin Smoczynski <marcinx.smoczynski@intel.com>", "To": "marko.kovacevic@intel.com, orika@mellanox.com, bruce.richardson@intel.com,\n\tpablo.de.lara.guarch@intel.com, radu.nicolau@intel.com,\n\takhil.goyal@nxp.com, tomasz.kantecki@intel.com,\n\tkonstantin.ananyev@intel.com, bernard.iremonger@intel.com,\n\tolivier.matz@6wind.com", "Cc": "dev@dpdk.org,\n\tMarcin Smoczynski <marcinx.smoczynski@intel.com>", "Date": "Mon, 24 Jun 2019 15:39:59 +0200", "Message-Id": "<20190624134000.2456-4-marcinx.smoczynski@intel.com>", "X-Mailer": "git-send-email 2.21.0.windows.1", "In-Reply-To": "<20190624134000.2456-1-marcinx.smoczynski@intel.com>", "References": "<20190508104717.13448-1-marcinx.smoczynski@intel.com>\n\t<20190624134000.2456-1-marcinx.smoczynski@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v2 3/4] examples/ipsec-secgw: add support for\n\tipv6 options", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Using transport with IPv6 and header extensions requires calculating\ntotal header length including extensions up to ESP header which is\nachieved with iteratively parsing extensions when preparing traffic\nfor processing. Calculated l3_len is later used to determine SPI\nfield offset for an inbound traffic and to reconstruct L3 header by\nlibrte_ipsec.\n\nSigned-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>\n---\n examples/ipsec-secgw/ipsec-secgw.c | 35 +++++++++++++++++++++++++-----\n examples/ipsec-secgw/sa.c | 5 +----\n 2 files changed, 31 insertions(+), 9 deletions(-)", "diff": "diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c\nindex 6c626fa5f..17012caf9 100644\n--- a/examples/ipsec-secgw/ipsec-secgw.c\n+++ b/examples/ipsec-secgw/ipsec-secgw.c\n@@ -41,6 +41,7 @@\n #include <rte_jhash.h>\n #include <rte_cryptodev.h>\n #include <rte_security.h>\n+#include <rte_ip.h>\n \n #include \"ipsec.h\"\n #include \"parser.h\"\n@@ -248,16 +249,40 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)\n \t\tpkt->l2_len = 0;\n \t\tpkt->l3_len = sizeof(struct ip);\n \t} else if (eth->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6)) {\n-\t\tnlp = (uint8_t *)rte_pktmbuf_adj(pkt, RTE_ETHER_HDR_LEN);\n-\t\tnlp = RTE_PTR_ADD(nlp, offsetof(struct ip6_hdr, ip6_nxt));\n-\t\tif (*nlp == IPPROTO_ESP)\n+\t\tint next_proto;\n+\t\tsize_t l3len, ext_len;\n+\t\tstruct rte_ipv6_hdr *v6h;\n+\t\tuint8_t *p;\n+\n+\t\t/* get protocol type */\n+\t\tv6h = (struct rte_ipv6_hdr *)rte_pktmbuf_adj(pkt,\n+\t\t\tRTE_ETHER_HDR_LEN);\n+\t\tnext_proto = v6h->proto;\n+\n+\t\t/* determine l3 header size up to ESP extension */\n+\t\tl3len = sizeof(struct ip6_hdr);\n+\t\tp = rte_pktmbuf_mtod(pkt, uint8_t *);\n+\t\twhile (next_proto != IPPROTO_ESP && l3len < pkt->data_len &&\n+\t\t\t(next_proto = rte_ipv6_get_next_ext(p + l3len,\n+\t\t\t\t\t\tnext_proto, &ext_len)) >= 0)\n+\t\t\tl3len += ext_len;\n+\n+\t\t/* drop packet when IPv6 header exceeds first segment length */\n+\t\tif (unlikely(l3len > pkt->data_len)) {\n+\t\t\trte_pktmbuf_free(pkt);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (next_proto == IPPROTO_ESP)\n \t\t\tt->ipsec.pkts[(t->ipsec.num)++] = pkt;\n \t\telse {\n-\t\t\tt->ip6.data[t->ip6.num] = nlp;\n+\t\t\tt->ip6.data[t->ip6.num] = rte_pktmbuf_mtod_offset(pkt,\n+\t\t\t\tuint8_t *,\n+\t\t\t\toffsetof(struct rte_ipv6_hdr, proto));\n \t\t\tt->ip6.pkts[(t->ip6.num)++] = pkt;\n \t\t}\n \t\tpkt->l2_len = 0;\n-\t\tpkt->l3_len = sizeof(struct ip6_hdr);\n+\t\tpkt->l3_len = l3len;\n \t} else {\n \t\t/* Unknown/Unsupported type, drop the packet */\n \t\tRTE_LOG(ERR, IPSEC, \"Unsupported packet type 0x%x\\n\",\ndiff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c\nindex 8d47d1def..7262ccee8 100644\n--- a/examples/ipsec-secgw/sa.c\n+++ b/examples/ipsec-secgw/sa.c\n@@ -1228,10 +1228,7 @@ single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt,\n \t*sa_ret = NULL;\n \n \tip = rte_pktmbuf_mtod(pkt, struct ip *);\n-\tif (ip->ip_v == IPVERSION)\n-\t\tesp = (struct rte_esp_hdr *)(ip + 1);\n-\telse\n-\t\tesp = (struct rte_esp_hdr *)(((struct ip6_hdr *)ip) + 1);\n+\tesp = rte_pktmbuf_mtod_offset(pkt, struct rte_esp_hdr *, pkt->l3_len);\n \n \tif (esp->spi == INVALID_SPI)\n \t\treturn;\n", "prefixes": [ "v2", "3/4" ] }{ "id": 55241, "url": "