get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/53717/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 53717,
    "url": "http://patches.dpdk.org/api/patches/53717/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190527184448.21264-2-konstantin.ananyev@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": "<20190527184448.21264-2-konstantin.ananyev@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190527184448.21264-2-konstantin.ananyev@intel.com",
    "date": "2019-05-27T18:44:46",
    "name": "[1/3] examples/ipsec-secgw: fix invalid packet length",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d48e5ce3b8a6c43724b95cc20d42170068ea5a8f",
    "submitter": {
        "id": 33,
        "url": "http://patches.dpdk.org/api/people/33/?format=api",
        "name": "Ananyev, Konstantin",
        "email": "konstantin.ananyev@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/20190527184448.21264-2-konstantin.ananyev@intel.com/mbox/",
    "series": [
        {
            "id": 4786,
            "url": "http://patches.dpdk.org/api/series/4786/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4786",
            "date": "2019-05-27T18:44:45",
            "name": "examples/ipsec-secgw: support packet fragmentation",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4786/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/53717/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/53717/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 68C923237;\n\tMon, 27 May 2019 20:45:15 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id AF5872C6A;\n\tMon, 27 May 2019 20:45:13 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 May 2019 11:45:12 -0700",
            "from sivswdev08.ir.intel.com ([10.237.217.47])\n\tby fmsmga005.fm.intel.com with ESMTP; 27 May 2019 11:45:11 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Konstantin Ananyev <konstantin.ananyev@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "akhil.goyal@nxp.com, Konstantin Ananyev <konstantin.ananyev@intel.com>, \n\tstable@dpdk.org",
        "Date": "Mon, 27 May 2019 19:44:46 +0100",
        "Message-Id": "<20190527184448.21264-2-konstantin.ananyev@intel.com>",
        "X-Mailer": "git-send-email 2.18.0",
        "In-Reply-To": "<20190527184448.21264-1-konstantin.ananyev@intel.com>",
        "References": "<20190527184448.21264-1-konstantin.ananyev@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 1/3] examples/ipsec-secgw: fix invalid packet\n\tlength",
        "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": "for packets smaller then 64B some NICs reports pkt_len=64B.\nAs ipsec-secgw (and librte_ipsec) relies on pkt_len value to determine\npayload length, that causes problems for small packets.\nTo fix the issue, check that pkt_len matches values in IPv4/IPv6 header\nand re-adjust pkt_len if necessary.\n\nFixes: 906257e965b7 (\"examples/ipsec-secgw: support IPv6\")\nFixes: d299106e8e31 (\"examples/ipsec-secgw: add IPsec sample application\")\nCc: stable@dpdk.org\n\nSigned-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\n---\n examples/ipsec-secgw/ipsec-secgw.c | 59 +++++++++++++++++++++++-------\n 1 file changed, 46 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c\nindex 478dd80c2..1d1855f50 100644\n--- a/examples/ipsec-secgw/ipsec-secgw.c\n+++ b/examples/ipsec-secgw/ipsec-secgw.c\n@@ -229,35 +229,68 @@ static struct rte_eth_conf port_conf = {\n \n static struct socket_ctx socket_ctx[NB_SOCKETS];\n \n+static inline void\n+adjust_ipv4_pktlen(struct rte_mbuf *m, const struct ipv4_hdr *iph,\n+\tuint32_t l2_len)\n+{\n+\tuint32_t plen, trim;\n+\n+\tplen = rte_be_to_cpu_16(iph->total_length) + l2_len;\n+\tif (plen < m->pkt_len) {\n+\t\ttrim = m->pkt_len - plen;\n+\t\trte_pktmbuf_trim(m, trim);\n+\t}\n+}\n+\n+static inline void\n+adjust_ipv6_pktlen(struct rte_mbuf *m, const struct ipv6_hdr *iph,\n+\tuint32_t l2_len)\n+{\n+\tuint32_t plen, trim;\n+\n+\tplen = rte_be_to_cpu_16(iph->payload_len) + sizeof(*iph) + l2_len;\n+\tif (plen < m->pkt_len) {\n+\t\ttrim = m->pkt_len - plen;\n+\t\trte_pktmbuf_trim(m, trim);\n+\t}\n+}\n+\n static inline void\n prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t)\n {\n-\tuint8_t *nlp;\n-\tstruct ether_hdr *eth;\n+\tconst struct ether_hdr *eth;\n+\tconst struct ipv4_hdr *iph4;\n+\tconst struct ipv6_hdr *iph6;\n \n-\teth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);\n+\teth = rte_pktmbuf_mtod(pkt, const struct ether_hdr *);\n \tif (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) {\n-\t\tnlp = (uint8_t *)rte_pktmbuf_adj(pkt, ETHER_HDR_LEN);\n-\t\tnlp = RTE_PTR_ADD(nlp, offsetof(struct ip, ip_p));\n-\t\tif (*nlp == IPPROTO_ESP)\n+\n+\t\tiph4 = (const struct ipv4_hdr *)rte_pktmbuf_adj(pkt,\n+\t\t\tETHER_HDR_LEN);\n+\t\tadjust_ipv4_pktlen(pkt, iph4, 0);\n+\n+\t\tif (iph4->next_proto_id == IPPROTO_ESP)\n \t\t\tt->ipsec.pkts[(t->ipsec.num)++] = pkt;\n \t\telse {\n-\t\t\tt->ip4.data[t->ip4.num] = nlp;\n+\t\t\tt->ip4.data[t->ip4.num] = &iph4->next_proto_id;\n \t\t\tt->ip4.pkts[(t->ip4.num)++] = pkt;\n \t\t}\n \t\tpkt->l2_len = 0;\n-\t\tpkt->l3_len = sizeof(struct ip);\n+\t\tpkt->l3_len = sizeof(*iph4);\n \t} else if (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) {\n-\t\tnlp = (uint8_t *)rte_pktmbuf_adj(pkt, ETHER_HDR_LEN);\n-\t\tnlp = RTE_PTR_ADD(nlp, offsetof(struct ip6_hdr, ip6_nxt));\n-\t\tif (*nlp == IPPROTO_ESP)\n+\n+\t\tiph6 = (const struct ipv6_hdr *)rte_pktmbuf_adj(pkt,\n+\t\t\tETHER_HDR_LEN);\n+\t\tadjust_ipv6_pktlen(pkt, iph6, 0);\n+\n+\t\tif (iph6->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] = &iph6->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 = sizeof(*iph6);\n \t} else {\n \t\t/* Unknown/Unsupported type, drop the packet */\n \t\tRTE_LOG(ERR, IPSEC, \"Unsupported packet type 0x%x\\n\",\n",
    "prefixes": [
        "1/3"
    ]
}