Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807350/?format=api
{ "id": 807350, "url": "http://patchwork.ozlabs.org/api/patches/807350/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170829232711.1465-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": "<20170829232711.1465-3-tom@quantonium.net>", "list_archive_url": null, "date": "2017-08-29T23:27:07", "name": "[v2,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/20170829232711.1465-3-tom@quantonium.net/mbox/", "series": [ { "id": 503, "url": "http://patchwork.ozlabs.org/api/series/503/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=503", "date": "2017-08-29T23:27:05", "name": "flow_dissector: Protocol specific flow dissector offload", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/503/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807350/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807350/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=\"n/9v2hWQ\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xhlDF0wNbz9s9Y\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 09:27:41 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751763AbdH2X1i (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 29 Aug 2017 19:27:38 -0400", "from mail-pf0-f176.google.com ([209.85.192.176]:36397 \"EHLO\n\tmail-pf0-f176.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751725AbdH2X1g (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 29 Aug 2017 19:27:36 -0400", "by mail-pf0-f176.google.com with SMTP id z87so14318836pfi.3\n\tfor <netdev@vger.kernel.org>; Tue, 29 Aug 2017 16:27:36 -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\tr73sm6445593pfa.143.2017.08.29.16.27.34\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 29 Aug 2017 16:27:35 -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=5m223QBIDHtku1zCocpcsc6xAiCZ/guL5Xl7+QaDXYM=;\n\tb=n/9v2hWQzRlsLnFCSc3Uv11xnINySBLIRJF3yNy89+qH+ACoJCuLt8V0IH6ZcdPWy/\n\tCJ/PGdzkaRiFfV2eEcg/aYTXMhznB0J/jQ0rUsT1yjrxoWVt1MvNRmBd1owOjv0RTu0W\n\t0cKE37mhSUS6NwV3IfUX5VSc6zYNUXKP3dsNzEMtxg2WEUuCAcHJznXuOnGSNIEZjlYp\n\taVqSJGhJRvJbP1zT2y16qf8Z60DOOeM6EoELaNqczbwwxbhFJc1PdqB+cb3/oYcIviZL\n\tIdrfUxOvgCYw4ZZ4modc7KWpd+GA1lEpy46mXc9e6FHZIdFIBvMxxjfGDWDr5iawyvBS\n\t7s9Q==", "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=5m223QBIDHtku1zCocpcsc6xAiCZ/guL5Xl7+QaDXYM=;\n\tb=cv/jNgkvcDg24Z7n9SPrrLaJ6SDkWQ3i6Nc/DKlxhn4fO32RBtnueDzutQ4WZBU5PI\n\tHUh8ly58P+o23Wy+u7PusL3VocNgaJCEANtSBp/0K8v7m2xOzzl5K6zypggKqG53jFHq\n\tDTWLb/x6F0iN+NcvGT0XXLyEk31X//Kwv/2dx0sdQkG6Lm3CTawWfM8MdCkuonrbvbtv\n\t9+cpLFwZfcInbGYrgfFA8idBKxcpdZVD4KzX80sbP93uM5mFdp9zpf0N7TqzkMPJ3cIX\n\tsIEhZOYPRAGQrSh90EpRT+lv6yXnNJWLpn4Qh7N0qFQ68iYFmis3OH6LTF/iQZ2nW1X7\n\thFUg==", "X-Gm-Message-State": "AHYfb5iBioacu7XQXt98MU1fS1lYW9x8hc8v0cQjkQgt1dNjUNwvBRCe\n\tz5k8B/0OL1vEbvxvGeM=", "X-Received": "by 10.99.191.1 with SMTP id v1mr1861390pgf.194.1504049255767;\n\tTue, 29 Aug 2017 16:27:35 -0700 (PDT)", "From": "Tom Herbert <tom@quantonium.net>", "To": "davem@davemloft.net", "Cc": "netdev@vger.kernel.org, Tom Herbert <tom@quantonium.net>", "Subject": "[PATCH v2 net-next 2/6] udp: Constify skb argument in lookup\n\tfunctions", "Date": "Tue, 29 Aug 2017 16:27:07 -0700", "Message-Id": "<20170829232711.1465-3-tom@quantonium.net>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170829232711.1465-1-tom@quantonium.net>", "References": "<20170829232711.1465-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\nSigned-off-by: Tom Herbert <tom@quantonium.net>\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": [ "v2", "net-next", "2/6" ] }