Skip to content

Commit 87d973e

Browse files
edumazetkuba-moo
authored andcommitted
ipv6: udp: constify 'struct net' parameter of socket lookups
Following helpers do not touch their 'struct net' argument. - udp6_lib_lookup() - __udp6_lib_lookup() Signed-off-by: Eric Dumazet <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 10b2a44 commit 87d973e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

include/net/ipv6_stubs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ extern const struct ipv6_stub *ipv6_stub __read_mostly;
8282
struct ipv6_bpf_stub {
8383
int (*inet6_bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len,
8484
u32 flags);
85-
struct sock *(*udp6_lib_lookup)(struct net *net,
85+
struct sock *(*udp6_lib_lookup)(const struct net *net,
8686
const struct in6_addr *saddr, __be16 sport,
8787
const struct in6_addr *daddr, __be16 dport,
8888
int dif, int sdif, struct udp_table *tbl,

include/net/udp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,11 @@ struct sock *__udp4_lib_lookup(const struct net *net, __be32 saddr,
305305
struct udp_table *tbl, struct sk_buff *skb);
306306
struct sock *udp4_lib_lookup_skb(const struct sk_buff *skb,
307307
__be16 sport, __be16 dport);
308-
struct sock *udp6_lib_lookup(struct net *net,
308+
struct sock *udp6_lib_lookup(const struct net *net,
309309
const struct in6_addr *saddr, __be16 sport,
310310
const struct in6_addr *daddr, __be16 dport,
311311
int dif);
312-
struct sock *__udp6_lib_lookup(struct net *net,
312+
struct sock *__udp6_lib_lookup(const struct net *net,
313313
const struct in6_addr *saddr, __be16 sport,
314314
const struct in6_addr *daddr, __be16 dport,
315315
int dif, int sdif, struct udp_table *tbl,

net/ipv6/udp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void udp_v6_rehash(struct sock *sk)
114114
udp_lib_rehash(sk, new_hash);
115115
}
116116

117-
static int compute_score(struct sock *sk, struct net *net,
117+
static int compute_score(struct sock *sk, const struct net *net,
118118
const struct in6_addr *saddr, __be16 sport,
119119
const struct in6_addr *daddr, unsigned short hnum,
120120
int dif, int sdif)
@@ -160,7 +160,7 @@ static int compute_score(struct sock *sk, struct net *net,
160160
}
161161

162162
/* called with rcu_read_lock() */
163-
static struct sock *udp6_lib_lookup2(struct net *net,
163+
static struct sock *udp6_lib_lookup2(const struct net *net,
164164
const struct in6_addr *saddr, __be16 sport,
165165
const struct in6_addr *daddr, unsigned int hnum,
166166
int dif, int sdif, struct udp_hslot *hslot2,
@@ -217,7 +217,7 @@ static struct sock *udp6_lib_lookup2(struct net *net,
217217
}
218218

219219
/* rcu_read_lock() must be held */
220-
struct sock *__udp6_lib_lookup(struct net *net,
220+
struct sock *__udp6_lib_lookup(const struct net *net,
221221
const struct in6_addr *saddr, __be16 sport,
222222
const struct in6_addr *daddr, __be16 dport,
223223
int dif, int sdif, struct udp_table *udptable,
@@ -300,7 +300,7 @@ struct sock *udp6_lib_lookup_skb(const struct sk_buff *skb,
300300
* Does increment socket refcount.
301301
*/
302302
#if IS_ENABLED(CONFIG_NF_TPROXY_IPV6) || IS_ENABLED(CONFIG_NF_SOCKET_IPV6)
303-
struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be16 sport,
303+
struct sock *udp6_lib_lookup(const struct net *net, const struct in6_addr *saddr, __be16 sport,
304304
const struct in6_addr *daddr, __be16 dport, int dif)
305305
{
306306
struct sock *sk;

0 commit comments

Comments
 (0)