mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
sctp: support ipv6 nonlocal bind
This patch makes sctp support ipv6 nonlocal bind by adding
sp->inet.freebind and net->ipv6.sysctl.ip_nonlocal_bind
check in sctp_v6_available as what sctp did to support
ipv4 nonlocal bind (commit cdac4e0774
).
Reported-by: Shijoe George <spanjikk@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
da54bb13c0
commit
9b97420228
@ -560,6 +560,7 @@ static int sctp_v6_is_any(const union sctp_addr *addr)
|
|||||||
static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp)
|
static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp)
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
|
struct net *net = sock_net(&sp->inet.sk);
|
||||||
const struct in6_addr *in6 = (const struct in6_addr *)&addr->v6.sin6_addr;
|
const struct in6_addr *in6 = (const struct in6_addr *)&addr->v6.sin6_addr;
|
||||||
|
|
||||||
type = ipv6_addr_type(in6);
|
type = ipv6_addr_type(in6);
|
||||||
@ -574,7 +575,8 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp)
|
|||||||
if (!(type & IPV6_ADDR_UNICAST))
|
if (!(type & IPV6_ADDR_UNICAST))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return ipv6_chk_addr(sock_net(&sp->inet.sk), in6, NULL, 0);
|
return sp->inet.freebind || net->ipv6.sysctl.ip_nonlocal_bind ||
|
||||||
|
ipv6_chk_addr(net, in6, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function checks if the address is a valid address to be used for
|
/* This function checks if the address is a valid address to be used for
|
||||||
|
Loading…
Reference in New Issue
Block a user