get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 816778,
    "url": "http://patchwork.ozlabs.org/api/patches/816778/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1505985924-12479-3-git-send-email-amine.kherbouche@6wind.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1505985924-12479-3-git-send-email-amine.kherbouche@6wind.com>",
    "list_archive_url": null,
    "date": "2017-09-21T09:25:24",
    "name": "[2/2] ip_tunnel: add mpls over gre encapsulation",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "e68c1ac07d11034971d43e3802d11c1545955f97",
    "submitter": {
        "id": 72147,
        "url": "http://patchwork.ozlabs.org/api/people/72147/?format=api",
        "name": "Amine Kherbouche",
        "email": "amine.kherbouche@6wind.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1505985924-12479-3-git-send-email-amine.kherbouche@6wind.com/mbox/",
    "series": [
        {
            "id": 4338,
            "url": "http://patchwork.ozlabs.org/api/series/4338/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=4338",
            "date": "2017-09-21T09:25:22",
            "name": "Introduce MPLS over GRE",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/4338/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/816778/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/816778/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=6wind-com.20150623.gappssmtp.com\n\theader.i=@6wind-com.20150623.gappssmtp.com\n\theader.b=\"p9yUWXLi\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyWSb1gMCz9t43\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 21 Sep 2017 19:26:07 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751903AbdIUJ0D (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 21 Sep 2017 05:26:03 -0400",
            "from mail-wm0-f44.google.com ([74.125.82.44]:45074 \"EHLO\n\tmail-wm0-f44.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751887AbdIUJ0A (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 21 Sep 2017 05:26:00 -0400",
            "by mail-wm0-f44.google.com with SMTP id q124so22245wmb.0\n\tfor <netdev@vger.kernel.org>; Thu, 21 Sep 2017 02:26:00 -0700 (PDT)",
            "from griffon.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com.\n\t[62.23.145.78]) by smtp.gmail.com with ESMTPSA id\n\tt15sm748591wrb.41.2017.09.21.02.25.58\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tThu, 21 Sep 2017 02:25:58 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=3e2hbwcjbjd21DNEiOzWCzEgpNenmnoink4dl9Giz/A=;\n\tb=p9yUWXLiIiiixDDVstoxjZoH7L88z71uOt2/UxSDaIsBQHtl6MPSyeUwUTnCBgzoGm\n\trhBr6T+99dXUH0QP/JASXsv9bFeTk8lwjJBXgvgH+tpoXIEwKpuh40CwAbBDulxEqitv\n\tBgP05+effB/7w+qhrNAISrqAkPPFrieMLdxRBu4DOvjeedsCG1zqb6IXNKuQosmW5LZ/\n\tT5Ff/hcWx+68mD9d4k4YYQyn+wqU4FvqHa5z5qA1qoxOKfDWl8+RgNB9Ml0H2BFCRQs+\n\taL+Jb5fuBaqaTB40wNg4vHrIsdZosk608FxYbux6edlaJOthfop7brs3ZbtouNJpNcII\n\tzjUA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=3e2hbwcjbjd21DNEiOzWCzEgpNenmnoink4dl9Giz/A=;\n\tb=oG6SX0fmNM3Fk6WFSuH3DVVCTfxLMwulhEg+EVMWgAnGuwB2Ww26Fh4afizQlhvTHq\n\tNyXSj2t0AO65a1SDUDHGYMPKwdmSYKAXrTXKzjyyGGovlzhJ0SvIWDN8YaptntntA7b2\n\tXlp0KhCaWyeEyWlasAp8/etqemEyEHvWJnCT8sL4ELVFsaenN+/HVhYL/FwhlPt1QU87\n\tw61AOrL57sIo+GZoszO1YJMBUJjZU13DC2gdo8iJ8VSIGF6HO2O+VAKVhQ8Xmlk8+YED\n\t7RD28SCFrkDuzRfSr64jAYDQoqFDVe7Ql7SBh26XmbRisQK2LlP+jRwE6nwNGw4aesQi\n\trMaQ==",
        "X-Gm-Message-State": "AHPjjUixBOoxgnvZ3le4LLHdFOuXCYyFWzKs0rn1Y9/8WGZ+/IuMrl0v\n\tkBYezxO9RkIR/X1LwCONtSb2X6IM",
        "X-Google-Smtp-Source": "AOwi7QCAPu8CNRedNuXXY9pwfexreBB64jwd5WbyEWJ7SCsxBfKV3D69XKnCufsOndblpk2+Po9XqA==",
        "X-Received": "by 10.28.107.17 with SMTP id g17mr435672wmc.58.1505985959223;\n\tThu, 21 Sep 2017 02:25:59 -0700 (PDT)",
        "From": "Amine Kherbouche <amine.kherbouche@6wind.com>",
        "To": "netdev@vger.kernel.org, xeb@mail.ru, roopa@cumulusnetworks.com",
        "Cc": "amine.kherbouche@6wind.com, equinox@diac24.net",
        "Subject": "[PATCH 2/2] ip_tunnel: add mpls over gre encapsulation",
        "Date": "Thu, 21 Sep 2017 11:25:24 +0200",
        "Message-Id": "<1505985924-12479-3-git-send-email-amine.kherbouche@6wind.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1505985924-12479-1-git-send-email-amine.kherbouche@6wind.com>",
        "References": "<1505985924-12479-1-git-send-email-amine.kherbouche@6wind.com>",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "This commit introduces the MPLSoGRE support (RFC 4023), using ip tunnel\nAPI.\n\nEncap:\n  - Add a new iptunnel type mpls.\n\nDecap:\n  - pull gre hdr and call mpls_forward().\n\nSigned-off-by: Amine Kherbouche <amine.kherbouche@6wind.com>\n---\n include/net/gre.h              |  3 +++\n include/uapi/linux/if_tunnel.h |  1 +\n net/ipv4/gre_demux.c           | 22 ++++++++++++++++++++++\n net/ipv4/ip_gre.c              |  9 +++++++++\n net/ipv6/ip6_gre.c             |  7 +++++++\n net/mpls/af_mpls.c             | 37 +++++++++++++++++++++++++++++++++++++\n 6 files changed, 79 insertions(+)",
    "diff": "diff --git a/include/net/gre.h b/include/net/gre.h\nindex d25d836..88a8343 100644\n--- a/include/net/gre.h\n+++ b/include/net/gre.h\n@@ -35,6 +35,9 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,\n \t\t\t\t       u8 name_assign_type);\n int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,\n \t\t     bool *csum_err, __be16 proto, int nhs);\n+#if IS_ENABLED(CONFIG_MPLS)\n+int mpls_gre_rcv(struct sk_buff *skb, int gre_hdr_len);\n+#endif\n \n static inline int gre_calc_hlen(__be16 o_flags)\n {\ndiff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h\nindex 2e52088..a2f48c0 100644\n--- a/include/uapi/linux/if_tunnel.h\n+++ b/include/uapi/linux/if_tunnel.h\n@@ -84,6 +84,7 @@ enum tunnel_encap_types {\n \tTUNNEL_ENCAP_NONE,\n \tTUNNEL_ENCAP_FOU,\n \tTUNNEL_ENCAP_GUE,\n+\tTUNNEL_ENCAP_MPLS,\n };\n \n #define TUNNEL_ENCAP_FLAG_CSUM\t\t(1<<0)\ndiff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c\nindex b798862..a6a937e 100644\n--- a/net/ipv4/gre_demux.c\n+++ b/net/ipv4/gre_demux.c\n@@ -23,6 +23,9 @@\n #include <linux/netdevice.h>\n #include <linux/if_tunnel.h>\n #include <linux/spinlock.h>\n+#if IS_ENABLED(CONFIG_MPLS)\n+#include <linux/mpls.h>\n+#endif\n #include <net/protocol.h>\n #include <net/gre.h>\n \n@@ -122,6 +125,25 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,\n }\n EXPORT_SYMBOL(gre_parse_header);\n \n+#if IS_ENABLED(CONFIG_MPLS)\n+int mpls_gre_rcv(struct sk_buff *skb, int gre_hdr_len)\n+{\n+\tif (unlikely(!pskb_may_pull(skb, gre_hdr_len)))\n+\t\tgoto drop;\n+\n+\t/* Pop GRE hdr and reset the skb */\n+\tskb_pull(skb, gre_hdr_len);\n+\tskb_reset_network_header(skb);\n+\n+\tmpls_forward(skb, skb->dev, NULL, NULL);\n+\n+\treturn 0;\n+drop:\n+\treturn NET_RX_DROP;\n+}\n+EXPORT_SYMBOL(mpls_gre_rcv);\n+#endif\n+\n static int gre_rcv(struct sk_buff *skb)\n {\n \tconst struct gre_protocol *proto;\ndiff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c\nindex 9cee986..dd4431c 100644\n--- a/net/ipv4/ip_gre.c\n+++ b/net/ipv4/ip_gre.c\n@@ -412,10 +412,19 @@ static int gre_rcv(struct sk_buff *skb)\n \t\t\treturn 0;\n \t}\n \n+#if IS_ENABLED(CONFIG_MPLS)\n+\tif (unlikely(tpi.proto == htons(ETH_P_MPLS_UC))) {\n+\t\tif (mpls_gre_rcv(skb, hdr_len))\n+\t\t\tgoto drop;\n+\t\treturn 0;\n+\t}\n+#endif\n+\n \tif (ipgre_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)\n \t\treturn 0;\n \n \ticmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);\n+\n drop:\n \tkfree_skb(skb);\n \treturn 0;\ndiff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c\nindex c82d41e..e52396d 100644\n--- a/net/ipv6/ip6_gre.c\n+++ b/net/ipv6/ip6_gre.c\n@@ -476,6 +476,13 @@ static int gre_rcv(struct sk_buff *skb)\n \tif (hdr_len < 0)\n \t\tgoto drop;\n \n+#if IS_ENABLED(CONFIG_MPLS)\n+\tif (unlikely(tpi.proto == htons(ETH_P_MPLS_UC))) {\n+\t\tif (mpls_gre_rcv(skb, hdr_len))\n+\t\t\tgoto drop;\n+\t\treturn 0;\n+\t}\n+#endif\n \tif (iptunnel_pull_header(skb, hdr_len, tpi.proto, false))\n \t\tgoto drop;\n \ndiff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c\nindex 36ea2ad..060ed07 100644\n--- a/net/mpls/af_mpls.c\n+++ b/net/mpls/af_mpls.c\n@@ -16,6 +16,7 @@\n #include <net/arp.h>\n #include <net/ip_fib.h>\n #include <net/netevent.h>\n+#include <net/ip_tunnels.h>\n #include <net/netns/generic.h>\n #if IS_ENABLED(CONFIG_IPV6)\n #include <net/ipv6.h>\n@@ -39,6 +40,40 @@ static int one = 1;\n static int label_limit = (1 << 20) - 1;\n static int ttl_max = 255;\n \n+size_t ipgre_mpls_encap_hlen(struct ip_tunnel_encap *e)\n+{\n+\treturn sizeof(struct mpls_shim_hdr);\n+}\n+\n+int ipgre_mpls_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,\n+\t\t\t    u8 *protocol, struct flowi4 *fl4)\n+{\n+\treturn 0;\n+}\n+\n+static const struct ip_tunnel_encap_ops mpls_iptun_ops = {\n+\t.encap_hlen = ipgre_mpls_encap_hlen,\n+\t.build_header = ipgre_mpls_build_header,\n+};\n+\n+int ipgre_tunnel_encap_add_mpls_ops(void)\n+{\n+\tint ret;\n+\n+\tret = ip_tunnel_encap_add_ops(&mpls_iptun_ops, TUNNEL_ENCAP_MPLS);\n+\tif (ret < 0) {\n+\t\tpr_err(\"can't add mplsgre ops\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static void ipgre_tunnel_encap_del_mpls_ops(void)\n+{\n+\tip_tunnel_encap_del_ops(&mpls_iptun_ops, TUNNEL_ENCAP_MPLS);\n+}\n+\n static void rtmsg_lfib(int event, u32 label, struct mpls_route *rt,\n \t\t       struct nlmsghdr *nlh, struct net *net, u32 portid,\n \t\t       unsigned int nlm_flags);\n@@ -2486,6 +2521,7 @@ static int __init mpls_init(void)\n \t\t      0);\n \trtnl_register(PF_MPLS, RTM_GETNETCONF, mpls_netconf_get_devconf,\n \t\t      mpls_netconf_dump_devconf, 0);\n+\tipgre_tunnel_encap_add_mpls_ops();\n \terr = 0;\n out:\n \treturn err;\n@@ -2503,6 +2539,7 @@ static void __exit mpls_exit(void)\n \tdev_remove_pack(&mpls_packet_type);\n \tunregister_netdevice_notifier(&mpls_dev_notifier);\n \tunregister_pernet_subsys(&mpls_net_ops);\n+\tipgre_tunnel_encap_del_mpls_ops();\n }\n module_exit(mpls_exit);\n \n",
    "prefixes": [
        "2/2"
    ]
}