diff options
author | Vincent Bernat <vincent@bernat.im> | 2018-07-31 21:18:11 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-01 09:50:04 -0700 |
commit | 83ba4645152d1177c161750e1064e3a8e7cee19b (patch) | |
tree | 7209c851dda98efb2aa1e7a42ff738d3fe560c38 /net/ipv6/datagram.c | |
parent | d39db3b4d60c9bc4282b36753a7255d2a5ef0384 (diff) | |
download | linux-83ba4645152d1177c161750e1064e3a8e7cee19b.tar.bz2 |
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>
Diffstat (limited to 'net/ipv6/datagram.c')
-rw-r--r-- | net/ipv6/datagram.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index f0264dfd38de..1ede7a16a0be 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c @@ -803,8 +803,7 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk, if (addr_type != IPV6_ADDR_ANY) { int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL; - if (!(net->ipv6.sysctl.ip_nonlocal_bind || - inet_sk(sk)->freebind || inet_sk(sk)->transparent) && + if (!ipv6_can_nonlocal_bind(net, inet_sk(sk)) && !ipv6_chk_addr_and_flags(net, &src_info->ipi6_addr, dev, !strict, 0, IFA_F_TENTATIVE) && |