get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 817707,
    "url": "http://patchwork.ozlabs.org/api/patches/817707/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/7c11317cb4794fcd016caeff8d23da3bd2911d7d.1506114055.git.pabeni@redhat.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": "<7c11317cb4794fcd016caeff8d23da3bd2911d7d.1506114055.git.pabeni@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-22T21:06:31",
    "name": "[RFC,07/11] ipv6/addrconf: add an helper for inet6 address lookup",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "36a9113025a8053e14877c5e4bcb742918648a72",
    "submitter": {
        "id": 67312,
        "url": "http://patchwork.ozlabs.org/api/people/67312/?format=api",
        "name": "Paolo Abeni",
        "email": "pabeni@redhat.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/7c11317cb4794fcd016caeff8d23da3bd2911d7d.1506114055.git.pabeni@redhat.com/mbox/",
    "series": [
        {
            "id": 4709,
            "url": "http://patchwork.ozlabs.org/api/series/4709/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=4709",
            "date": "2017-09-22T21:06:24",
            "name": "udp: full early demux for unconnected sockets",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/4709/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/817707/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/817707/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>)",
            "ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=pabeni@redhat.com"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xzQzL4s1Zz9sP1\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 23 Sep 2017 07:07:26 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752739AbdIVVHM (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 22 Sep 2017 17:07:12 -0400",
            "from mx1.redhat.com ([209.132.183.28]:42882 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1752730AbdIVVHK (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tFri, 22 Sep 2017 17:07:10 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 8FCBF7CDEA;\n\tFri, 22 Sep 2017 21:07:10 +0000 (UTC)",
            "from dhcppc0.redhat.com (ovpn-116-39.ams2.redhat.com\n\t[10.36.116.39])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id D30CE61F52;\n\tFri, 22 Sep 2017 21:07:08 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 8FCBF7CDEA",
        "From": "Paolo Abeni <pabeni@redhat.com>",
        "To": "netdev@vger.kernel.org",
        "Cc": "\"David S. Miller\" <davem@davemloft.net>,\n\tPablo Neira Ayuso <pablo@netfilter.org>, Florian Westphal <fw@strlen.de>,\n\tEric Dumazet <edumazet@google.com>,\n\tHannes Frederic Sowa <hannes@stressinduktion.org>",
        "Subject": "[RFC PATCH 07/11] ipv6/addrconf: add an helper for inet6 address\n\tlookup",
        "Date": "Fri, 22 Sep 2017 23:06:31 +0200",
        "Message-Id": "<7c11317cb4794fcd016caeff8d23da3bd2911d7d.1506114055.git.pabeni@redhat.com>",
        "In-Reply-To": "<cover.1506114055.git.pabeni@redhat.com>",
        "References": "<cover.1506114055.git.pabeni@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.28]);\n\tFri, 22 Sep 2017 21:07:10 +0000 (UTC)",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "reduce code duplication and will simplify follow-up patch\n\nSigned-off-by: Paolo Abeni <pabeni@redhat.com>\n---\n net/ipv6/addrconf.c | 65 +++++++++++++++++++++++++----------------------------\n 1 file changed, 31 insertions(+), 34 deletions(-)",
    "diff": "diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c\nindex c2e2a78787ec..5940062cac8d 100644\n--- a/net/ipv6/addrconf.c\n+++ b/net/ipv6/addrconf.c\n@@ -1796,35 +1796,46 @@ int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,\n }\n EXPORT_SYMBOL(ipv6_chk_addr);\n \n+/* called under RCU lock with bh disabled */\n+static struct inet6_ifaddr *ipv6_lookup_ifaddr_rcu_bh(struct net *net,\n+\t\t\t\t\t\t    const struct in6_addr *addr)\n+{\n+\tunsigned int hash = inet6_addr_hash(addr);\n+\tstruct inet6_ifaddr *ifp;\n+\n+\thlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[hash], addr_lst)\n+\t\tif (net_eq(dev_net(ifp->idev->dev), net) &&\n+\t\t    ipv6_addr_equal(&ifp->addr, addr))\n+\t\t\treturn ifp;\n+\n+\treturn NULL;\n+}\n+\n int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,\n \t\t\t    const struct net_device *dev, int strict,\n \t\t\t    u32 banned_flags)\n {\n \tstruct inet6_ifaddr *ifp;\n-\tunsigned int hash = inet6_addr_hash(addr);\n \tu32 ifp_flags;\n+\tint ret = 0;\n \n \trcu_read_lock_bh();\n-\thlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) {\n-\t\tif (!net_eq(dev_net(ifp->idev->dev), net))\n-\t\t\tcontinue;\n+\tifp = ipv6_lookup_ifaddr_rcu_bh(net, addr);\n+\tif (ifp) {\n \t\t/* Decouple optimistic from tentative for evaluation here.\n \t\t * Ban optimistic addresses explicitly, when required.\n \t\t */\n \t\tifp_flags = (ifp->flags&IFA_F_OPTIMISTIC)\n \t\t\t    ? (ifp->flags&~IFA_F_TENTATIVE)\n \t\t\t    : ifp->flags;\n-\t\tif (ipv6_addr_equal(&ifp->addr, addr) &&\n-\t\t    !(ifp_flags&banned_flags) &&\n+\t\tif (!(ifp_flags&banned_flags) &&\n \t\t    (!dev || ifp->idev->dev == dev ||\n-\t\t     !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) {\n-\t\t\trcu_read_unlock_bh();\n-\t\t\treturn 1;\n-\t\t}\n+\t\t     !(ifp->scope&(IFA_LINK|IFA_HOST) || strict)))\n+\t\t\tret = 1;\n \t}\n \n \trcu_read_unlock_bh();\n-\treturn 0;\n+\treturn ret;\n }\n EXPORT_SYMBOL(ipv6_chk_addr_and_flags);\n \n@@ -1900,20 +1911,13 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *add\n \t\t\t\t     struct net_device *dev, int strict)\n {\n \tstruct inet6_ifaddr *ifp, *result = NULL;\n-\tunsigned int hash = inet6_addr_hash(addr);\n \n \trcu_read_lock_bh();\n-\thlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[hash], addr_lst) {\n-\t\tif (!net_eq(dev_net(ifp->idev->dev), net))\n-\t\t\tcontinue;\n-\t\tif (ipv6_addr_equal(&ifp->addr, addr)) {\n-\t\t\tif (!dev || ifp->idev->dev == dev ||\n-\t\t\t    !(ifp->scope&(IFA_LINK|IFA_HOST) || strict)) {\n-\t\t\t\tresult = ifp;\n-\t\t\t\tin6_ifa_hold(ifp);\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t}\n+\tifp = ipv6_lookup_ifaddr_rcu_bh(net, addr);\n+\tif (ifp && (!dev || ifp->idev->dev == dev ||\n+\t\t    !(ifp->scope & (IFA_LINK|IFA_HOST) || strict))) {\n+\t\tresult = ifp;\n+\t\tin6_ifa_hold(ifp);\n \t}\n \trcu_read_unlock_bh();\n \n@@ -4226,20 +4230,13 @@ void if6_proc_exit(void)\n /* Check if address is a home address configured on any interface. */\n int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr)\n {\n-\tint ret = 0;\n \tstruct inet6_ifaddr *ifp = NULL;\n-\tunsigned int hash = inet6_addr_hash(addr);\n+\tint ret = 0;\n \n \trcu_read_lock_bh();\n-\thlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[hash], addr_lst) {\n-\t\tif (!net_eq(dev_net(ifp->idev->dev), net))\n-\t\t\tcontinue;\n-\t\tif (ipv6_addr_equal(&ifp->addr, addr) &&\n-\t\t    (ifp->flags & IFA_F_HOMEADDRESS)) {\n-\t\t\tret = 1;\n-\t\t\tbreak;\n-\t\t}\n-\t}\n+\tifp = ipv6_lookup_ifaddr_rcu_bh(net, addr);\n+\tif (ifp && ifp->flags & IFA_F_HOMEADDRESS)\n+\t\tret = 1;\n \trcu_read_unlock_bh();\n \treturn ret;\n }\n",
    "prefixes": [
        "RFC",
        "07/11"
    ]
}