mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
net: add helpers checking if socket can be bound to nonlocal address
The construction "net->ipv4.sysctl_ip_nonlocal_bind || inet->freebind || inet->transparent" is present three times and its IPv6 counterpart is also present three times. We introduce two small helpers to characterize these tests uniformly. Signed-off-by: Vincent Bernat <vincent@bernat.im> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
d39db3b4d6
commit
83ba464515
@@ -359,4 +359,12 @@ static inline bool inet_get_convert_csum(struct sock *sk)
|
||||
return !!inet_sk(sk)->convert_csum;
|
||||
}
|
||||
|
||||
|
||||
static inline bool inet_can_nonlocal_bind(struct net *net,
|
||||
struct inet_sock *inet)
|
||||
{
|
||||
return net->ipv4.sysctl_ip_nonlocal_bind ||
|
||||
inet->freebind || inet->transparent;
|
||||
}
|
||||
|
||||
#endif /* _INET_SOCK_H */
|
||||
|
||||
Reference in New Issue
Block a user