diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2014-05-12 19:04:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-14 15:31:45 -0400 |
commit | 122ff243f5f104194750ecbc76d5946dd1eec934 (patch) | |
tree | 189020a4d2404ef567785458fee38992e14ca97d /net/sctp | |
parent | 9cc5e36d1c4794939deafd9f43bce2eab9c1142d (diff) |
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>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/socket.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index e37b2cbbf177..2af76eaba8f7 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -5946,8 +5946,9 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) | |||
5946 | /* Search for an available port. */ | 5946 | /* Search for an available port. */ |
5947 | int low, high, remaining, index; | 5947 | int low, high, remaining, index; |
5948 | unsigned int rover; | 5948 | unsigned int rover; |
5949 | struct net *net = sock_net(sk); | ||
5949 | 5950 | ||
5950 | inet_get_local_port_range(sock_net(sk), &low, &high); | 5951 | inet_get_local_port_range(net, &low, &high); |
5951 | remaining = (high - low) + 1; | 5952 | remaining = (high - low) + 1; |
5952 | rover = prandom_u32() % remaining + low; | 5953 | rover = prandom_u32() % remaining + low; |
5953 | 5954 | ||
@@ -5955,7 +5956,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) | |||
5955 | rover++; | 5956 | rover++; |
5956 | if ((rover < low) || (rover > high)) | 5957 | if ((rover < low) || (rover > high)) |
5957 | rover = low; | 5958 | rover = low; |
5958 | if (inet_is_reserved_local_port(rover)) | 5959 | if (inet_is_local_reserved_port(net, rover)) |
5959 | continue; | 5960 | continue; |
5960 | index = sctp_phashfn(sock_net(sk), rover); | 5961 | index = sctp_phashfn(sock_net(sk), rover); |
5961 | head = &sctp_port_hashtable[index]; | 5962 | head = &sctp_port_hashtable[index]; |