ipv4: make ip_local_reserved_ports per netns
ip_local_port_range is already per netns, so should ip_local_reserved_ports be. And since it is none by default we don't actually need it when we don't enable CONFIG_SYSCTL. By the way, rename inet_is_reserved_local_port() to inet_is_local_reserved_port() Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committato da
David S. Miller

parent
9cc5e36d1c
commit
122ff243f5
@@ -5946,8 +5946,9 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
|
||||
/* Search for an available port. */
|
||||
int low, high, remaining, index;
|
||||
unsigned int rover;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
inet_get_local_port_range(sock_net(sk), &low, &high);
|
||||
inet_get_local_port_range(net, &low, &high);
|
||||
remaining = (high - low) + 1;
|
||||
rover = prandom_u32() % remaining + low;
|
||||
|
||||
@@ -5955,7 +5956,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
|
||||
rover++;
|
||||
if ((rover < low) || (rover > high))
|
||||
rover = low;
|
||||
if (inet_is_reserved_local_port(rover))
|
||||
if (inet_is_local_reserved_port(net, rover))
|
||||
continue;
|
||||
index = sctp_phashfn(sock_net(sk), rover);
|
||||
head = &sctp_port_hashtable[index];
|
||||
|
Fai riferimento in un nuovo problema
Block a user