Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807189/?format=api
{ "id": 807189, "url": "http://patchwork.ozlabs.org/api/patches/807189/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170829171942.8974-3-tom@quantonium.net/", "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": "<20170829171942.8974-3-tom@quantonium.net>", "list_archive_url": null, "date": "2017-08-29T17:19:38", "name": "[net-next,2/6] udp: Constify skb argument in lookup functions", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "44cf135908bb0b97dd2f620e762f5914f45091a3", "submitter": { "id": 72064, "url": "http://patchwork.ozlabs.org/api/people/72064/?format=api", "name": "Tom Herbert", "email": "tom@quantonium.net" }, "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/20170829171942.8974-3-tom@quantonium.net/mbox/", "series": [ { "id": 418, "url": "http://patchwork.ozlabs.org/api/series/418/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=418", "date": "2017-08-29T17:19:36", "name": "flow_dissector: Protocol specific flow dissector offload", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/418/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807189/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807189/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=quantonium-net.20150623.gappssmtp.com\n\theader.i=@quantonium-net.20150623.gappssmtp.com\n\theader.b=\"fUxm7Boe\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xhb4M0VmQz9s76\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 03:20:19 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751329AbdH2RUQ (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 29 Aug 2017 13:20:16 -0400", "from mail-pf0-f179.google.com ([209.85.192.179]:35110 \"EHLO\n\tmail-pf0-f179.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751242AbdH2RUO (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 29 Aug 2017 13:20:14 -0400", "by mail-pf0-f179.google.com with SMTP id g13so12041251pfm.2\n\tfor <netdev@vger.kernel.org>; Tue, 29 Aug 2017 10:20:14 -0700 (PDT)", "from localhost.localdomain (67-207-98-108.static.wiline.com.\n\t[67.207.98.108]) by smtp.gmail.com with ESMTPSA id\n\tg63sm5694902pfb.79.2017.08.29.10.20.12\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 29 Aug 2017 10:20:12 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=quantonium-net.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=3WLdYEj9UhN22PHseW+cIR+yixbuaJSHMUnpdRtE1XM=;\n\tb=fUxm7BoeqHxBKSfY3z/YdBNRcgiEJ7NvcQCSN9CroXepk8tjaIuMX8ZytpLN3pqREy\n\tko/wikMJMSa1O7xYiC6On/KXMVU754rSgZ8Mf/5ZFZU0OCkQn3uCLHxz98P0aYIyKu4z\n\t8i0KBqgyqXMeEj2N38pjvNgEr9u9yOteJLPgX5Wc8zRktmC5hNe9CDcNBJzzqC2bXPeX\n\tq0qkbQ7ZiciYtTofFDrkBgymp03u47ab3LRCkqb6F9T4irz1dhGZOrv5bJqUOHe9Jve1\n\tyoFU7FC4ev/roFuWTUvIeDg9g1hCpTCxxLxTVc1h/3jyLH46brZGOe2cxF3X3GB+DHQ5\n\tcbag==", "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=3WLdYEj9UhN22PHseW+cIR+yixbuaJSHMUnpdRtE1XM=;\n\tb=Jmjgset9RsI7mNcM/cq07HKWkgGY9Jkf4gfal9cAZyfitU4R/O3dZY3DNr9FPzm4ZO\n\tvmSn3502t1V2YRaLXjOULiRIw63i3YVQy9kqzoSXfTtCiCaefKLipvidJllmH917KG+u\n\tYKUwFKsJT7ByGCP8gTEPbWr1JXdrCYTDlI19aAm6NqE8iXhTsDJ5+QXtUwemd3Xc7mLL\n\t204KCWuF0EW6jw21foYYmU/BqqrXwBjAE7MAa9U+O97im9BVAEvaVfmEpHSLwi2w9A5S\n\tfhKANsj7Ozw78+jdmte/N+Z/2wKcagBxCyPEkM1NMmW3COZbr28PspW6SFgi2EISR7HQ\n\tjOkg==", "X-Gm-Message-State": "AHYfb5idq7jubLmOjgdmafkd1l+fksIngKFhrJQWn5Q/Ld/3/aEQDKXW\n\tMYwea1XRv3C/sUyJ", "X-Received": "by 10.98.150.218 with SMTP id s87mr1097363pfk.74.1504027213741; \n\tTue, 29 Aug 2017 10:20:13 -0700 (PDT)", "From": "Tom Herbert <tom@quantonium.net>", "To": "davem@davemloft.net", "Cc": "netdev@vger.kernel.org, Tom Herbert <tom@quantonium.net>", "Subject": "[PATCH net-next 2/6] udp: Constify skb argument in lookup functions", "Date": "Tue, 29 Aug 2017 10:19:38 -0700", "Message-Id": "<20170829171942.8974-3-tom@quantonium.net>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170829171942.8974-1-tom@quantonium.net>", "References": "<20170829171942.8974-1-tom@quantonium.net>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "For UDP socket lookup functions, and associateed functions that take an\nskbuf as argument, declare the skb argument as constant.\n\nOne caveat is that reuseport_select_sock can be called from the UDP\nlookup functions with an skb argument. This function temporarily\nmodifies the skbuff data pointer (in bpf_run via a pull/push sequence).\nTo resolve compiler warning I added a local skbuf declaration that is\nnot const and assigned to the skb argument with an explicit cast.\n---\n include/net/ip.h | 2 +-\n include/net/sock_reuseport.h | 2 +-\n include/net/udp.h | 11 ++++++-----\n net/core/sock_reuseport.c | 5 +++--\n net/ipv4/udp.c | 11 ++++++-----\n net/ipv6/udp.c | 10 +++++-----\n 6 files changed, 22 insertions(+), 19 deletions(-)", "diff": "diff --git a/include/net/ip.h b/include/net/ip.h\nindex 9896f46cbbf1..8c0d84ffc659 100644\n--- a/include/net/ip.h\n+++ b/include/net/ip.h\n@@ -79,7 +79,7 @@ struct ipcm_cookie {\n #define PKTINFO_SKB_CB(skb) ((struct in_pktinfo *)((skb)->cb))\n \n /* return enslaved device index if relevant */\n-static inline int inet_sdif(struct sk_buff *skb)\n+static inline int inet_sdif(const struct sk_buff *skb)\n {\n #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)\n \tif (skb && ipv4_l3mdev_skb(IPCB(skb)->flags))\ndiff --git a/include/net/sock_reuseport.h b/include/net/sock_reuseport.h\nindex aecd30308d50..d25352a848d9 100644\n--- a/include/net/sock_reuseport.h\n+++ b/include/net/sock_reuseport.h\n@@ -20,7 +20,7 @@ extern int reuseport_add_sock(struct sock *sk, struct sock *sk2);\n extern void reuseport_detach_sock(struct sock *sk);\n extern struct sock *reuseport_select_sock(struct sock *sk,\n \t\t\t\t\t u32 hash,\n-\t\t\t\t\t struct sk_buff *skb,\n+\t\t\t\t\t const struct sk_buff *skb,\n \t\t\t\t\t int hdr_len);\n extern struct bpf_prog *reuseport_attach_prog(struct sock *sk,\n \t\t\t\t\t struct bpf_prog *prog);\ndiff --git a/include/net/udp.h b/include/net/udp.h\nindex 4e5f23fec35e..f3d1de6f0983 100644\n--- a/include/net/udp.h\n+++ b/include/net/udp.h\n@@ -167,7 +167,7 @@ static inline void udp_csum_pull_header(struct sk_buff *skb)\n \tUDP_SKB_CB(skb)->cscov -= sizeof(struct udphdr);\n }\n \n-typedef struct sock *(*udp_lookup_t)(struct sk_buff *skb, __be16 sport,\n+typedef struct sock *(*udp_lookup_t)(const struct sk_buff *skb, __be16 sport,\n \t\t\t\t __be16 dport);\n \n struct sk_buff **udp_gro_receive(struct sk_buff **head, struct sk_buff *skb,\n@@ -288,8 +288,9 @@ struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,\n \t\t\t __be32 daddr, __be16 dport, int dif);\n struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,\n \t\t\t __be32 daddr, __be16 dport, int dif, int sdif,\n-\t\t\t struct udp_table *tbl, struct sk_buff *skb);\n-struct sock *udp4_lib_lookup_skb(struct sk_buff *skb,\n+\t\t\t struct udp_table *tbl,\n+\t\t\t const struct sk_buff *skb);\n+struct sock *udp4_lib_lookup_skb(const struct sk_buff *skb,\n \t\t\t\t __be16 sport, __be16 dport);\n struct sock *udp6_lib_lookup(struct net *net,\n \t\t\t const struct in6_addr *saddr, __be16 sport,\n@@ -299,8 +300,8 @@ struct sock *__udp6_lib_lookup(struct net *net,\n \t\t\t const struct in6_addr *saddr, __be16 sport,\n \t\t\t const struct in6_addr *daddr, __be16 dport,\n \t\t\t int dif, int sdif, struct udp_table *tbl,\n-\t\t\t struct sk_buff *skb);\n-struct sock *udp6_lib_lookup_skb(struct sk_buff *skb,\n+\t\t\t const struct sk_buff *skb);\n+struct sock *udp6_lib_lookup_skb(const struct sk_buff *skb,\n \t\t\t\t __be16 sport, __be16 dport);\n \n /* UDP uses skb->dev_scratch to cache as much information as possible and avoid\ndiff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c\nindex eed1ebf7f29d..a17f13b33189 100644\n--- a/net/core/sock_reuseport.c\n+++ b/net/core/sock_reuseport.c\n@@ -164,9 +164,10 @@ void reuseport_detach_sock(struct sock *sk)\n EXPORT_SYMBOL(reuseport_detach_sock);\n \n static struct sock *run_bpf(struct sock_reuseport *reuse, u16 socks,\n-\t\t\t struct bpf_prog *prog, struct sk_buff *skb,\n+\t\t\t struct bpf_prog *prog, const struct sk_buff *_skb,\n \t\t\t int hdr_len)\n {\n+\tstruct sk_buff *skb = (struct sk_buff *)_skb; /* Override const */\n \tstruct sk_buff *nskb = NULL;\n \tu32 index;\n \n@@ -205,7 +206,7 @@ static struct sock *run_bpf(struct sock_reuseport *reuse, u16 socks,\n */\n struct sock *reuseport_select_sock(struct sock *sk,\n \t\t\t\t u32 hash,\n-\t\t\t\t struct sk_buff *skb,\n+\t\t\t\t const struct sk_buff *skb,\n \t\t\t\t int hdr_len)\n {\n \tstruct sock_reuseport *reuse;\ndiff --git a/net/ipv4/udp.c b/net/ipv4/udp.c\nindex bf6c406bf5e7..a851026ef28b 100644\n--- a/net/ipv4/udp.c\n+++ b/net/ipv4/udp.c\n@@ -135,7 +135,8 @@ EXPORT_SYMBOL(udp_memory_allocated);\n #define PORTS_PER_CHAIN (MAX_UDP_PORTS / UDP_HTABLE_SIZE_MIN)\n \n /* IPCB reference means this can not be used from early demux */\n-static bool udp_lib_exact_dif_match(struct net *net, struct sk_buff *skb)\n+static bool udp_lib_exact_dif_match(struct net *net,\n+\t\t\t\t const struct sk_buff *skb)\n {\n #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)\n \tif (!net->ipv4.sysctl_udp_l3mdev_accept &&\n@@ -445,7 +446,7 @@ static struct sock *udp4_lib_lookup2(struct net *net,\n \t\t\t\t __be32 daddr, unsigned int hnum,\n \t\t\t\t int dif, int sdif, bool exact_dif,\n \t\t\t\t struct udp_hslot *hslot2,\n-\t\t\t\t struct sk_buff *skb)\n+\t\t\t\t const struct sk_buff *skb)\n {\n \tstruct sock *sk, *result;\n \tint score, badness, matches = 0, reuseport = 0;\n@@ -484,7 +485,7 @@ static struct sock *udp4_lib_lookup2(struct net *net,\n */\n struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,\n \t\t__be16 sport, __be32 daddr, __be16 dport, int dif,\n-\t\tint sdif, struct udp_table *udptable, struct sk_buff *skb)\n+\t\tint sdif, struct udp_table *udptable, const struct sk_buff *skb)\n {\n \tstruct sock *sk, *result;\n \tunsigned short hnum = ntohs(dport);\n@@ -552,7 +553,7 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,\n }\n EXPORT_SYMBOL_GPL(__udp4_lib_lookup);\n \n-static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb,\n+static inline struct sock *__udp4_lib_lookup_skb(const struct sk_buff *skb,\n \t\t\t\t\t\t __be16 sport, __be16 dport,\n \t\t\t\t\t\t struct udp_table *udptable)\n {\n@@ -563,7 +564,7 @@ static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb,\n \t\t\t\t inet_sdif(skb), udptable, skb);\n }\n \n-struct sock *udp4_lib_lookup_skb(struct sk_buff *skb,\n+struct sock *udp4_lib_lookup_skb(const struct sk_buff *skb,\n \t\t\t\t __be16 sport, __be16 dport)\n {\n \treturn __udp4_lib_lookup_skb(skb, sport, dport, &udp_table);\ndiff --git a/net/ipv6/udp.c b/net/ipv6/udp.c\nindex 976f30391356..e9aa4db3ba53 100644\n--- a/net/ipv6/udp.c\n+++ b/net/ipv6/udp.c\n@@ -56,7 +56,7 @@\n #include <trace/events/skb.h>\n #include \"udp_impl.h\"\n \n-static bool udp6_lib_exact_dif_match(struct net *net, struct sk_buff *skb)\n+static bool udp6_lib_exact_dif_match(struct net *net, const struct sk_buff *skb)\n {\n #if defined(CONFIG_NET_L3_MASTER_DEV)\n \tif (!net->ipv4.sysctl_udp_l3mdev_accept &&\n@@ -181,7 +181,7 @@ static struct sock *udp6_lib_lookup2(struct net *net,\n \t\tconst struct in6_addr *saddr, __be16 sport,\n \t\tconst struct in6_addr *daddr, unsigned int hnum,\n \t\tint dif, int sdif, bool exact_dif,\n-\t\tstruct udp_hslot *hslot2, struct sk_buff *skb)\n+\t\tstruct udp_hslot *hslot2, const struct sk_buff *skb)\n {\n \tstruct sock *sk, *result;\n \tint score, badness, matches = 0, reuseport = 0;\n@@ -221,7 +221,7 @@ struct sock *__udp6_lib_lookup(struct net *net,\n \t\t\t const struct in6_addr *saddr, __be16 sport,\n \t\t\t const struct in6_addr *daddr, __be16 dport,\n \t\t\t int dif, int sdif, struct udp_table *udptable,\n-\t\t\t struct sk_buff *skb)\n+\t\t\t const struct sk_buff *skb)\n {\n \tstruct sock *sk, *result;\n \tunsigned short hnum = ntohs(dport);\n@@ -290,7 +290,7 @@ struct sock *__udp6_lib_lookup(struct net *net,\n }\n EXPORT_SYMBOL_GPL(__udp6_lib_lookup);\n \n-static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb,\n+static struct sock *__udp6_lib_lookup_skb(const struct sk_buff *skb,\n \t\t\t\t\t __be16 sport, __be16 dport,\n \t\t\t\t\t struct udp_table *udptable)\n {\n@@ -301,7 +301,7 @@ static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb,\n \t\t\t\t inet6_sdif(skb), udptable, skb);\n }\n \n-struct sock *udp6_lib_lookup_skb(struct sk_buff *skb,\n+struct sock *udp6_lib_lookup_skb(const struct sk_buff *skb,\n \t\t\t\t __be16 sport, __be16 dport)\n {\n \tconst struct ipv6hdr *iph = ipv6_hdr(skb);\n", "prefixes": [ "net-next", "2/6" ] }