get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 851558,
    "url": "http://patchwork.ozlabs.org/api/patches/851558/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20171220170607.41516-3-lorenzo@google.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": "<20171220170607.41516-3-lorenzo@google.com>",
    "list_archive_url": null,
    "date": "2017-12-20T17:06:02",
    "name": "[ipsec-next,2/7] net: ipv4: Add new flags to tunnel lookup.",
    "commit_ref": null,
    "pull_url": null,
    "state": "awaiting-upstream",
    "archived": true,
    "hash": "8b45f774c6f7a72c3af66891529fcc64dc6002a7",
    "submitter": {
        "id": 3403,
        "url": "http://patchwork.ozlabs.org/api/people/3403/?format=api",
        "name": "Lorenzo Colitti",
        "email": "lorenzo@google.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/20171220170607.41516-3-lorenzo@google.com/mbox/",
    "series": [
        {
            "id": 19695,
            "url": "http://patchwork.ozlabs.org/api/series/19695/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=19695",
            "date": "2017-12-20T17:06:00",
            "name": ": Support multiple VTIs with the same src+dst pair",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/19695/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/851558/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/851558/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=google.com header.i=@google.com\n\theader.b=\"h8U7v7bD\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3z21R534BGz9s83\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 21 Dec 2017 04:07:13 +1100 (AEDT)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755615AbdLTRGh (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 20 Dec 2017 12:06:37 -0500",
            "from mail-pg0-f68.google.com ([74.125.83.68]:37573 \"EHLO\n\tmail-pg0-f68.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1753452AbdLTRGa (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 20 Dec 2017 12:06:30 -0500",
            "by mail-pg0-f68.google.com with SMTP id o13so1410447pgp.4\n\tfor <netdev@vger.kernel.org>; Wed, 20 Dec 2017 09:06:30 -0800 (PST)",
            "from lorenzo.tok.corp.google.com ([100.103.3.232])\n\tby smtp.gmail.com with ESMTPSA id\n\tt62sm29103067pgt.23.2017.12.20.09.06.27\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 20 Dec 2017 09:06:28 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=google.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=E9/kNJjVaBws9ibGb8hCsNgLrtLjyDytdiO//N0da6E=;\n\tb=h8U7v7bDFSRQlb0uPbVVQzQ1sKMeYlfJw0+08zJkZPITJkugQHLSBCNy93pMU2Q/6i\n\txiG38MQ2IxwDfOkToR8xSY37YIJ1gbV78mfq9OSzKR6vvjbBLVKOnJFyTL+MZ1hkxXgg\n\thiP52hrNBats6bepa5WrbLe2iJ2Y6oaajFBP0LGJYYBD5Jh6y+y7BLNNmNNUILWdBD9v\n\tWYjbTb5uad0edzeEIRaWV91jQtJz66Eao4dDpxLgOBrrRq3UVcxT5UuKtCD1ZpEZ4MVy\n\tGoLAGRaCaXNaD1iZ50JfxEStYsmquF2osXmgEjjChze0CGaeHveT9TuN9KQbtxW0wGdT\n\t2ftg==",
        "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=E9/kNJjVaBws9ibGb8hCsNgLrtLjyDytdiO//N0da6E=;\n\tb=Lu2caMWZuB31AybKXZHTRMW+bMBZF1vEHLBuU4x/UOK1Y+w8yxXJF3T9+5nD25LFmZ\n\tAiQLvQeNFxOHMLLpPBpubzU4i3c+UUFJYZ3RqFDEaFDAJLRgNPbfGHUOtqrne89udffR\n\tuJhaTyM+41ekt+Gd9BhMA4BtYGxfnTqNPIKhLy53wXW1aulVGm4dOFnrfuub1m3dj1ON\n\t4DwZ/AOHsM1wNykuRuVr5r5yQcbx5q/hFxj44CInr1+R5bNCbrRB8k+pAbTXXjQP/bRk\n\tNKvEkkrFE9wUZAtXVmYes9iG35f1xkOhWI5/ZxMHq7iSjQttUXAoe/Aief0uDWqBPNxR\n\tzVHg==",
        "X-Gm-Message-State": "AKGB3mI4fEM+Zs1XzplSRtHfUET7/KhTHgqmUmZrBs1dp44K+angv6Ff\n\t+rDTUKQXpC0+Bt7oE/mbWdOl2lYQVjw=",
        "X-Google-Smtp-Source": "ACJfBouJUOOOV8MRZaB/hWt5ErUskOLMs2z3+/6AzactL9BzLxX0XFUmGrZ0AVoUGNBvjFKAhAjD0A==",
        "X-Received": "by 10.99.124.16 with SMTP id x16mr7035756pgc.124.1513789589356; \n\tWed, 20 Dec 2017 09:06:29 -0800 (PST)",
        "From": "Lorenzo Colitti <lorenzo@google.com>",
        "To": "netdev@vger.kernel.org",
        "Cc": "steffen.klassert@secunet.com, subashab@codeaurora.org,\n\tnharold@google.com, davem@davemloft.net,\n\tLorenzo Colitti <lorenzo@google.com>",
        "Subject": "[PATCH ipsec-next 2/7] net: ipv4: Add new flags to tunnel lookup.",
        "Date": "Thu, 21 Dec 2017 02:06:02 +0900",
        "Message-Id": "<20171220170607.41516-3-lorenzo@google.com>",
        "X-Mailer": "git-send-email 2.15.1.620.gb9897f4670-goog",
        "In-Reply-To": "<20171220170607.41516-1-lorenzo@google.com>",
        "References": "<20171220170607.41516-1-lorenzo@google.com>",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "This patch adds support for two new flags to ip_tunnel_lookup.\n\n- TUNNEL_LOOKUP_NO_KEY: ignores the tunnel's i_key when\n  determining which hash bucket to look up the tunnel in. This is\n  useful for tunnels such as VTI, which have i_keys, but are\n  always hashed into bucket 0.\n- TUNNEL_LOOKUP_OKEY: finds the tunnel by o_key instead of i_key.\n\nTogether, these flags allow processing ICMP errors correctly on\nkeyed tunnels where i_key != o_key. If such tunnels receive an\nICMP error, the only information available in the packet is the\no_key, so we must be able to find a tunnel by o_key alone. For\nthat to work, the tunnel hash must not depend on the i_key,\nbecause if it does, we won't be able to find it by o_key alone.\n\nTUNNEL_LOOKUP_NO_KEY is very similar to TUNNEL_NO_KEY so it might\nbe possible just to use TUNNEL_NO_KEY instead. However, it might\nbe confusing to see code simultaneously pass in both TUNNEL_NO_KEY\nand TUNNEL_KEY.\n\nThese flags are numbered separately from tunnel flags because\nthey are not tunnel properties but properties of tunnel lookups.\n(Also, the tunnel flags are 16 bits and all but one is unused.)\n\nThe flags are passed into ip_lookup by adding a new parameter.\nThis could also be done by expanding the existing flags parameter\nfrom __be16 to __be32 and ensuring that the new flags are all\nabove the 16-bit boundary.\n\nSigned-off-by: Lorenzo Colitti <lorenzo@google.com>\n---\n include/net/ip_tunnels.h |  6 +++++-\n net/ipv4/ip_gre.c        |  6 +++---\n net/ipv4/ip_tunnel.c     | 22 +++++++++++++---------\n net/ipv4/ip_vti.c        |  4 ++--\n net/ipv4/ipip.c          |  6 +++---\n 5 files changed, 26 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h\nindex 1f16773cfd..19d97b993a 100644\n--- a/include/net/ip_tunnels.h\n+++ b/include/net/ip_tunnels.h\n@@ -163,6 +163,10 @@ struct ip_tunnel {\n #define TUNNEL_OPTIONS_PRESENT \\\n \t\t(TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT | TUNNEL_ERSPAN_OPT)\n \n+/* Flags for ip_tunnel_lookup. */\n+#define TUNNEL_LOOKUP_NO_KEY\t0x01\n+#define TUNNEL_LOOKUP_OKEY\t0x02\n+\n struct tnl_ptk_info {\n \t__be16 flags;\n \t__be16 proto;\n@@ -276,7 +280,7 @@ int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);\n void ip_tunnel_get_stats64(struct net_device *dev,\n \t\t\t   struct rtnl_link_stats64 *tot);\n struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,\n-\t\t\t\t   int link, __be16 flags,\n+\t\t\t\t   int link, __be16 flags, u8 lookup_flags,\n \t\t\t\t   __be32 remote, __be32 local,\n \t\t\t\t   __be32 key);\n \ndiff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c\nindex fd4d6e96da..f16a46cb19 100644\n--- a/net/ipv4/ip_gre.c\n+++ b/net/ipv4/ip_gre.c\n@@ -182,7 +182,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info,\n \t\titn = net_generic(net, ipgre_net_id);\n \n \tiph = (const struct iphdr *)(icmp_hdr(skb) + 1);\n-\tt = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags,\n+\tt = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags, 0,\n \t\t\t     iph->daddr, iph->saddr, tpi->key);\n \n \tif (!t)\n@@ -280,7 +280,7 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,\n \t */\n \ttpi->key = cpu_to_be32(ntohs(ershdr->session_id) & ID_MASK);\n \ttunnel = ip_tunnel_lookup(itn, skb->dev->ifindex,\n-\t\t\t\t  tpi->flags | TUNNEL_KEY,\n+\t\t\t\t  tpi->flags | TUNNEL_KEY, 0,\n \t\t\t\t  iph->saddr, iph->daddr, tpi->key);\n \n \tif (tunnel) {\n@@ -356,7 +356,7 @@ static int __ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,\n \tstruct ip_tunnel *tunnel;\n \n \tiph = ip_hdr(skb);\n-\ttunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags,\n+\ttunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags, 0,\n \t\t\t\t  iph->saddr, iph->daddr, tpi->key);\n \n \tif (tunnel) {\ndiff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c\nindex 539c8f22c4..f45968bb81 100644\n--- a/net/ipv4/ip_tunnel.c\n+++ b/net/ipv4/ip_tunnel.c\n@@ -70,11 +70,13 @@ static unsigned int ip_tunnel_hash(__be32 key, __be32 remote)\n }\n \n static bool ip_tunnel_key_match(const struct ip_tunnel_parm *p,\n-\t\t\t\t__be16 flags, __be32 key)\n+\t\t\t\t__be32 flags, u8 lookup_flags, __be32 key)\n {\n+\t__be32 tunnel_key = (lookup_flags & TUNNEL_LOOKUP_OKEY) ? p->o_key :\n+\t\t\t\t\t\t\t\t  p->i_key;\n \tif (p->i_flags & TUNNEL_KEY) {\n \t\tif (flags & TUNNEL_KEY)\n-\t\t\treturn key == p->i_key;\n+\t\t\treturn key == tunnel_key;\n \t\telse\n \t\t\t/* key expected, none present */\n \t\t\treturn false;\n@@ -94,15 +96,17 @@ static bool ip_tunnel_key_match(const struct ip_tunnel_parm *p,\n    Given src, dst and key, find appropriate for input tunnel.\n */\n struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,\n-\t\t\t\t   int link, __be16 flags,\n+\t\t\t\t   int link, __be16 flags, u8 lookup_flags,\n \t\t\t\t   __be32 remote, __be32 local,\n \t\t\t\t   __be32 key)\n {\n \tunsigned int hash;\n \tstruct ip_tunnel *t, *cand = NULL;\n \tstruct hlist_head *head;\n+\t__be32 hash_key;\n \n-\thash = ip_tunnel_hash(key, remote);\n+\thash_key = (lookup_flags & TUNNEL_LOOKUP_NO_KEY) ? 0 : key;\n+\thash = ip_tunnel_hash(hash_key, remote);\n \thead = &itn->tunnels[hash];\n \n \thlist_for_each_entry_rcu(t, head, hash_node) {\n@@ -111,7 +115,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,\n \t\t    !(t->dev->flags & IFF_UP))\n \t\t\tcontinue;\n \n-\t\tif (!ip_tunnel_key_match(&t->parms, flags, key))\n+\t\tif (!ip_tunnel_key_match(&t->parms, flags, lookup_flags, key))\n \t\t\tcontinue;\n \n \t\tif (t->parms.link == link)\n@@ -126,7 +130,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,\n \t\t    !(t->dev->flags & IFF_UP))\n \t\t\tcontinue;\n \n-\t\tif (!ip_tunnel_key_match(&t->parms, flags, key))\n+\t\tif (!ip_tunnel_key_match(&t->parms, flags, lookup_flags, key))\n \t\t\tcontinue;\n \n \t\tif (t->parms.link == link)\n@@ -135,7 +139,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,\n \t\t\tcand = t;\n \t}\n \n-\thash = ip_tunnel_hash(key, 0);\n+\thash = ip_tunnel_hash(hash_key, 0);\n \thead = &itn->tunnels[hash];\n \n \thlist_for_each_entry_rcu(t, head, hash_node) {\n@@ -146,7 +150,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,\n \t\tif (!(t->dev->flags & IFF_UP))\n \t\t\tcontinue;\n \n-\t\tif (!ip_tunnel_key_match(&t->parms, flags, key))\n+\t\tif (!ip_tunnel_key_match(&t->parms, flags, lookup_flags, key))\n \t\t\tcontinue;\n \n \t\tif (t->parms.link == link)\n@@ -238,7 +242,7 @@ static struct ip_tunnel *ip_tunnel_find(struct ip_tunnel_net *itn,\n \t\t    remote == t->parms.iph.daddr &&\n \t\t    link == t->parms.link &&\n \t\t    type == t->dev->type &&\n-\t\t    ip_tunnel_key_match(&t->parms, flags, key))\n+\t\t    ip_tunnel_key_match(&t->parms, flags, 0, key))\n \t\t\tbreak;\n \t}\n \treturn t;\ndiff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c\nindex 949f432a5f..804cee8126 100644\n--- a/net/ipv4/ip_vti.c\n+++ b/net/ipv4/ip_vti.c\n@@ -57,7 +57,7 @@ static int vti_input(struct sk_buff *skb, int nexthdr, __be32 spi,\n \tstruct net *net = dev_net(skb->dev);\n \tstruct ip_tunnel_net *itn = net_generic(net, vti_net_id);\n \n-\ttunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY,\n+\ttunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, 0,\n \t\t\t\t  iph->saddr, iph->daddr, 0);\n \tif (tunnel) {\n \t\tif (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))\n@@ -278,7 +278,7 @@ static int vti4_err(struct sk_buff *skb, u32 info)\n \tint protocol = iph->protocol;\n \tstruct ip_tunnel_net *itn = net_generic(net, vti_net_id);\n \n-\ttunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY,\n+\ttunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, 0,\n \t\t\t\t  iph->daddr, iph->saddr, 0);\n \tif (!tunnel)\n \t\treturn -1;\ndiff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c\nindex c891235b49..81f94ffb92 100644\n--- a/net/ipv4/ipip.c\n+++ b/net/ipv4/ipip.c\n@@ -167,7 +167,7 @@ static int ipip_err(struct sk_buff *skb, u32 info)\n \t\tgoto out;\n \t}\n \n-\tt = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY,\n+\tt = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, 0,\n \t\t\t     iph->daddr, iph->saddr, 0);\n \tif (!t) {\n \t\terr = -ENOENT;\n@@ -224,8 +224,8 @@ static int ipip_tunnel_rcv(struct sk_buff *skb, u8 ipproto)\n \tconst struct iphdr *iph;\n \n \tiph = ip_hdr(skb);\n-\ttunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY,\n-\t\t\tiph->saddr, iph->daddr, 0);\n+\ttunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, 0,\n+\t\t\t\t  iph->saddr, iph->daddr, 0);\n \tif (tunnel) {\n \t\tconst struct tnl_ptk_info *tpi;\n \n",
    "prefixes": [
        "ipsec-next",
        "2/7"
    ]
}