Skip to content

Commit 10b2a44

Browse files
edumazetkuba-moo
authored andcommitted
inet6: constify 'struct net' parameter of various lookup helpers
Following helpers do not touch their struct net argument: - bpf_sk_lookup_run_v6() - __inet6_lookup_established() - inet6_lookup_reuseport() - inet6_lookup_listener() - inet6_lookup_run_sk_lookup() - __inet6_lookup() - inet6_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 b9abcbb commit 10b2a44

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

include/linux/filter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ static inline bool bpf_sk_lookup_run_v4(const struct net *net, int protocol,
16531653
}
16541654

16551655
#if IS_ENABLED(CONFIG_IPV6)
1656-
static inline bool bpf_sk_lookup_run_v6(struct net *net, int protocol,
1656+
static inline bool bpf_sk_lookup_run_v6(const struct net *net, int protocol,
16571657
const struct in6_addr *saddr,
16581658
const __be16 sport,
16591659
const struct in6_addr *daddr,

include/net/inet6_hashtables.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static inline unsigned int __inet6_ehashfn(const u32 lhash,
4040
*
4141
* The sockhash lock must be held as a reader here.
4242
*/
43-
struct sock *__inet6_lookup_established(struct net *net,
43+
struct sock *__inet6_lookup_established(const struct net *net,
4444
struct inet_hashinfo *hashinfo,
4545
const struct in6_addr *saddr,
4646
const __be16 sport,
@@ -56,15 +56,15 @@ inet6_ehashfn_t inet6_ehashfn;
5656

5757
INDIRECT_CALLABLE_DECLARE(inet6_ehashfn_t udp6_ehashfn);
5858

59-
struct sock *inet6_lookup_reuseport(struct net *net, struct sock *sk,
59+
struct sock *inet6_lookup_reuseport(const struct net *net, struct sock *sk,
6060
struct sk_buff *skb, int doff,
6161
const struct in6_addr *saddr,
6262
__be16 sport,
6363
const struct in6_addr *daddr,
6464
unsigned short hnum,
6565
inet6_ehashfn_t *ehashfn);
6666

67-
struct sock *inet6_lookup_listener(struct net *net,
67+
struct sock *inet6_lookup_listener(const struct net *net,
6868
struct inet_hashinfo *hashinfo,
6969
struct sk_buff *skb, int doff,
7070
const struct in6_addr *saddr,
@@ -73,7 +73,7 @@ struct sock *inet6_lookup_listener(struct net *net,
7373
const unsigned short hnum,
7474
const int dif, const int sdif);
7575

76-
struct sock *inet6_lookup_run_sk_lookup(struct net *net,
76+
struct sock *inet6_lookup_run_sk_lookup(const struct net *net,
7777
int protocol,
7878
struct sk_buff *skb, int doff,
7979
const struct in6_addr *saddr,
@@ -82,7 +82,7 @@ struct sock *inet6_lookup_run_sk_lookup(struct net *net,
8282
const u16 hnum, const int dif,
8383
inet6_ehashfn_t *ehashfn);
8484

85-
static inline struct sock *__inet6_lookup(struct net *net,
85+
static inline struct sock *__inet6_lookup(const struct net *net,
8686
struct inet_hashinfo *hashinfo,
8787
struct sk_buff *skb, int doff,
8888
const struct in6_addr *saddr,
@@ -167,7 +167,7 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
167167
iif, sdif, refcounted);
168168
}
169169

170-
struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
170+
struct sock *inet6_lookup(const struct net *net, struct inet_hashinfo *hashinfo,
171171
struct sk_buff *skb, int doff,
172172
const struct in6_addr *saddr, const __be16 sport,
173173
const struct in6_addr *daddr, const __be16 dport,

net/ipv6/inet6_hashtables.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ EXPORT_SYMBOL_GPL(inet6_ehashfn);
4646
*
4747
* The sockhash lock must be held as a reader here.
4848
*/
49-
struct sock *__inet6_lookup_established(struct net *net,
49+
struct sock *__inet6_lookup_established(const struct net *net,
5050
struct inet_hashinfo *hashinfo,
5151
const struct in6_addr *saddr,
5252
const __be16 sport,
@@ -126,7 +126,7 @@ static inline int compute_score(struct sock *sk, const struct net *net,
126126
* Return: NULL if sk doesn't have SO_REUSEPORT set, otherwise a pointer to
127127
* the selected sock or an error.
128128
*/
129-
struct sock *inet6_lookup_reuseport(struct net *net, struct sock *sk,
129+
struct sock *inet6_lookup_reuseport(const struct net *net, struct sock *sk,
130130
struct sk_buff *skb, int doff,
131131
const struct in6_addr *saddr,
132132
__be16 sport,
@@ -147,7 +147,7 @@ struct sock *inet6_lookup_reuseport(struct net *net, struct sock *sk,
147147
EXPORT_SYMBOL_GPL(inet6_lookup_reuseport);
148148

149149
/* called with rcu_read_lock() */
150-
static struct sock *inet6_lhash2_lookup(struct net *net,
150+
static struct sock *inet6_lhash2_lookup(const struct net *net,
151151
struct inet_listen_hashbucket *ilb2,
152152
struct sk_buff *skb, int doff,
153153
const struct in6_addr *saddr,
@@ -174,7 +174,7 @@ static struct sock *inet6_lhash2_lookup(struct net *net,
174174
return result;
175175
}
176176

177-
struct sock *inet6_lookup_run_sk_lookup(struct net *net,
177+
struct sock *inet6_lookup_run_sk_lookup(const struct net *net,
178178
int protocol,
179179
struct sk_buff *skb, int doff,
180180
const struct in6_addr *saddr,
@@ -199,7 +199,7 @@ struct sock *inet6_lookup_run_sk_lookup(struct net *net,
199199
}
200200
EXPORT_SYMBOL_GPL(inet6_lookup_run_sk_lookup);
201201

202-
struct sock *inet6_lookup_listener(struct net *net,
202+
struct sock *inet6_lookup_listener(const struct net *net,
203203
struct inet_hashinfo *hashinfo,
204204
struct sk_buff *skb, int doff,
205205
const struct in6_addr *saddr,
@@ -243,7 +243,8 @@ struct sock *inet6_lookup_listener(struct net *net,
243243
}
244244
EXPORT_SYMBOL_GPL(inet6_lookup_listener);
245245

246-
struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
246+
struct sock *inet6_lookup(const struct net *net,
247+
struct inet_hashinfo *hashinfo,
247248
struct sk_buff *skb, int doff,
248249
const struct in6_addr *saddr, const __be16 sport,
249250
const struct in6_addr *daddr, const __be16 dport,

0 commit comments

Comments
 (0)