Skip to content

Commit a2dc7be

Browse files
edumazetkuba-moo
authored andcommitted
inet: constify inet_sk_bound_dev_eq() net parameter
inet_sk_bound_dev_eq() and its callers do not modify the net structure. 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 10a6545 commit a2dc7be

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

include/net/inet6_hashtables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
175175

176176
int inet6_hash(struct sock *sk);
177177

178-
static inline bool inet6_match(struct net *net, const struct sock *sk,
178+
static inline bool inet6_match(const struct net *net, const struct sock *sk,
179179
const struct in6_addr *saddr,
180180
const struct in6_addr *daddr,
181181
const __portpair ports,

include/net/inet_hashtables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static inline struct sock *inet_lookup_listener(struct net *net,
351351
((__force __u64)(__be32)(__saddr)))
352352
#endif /* __BIG_ENDIAN */
353353

354-
static inline bool inet_match(struct net *net, const struct sock *sk,
354+
static inline bool inet_match(const struct net *net, const struct sock *sk,
355355
const __addrpair cookie, const __portpair ports,
356356
int dif, int sdif)
357357
{

include/net/inet_sock.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ static inline bool inet_bound_dev_eq(bool l3mdev_accept, int bound_dev_if,
150150
return bound_dev_if == dif || bound_dev_if == sdif;
151151
}
152152

153-
static inline bool inet_sk_bound_dev_eq(struct net *net, int bound_dev_if,
153+
static inline bool inet_sk_bound_dev_eq(const struct net *net,
154+
int bound_dev_if,
154155
int dif, int sdif)
155156
{
156157
#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)

net/ipv4/inet_hashtables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ inet_lhash2_bucket_sk(struct inet_hashinfo *h, struct sock *sk)
310310
return inet_lhash2_bucket(h, hash);
311311
}
312312

313-
static inline int compute_score(struct sock *sk, struct net *net,
313+
static inline int compute_score(struct sock *sk, const struct net *net,
314314
const unsigned short hnum, const __be32 daddr,
315315
const int dif, const int sdif)
316316
{

net/ipv6/inet6_hashtables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct sock *__inet6_lookup_established(struct net *net,
8989
}
9090
EXPORT_SYMBOL(__inet6_lookup_established);
9191

92-
static inline int compute_score(struct sock *sk, struct net *net,
92+
static inline int compute_score(struct sock *sk, const struct net *net,
9393
const unsigned short hnum,
9494
const struct in6_addr *daddr,
9595
const int dif, const int sdif)

0 commit comments

Comments
 (0)