get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 819068,
    "url": "http://patchwork.ozlabs.org/api/patches/819068/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/198fd7591bc1daae4727ee8b950e116b59f2d4c3.1506504229.git.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": "<198fd7591bc1daae4727ee8b950e116b59f2d4c3.1506504229.git.amine.kherbouche@6wind.com>",
    "list_archive_url": null,
    "date": "2017-09-27T09:37:13",
    "name": "[v3,1/1] ip_tunnel: add mpls over gre encapsulation",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "d6474dcc03d9ea5402caa9887f6d70050ec7c741",
    "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/198fd7591bc1daae4727ee8b950e116b59f2d4c3.1506504229.git.amine.kherbouche@6wind.com/mbox/",
    "series": [
        {
            "id": 5321,
            "url": "http://patchwork.ozlabs.org/api/series/5321/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=5321",
            "date": "2017-09-27T09:37:12",
            "name": "Introduce MPLS over GRE",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/5321/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/819068/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/819068/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=\"wtC+5Rbo\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y2CRG0l9yz9tXs\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 27 Sep 2017 19:37:46 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752439AbdI0Jho (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 27 Sep 2017 05:37:44 -0400",
            "from mail-wm0-f50.google.com ([74.125.82.50]:48203 \"EHLO\n\tmail-wm0-f50.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750854AbdI0Jhj (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 27 Sep 2017 05:37:39 -0400",
            "by mail-wm0-f50.google.com with SMTP id m127so15984646wmm.3\n\tfor <netdev@vger.kernel.org>; Wed, 27 Sep 2017 02:37:39 -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\tr15sm6202441wrc.30.2017.09.27.02.37.37\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 27 Sep 2017 02:37:37 -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=XG1E/cyJmmmd310wJVu7dQcGX+CF03mBhikwoUIKNt8=;\n\tb=wtC+5RbonpN49i81ENNVbM3/ef5urHIb04teuJ4lzbRVJhJ1ZHlLYxSm/0iDFr11NP\n\tGdxFP3Xhfw9VrhxmLfmXMfYDVxGEH6vRr/kNsbDV4IllAO7BMAm6BmtyQUZI8fE9CsG/\n\tPqNj8SzL/zZrriLNeQqaaS6bw1T00gISo4LMW/w8akPUrvQK0WaWS4Yny2lZx1D0osj/\n\tdq03go6lZjVK3m3CoTsI2mD5huzZzAEGGhUeJi2JqwqFYdvnRNWSGJFh6Kb4fGMGEgzc\n\t8sA/rvao2RUBpmHetT29eKFTaMoCgkJX+B2Vqx8koIdipE9JzxDw+MLSnqFNlPTT4W82\n\tK6Ig==",
        "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=XG1E/cyJmmmd310wJVu7dQcGX+CF03mBhikwoUIKNt8=;\n\tb=DVvtFpBOxEWbDqXqW62rehGf27v0lVsjqZvKMDD890boeXzpvlo8z89OUxFz062253\n\tF1gxyRwHQtS/f6gsb70MFzSOvrrT4qGq2ijgDjIMrgO3PHWkYsjL/pvStRc4j55yGqJO\n\tMYcHxa3J3s3U4e/6lOUI74t/qRW01O/MniBz2j4NgHQmJ5AIHDFiVCE5bTFPGTMtt2Nk\n\tulFzejeh0jXXcZ6zNtf0zqScc8lQgKnNbn/DSS+xN+zclr91p1gHvzvXVoZ6z1eUpXzk\n\tnhZF9JPEVLBlMpKOQB/loWsPzrRX3/ldvJBLJnyqnZct53QywNHqDwyeV1IFxg67Wi9R\n\tIxoA==",
        "X-Gm-Message-State": "AHPjjUhMLpwZ34bh/GozlNveRBhsdxjMsW8CQK6pXNyA72vtEQP5Leo2\n\tUXmTpubej9L/gSrt/7fwKWIo3w1o",
        "X-Google-Smtp-Source": "AOwi7QC5/bz+Q8oSkoqet1vRKT06jx/EYDuYU1EkzByQMM+rIpA2KyYSuOG2MCPKRQ/pKndm9pLOnQ==",
        "X-Received": "by 10.28.236.194 with SMTP id h63mr1126172wmi.159.1506505058347; \n\tWed, 27 Sep 2017 02:37:38 -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 v3 1/1] ip_tunnel: add mpls over gre encapsulation",
        "Date": "Wed, 27 Sep 2017 11:37:13 +0200",
        "Message-Id": "<198fd7591bc1daae4727ee8b950e116b59f2d4c3.1506504229.git.amine.kherbouche@6wind.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<cover.1506504229.git.amine.kherbouche@6wind.com>",
        "References": "<cover.1506504229.git.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  - Share tx path: gre type mpls loaded from skb->protocol.\n\nDecap:\n  - pull gre hdr and call mpls_forward().\n\nSigned-off-by: Amine Kherbouche <amine.kherbouche@6wind.com>\n---\n include/linux/mpls.h           |  2 ++\n include/uapi/linux/if_tunnel.h |  1 +\n net/ipv4/ip_gre.c              | 11 +++++++++\n net/ipv6/ip6_gre.c             | 11 +++++++++\n net/mpls/af_mpls.c             | 52 ++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 77 insertions(+)",
    "diff": "diff --git a/include/linux/mpls.h b/include/linux/mpls.h\nindex 384fb22..57203c1 100644\n--- a/include/linux/mpls.h\n+++ b/include/linux/mpls.h\n@@ -8,4 +8,6 @@\n #define MPLS_TC_MASK\t\t(MPLS_LS_TC_MASK >> MPLS_LS_TC_SHIFT)\n #define MPLS_LABEL_MASK\t\t(MPLS_LS_LABEL_MASK >> MPLS_LS_LABEL_SHIFT)\n \n+int mpls_gre_rcv(struct sk_buff *skb, int gre_hdr_len);\n+\n #endif  /* _LINUX_MPLS_H */\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/ip_gre.c b/net/ipv4/ip_gre.c\nindex 9cee986..0a898f4 100644\n--- a/net/ipv4/ip_gre.c\n+++ b/net/ipv4/ip_gre.c\n@@ -32,6 +32,9 @@\n #include <linux/netfilter_ipv4.h>\n #include <linux/etherdevice.h>\n #include <linux/if_ether.h>\n+#if IS_ENABLED(CONFIG_MPLS)\n+#include <linux/mpls.h>\n+#endif\n \n #include <net/sock.h>\n #include <net/ip.h>\n@@ -412,6 +415,14 @@ static int gre_rcv(struct sk_buff *skb)\n \t\t\treturn 0;\n \t}\n \n+\tif (unlikely(tpi.proto == htons(ETH_P_MPLS_UC))) {\n+#if IS_ENABLED(CONFIG_MPLS)\n+\t\treturn mpls_gre_rcv(skb, hdr_len);\n+#else\n+\t\tgoto drop;\n+#endif\n+\t}\n+\n \tif (ipgre_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)\n \t\treturn 0;\n \ndiff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c\nindex c82d41e..5a0f5e1 100644\n--- a/net/ipv6/ip6_gre.c\n+++ b/net/ipv6/ip6_gre.c\n@@ -34,6 +34,9 @@\n #include <linux/hash.h>\n #include <linux/if_tunnel.h>\n #include <linux/ip6_tunnel.h>\n+#if IS_ENABLED(CONFIG_MPLS)\n+#include <linux/mpls.h>\n+#endif\n \n #include <net/sock.h>\n #include <net/ip.h>\n@@ -476,6 +479,14 @@ static int gre_rcv(struct sk_buff *skb)\n \tif (hdr_len < 0)\n \t\tgoto drop;\n \n+\tif (unlikely(tpi.proto == htons(ETH_P_MPLS_UC))) {\n+#if IS_ENABLED(CONFIG_MPLS)\n+\t\treturn mpls_gre_rcv(skb, hdr_len);\n+#else\n+\t\tgoto drop;\n+#endif\n+\t}\n+\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 c5b9ce4..53ec7c0 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,36 @@ static int one = 1;\n static int label_limit = (1 << 20) - 1;\n static int ttl_max = 255;\n \n+#if IS_ENABLED(CONFIG_NET_IP_TUNNEL)\n+size_t ipgre_mpls_encap_hlen(struct ip_tunnel_encap *e)\n+{\n+\treturn sizeof(struct mpls_shim_hdr);\n+}\n+\n+static const struct ip_tunnel_encap_ops mpls_iptun_ops = {\n+\t.encap_hlen\t= ipgre_mpls_encap_hlen,\n+};\n+\n+static int ipgre_tunnel_encap_add_mpls_ops(void)\n+{\n+\treturn ip_tunnel_encap_add_ops(&mpls_iptun_ops, TUNNEL_ENCAP_MPLS);\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+#else\n+static int ipgre_tunnel_encap_add_mpls_ops(void)\n+{\n+\treturn 0;\n+}\n+\n+static void ipgre_tunnel_encap_del_mpls_ops(void)\n+{\n+}\n+#endif\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@@ -443,6 +474,22 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev,\n \treturn NET_RX_DROP;\n }\n \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+\treturn mpls_forward(skb, skb->dev, NULL, NULL);\n+drop:\n+\tkfree_skb(skb);\n+\treturn NET_RX_DROP;\n+}\n+EXPORT_SYMBOL(mpls_gre_rcv);\n+\n static struct packet_type mpls_packet_type __read_mostly = {\n \t.type = cpu_to_be16(ETH_P_MPLS_UC),\n \t.func = mpls_forward,\n@@ -2485,6 +2532,10 @@ 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+\terr = ipgre_tunnel_encap_add_mpls_ops();\n+\tif (err)\n+\t\tpr_err(\"Can't add mpls over gre tunnel ops\\n\");\n+\n \terr = 0;\n out:\n \treturn err;\n@@ -2502,6 +2553,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": [
        "v3",
        "1/1"
    ]
}