aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-08-06 04:42:04 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-15 02:12:17 -0400
commit4db67e808640e3934d82ce61ee8e2e89fd877ba8 (patch)
treeff02e330187c41970c75f6d8a6275e1cc25165f0 /include/net
parent4110cc255ddec59c79fba4d71cdd948d0a382140 (diff)
sctp: Make the address lists per network namespace
- Move the address lists into struct net - Add per network namespace initialization and cleanup - Pass around struct net so it is everywhere I need it. - Rename all of the global variable references into references to the variables moved into struct net Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Vlad Yasevich <vyasevich@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/net_namespace.h4
-rw-r--r--include/net/netns/sctp.h21
-rw-r--r--include/net/sctp/sctp.h4
-rw-r--r--include/net/sctp/structs.h22
4 files changed, 28 insertions, 23 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 97e441945c13..5ae57f1ab755 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -15,6 +15,7 @@
15#include <net/netns/packet.h> 15#include <net/netns/packet.h>
16#include <net/netns/ipv4.h> 16#include <net/netns/ipv4.h>
17#include <net/netns/ipv6.h> 17#include <net/netns/ipv6.h>
18#include <net/netns/sctp.h>
18#include <net/netns/dccp.h> 19#include <net/netns/dccp.h>
19#include <net/netns/x_tables.h> 20#include <net/netns/x_tables.h>
20#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 21#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -81,6 +82,9 @@ struct net {
81#if IS_ENABLED(CONFIG_IPV6) 82#if IS_ENABLED(CONFIG_IPV6)
82 struct netns_ipv6 ipv6; 83 struct netns_ipv6 ipv6;
83#endif 84#endif
85#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE)
86 struct netns_sctp sctp;
87#endif
84#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE) 88#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
85 struct netns_dccp dccp; 89 struct netns_dccp dccp;
86#endif 90#endif
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
new file mode 100644
index 000000000000..cbd684e01cf7
--- /dev/null
+++ b/include/net/netns/sctp.h
@@ -0,0 +1,21 @@
1#ifndef __NETNS_SCTP_H__
2#define __NETNS_SCTP_H__
3
4struct netns_sctp {
5 /* This is the global local address list.
6 * We actively maintain this complete list of addresses on
7 * the system by catching address add/delete events.
8 *
9 * It is a list of sctp_sockaddr_entry.
10 */
11 struct list_head local_addr_list;
12 struct list_head addr_waitq;
13 struct timer_list addr_wq_timer;
14 struct list_head auto_asconf_splist;
15 spinlock_t addr_wq_lock;
16
17 /* Lock that protects the local_addr_list writers */
18 spinlock_t local_addr_lock;
19};
20
21#endif /* __NETNS_SCTP_H__ */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 640915a0613d..00c920537d4a 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -115,12 +115,12 @@
115 * sctp/protocol.c 115 * sctp/protocol.c
116 */ 116 */
117extern struct sock *sctp_get_ctl_sock(void); 117extern struct sock *sctp_get_ctl_sock(void);
118extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, 118extern int sctp_copy_local_addr_list(struct net *, struct sctp_bind_addr *,
119 sctp_scope_t, gfp_t gfp, 119 sctp_scope_t, gfp_t gfp,
120 int flags); 120 int flags);
121extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); 121extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
122extern int sctp_register_pf(struct sctp_pf *, sa_family_t); 122extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
123extern void sctp_addr_wq_mgmt(struct sctp_sockaddr_entry *, int); 123extern void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
124 124
125/* 125/*
126 * sctp/socket.c 126 * sctp/socket.c
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index c0563d1dd7c7..6bdfcabe560e 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -205,21 +205,7 @@ extern struct sctp_globals {
205 int port_hashsize; 205 int port_hashsize;
206 struct sctp_bind_hashbucket *port_hashtable; 206 struct sctp_bind_hashbucket *port_hashtable;
207 207
208 /* This is the global local address list.
209 * We actively maintain this complete list of addresses on
210 * the system by catching address add/delete events.
211 *
212 * It is a list of sctp_sockaddr_entry.
213 */
214 struct list_head local_addr_list;
215 int default_auto_asconf; 208 int default_auto_asconf;
216 struct list_head addr_waitq;
217 struct timer_list addr_wq_timer;
218 struct list_head auto_asconf_splist;
219 spinlock_t addr_wq_lock;
220
221 /* Lock that protects the local_addr_list writers */
222 spinlock_t addr_list_lock;
223 209
224 /* Flag to indicate if addip is enabled. */ 210 /* Flag to indicate if addip is enabled. */
225 int addip_enable; 211 int addip_enable;
@@ -278,12 +264,6 @@ extern struct sctp_globals {
278#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable) 264#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable)
279#define sctp_port_hashsize (sctp_globals.port_hashsize) 265#define sctp_port_hashsize (sctp_globals.port_hashsize)
280#define sctp_port_hashtable (sctp_globals.port_hashtable) 266#define sctp_port_hashtable (sctp_globals.port_hashtable)
281#define sctp_local_addr_list (sctp_globals.local_addr_list)
282#define sctp_local_addr_lock (sctp_globals.addr_list_lock)
283#define sctp_auto_asconf_splist (sctp_globals.auto_asconf_splist)
284#define sctp_addr_waitq (sctp_globals.addr_waitq)
285#define sctp_addr_wq_timer (sctp_globals.addr_wq_timer)
286#define sctp_addr_wq_lock (sctp_globals.addr_wq_lock)
287#define sctp_default_auto_asconf (sctp_globals.default_auto_asconf) 267#define sctp_default_auto_asconf (sctp_globals.default_auto_asconf)
288#define sctp_scope_policy (sctp_globals.ipv4_scope_policy) 268#define sctp_scope_policy (sctp_globals.ipv4_scope_policy)
289#define sctp_addip_enable (sctp_globals.addip_enable) 269#define sctp_addip_enable (sctp_globals.addip_enable)
@@ -1241,7 +1221,7 @@ struct sctp_bind_addr {
1241 1221
1242void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); 1222void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
1243void sctp_bind_addr_free(struct sctp_bind_addr *); 1223void sctp_bind_addr_free(struct sctp_bind_addr *);
1244int sctp_bind_addr_copy(struct sctp_bind_addr *dest, 1224int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest,
1245 const struct sctp_bind_addr *src, 1225 const struct sctp_bind_addr *src,
1246 sctp_scope_t scope, gfp_t gfp, 1226 sctp_scope_t scope, gfp_t gfp,
1247 int flags); 1227 int flags);