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 /include | |
| 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 'include')
| -rw-r--r-- | include/net/ip.h | 14 | ||||
| -rw-r--r-- | include/net/netns/ipv4.h | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index 14c50a1650ef..512bcd5dabac 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -208,11 +208,19 @@ static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_o | |||
| 208 | 208 | ||
| 209 | void inet_get_local_port_range(struct net *net, int *low, int *high); | 209 | void inet_get_local_port_range(struct net *net, int *low, int *high); |
| 210 | 210 | ||
| 211 | extern unsigned long *sysctl_local_reserved_ports; | 211 | #if CONFIG_SYSCTL |
| 212 | static inline int inet_is_reserved_local_port(int port) | 212 | static inline int inet_is_local_reserved_port(struct net *net, int port) |
| 213 | { | 213 | { |
| 214 | return test_bit(port, sysctl_local_reserved_ports); | 214 | if (!net->ipv4.sysctl_local_reserved_ports) |
| 215 | return 0; | ||
| 216 | return test_bit(port, net->ipv4.sysctl_local_reserved_ports); | ||
| 215 | } | 217 | } |
| 218 | #else | ||
| 219 | static inline int inet_is_local_reserved_port(struct net *net, int port) | ||
| 220 | { | ||
| 221 | return 0; | ||
| 222 | } | ||
| 223 | #endif | ||
| 216 | 224 | ||
| 217 | extern int sysctl_ip_nonlocal_bind; | 225 | extern int sysctl_ip_nonlocal_bind; |
| 218 | 226 | ||
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 2f0cfad66666..aec5e12f9f19 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
| @@ -84,6 +84,10 @@ struct netns_ipv4 { | |||
| 84 | 84 | ||
| 85 | atomic_t dev_addr_genid; | 85 | atomic_t dev_addr_genid; |
| 86 | 86 | ||
| 87 | #ifdef CONFIG_SYSCTL | ||
| 88 | unsigned long *sysctl_local_reserved_ports; | ||
| 89 | #endif | ||
| 90 | |||
| 87 | #ifdef CONFIG_IP_MROUTE | 91 | #ifdef CONFIG_IP_MROUTE |
| 88 | #ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES | 92 | #ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES |
| 89 | struct mr_table *mrt; | 93 | struct mr_table *mrt; |
