aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/netns/sctp.h6
-rw-r--r--include/net/sctp/sctp.h4
-rw-r--r--net/sctp/protocol.c7
-rw-r--r--net/sctp/sysctl.c21
4 files changed, 37 insertions, 1 deletions
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
index 06ccddf9566c..9576b60cbd25 100644
--- a/include/net/netns/sctp.h
+++ b/include/net/netns/sctp.h
@@ -4,6 +4,7 @@
4struct sock; 4struct sock;
5struct proc_dir_entry; 5struct proc_dir_entry;
6struct sctp_mib; 6struct sctp_mib;
7struct ctl_table_header;
7 8
8struct netns_sctp { 9struct netns_sctp {
9 DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics); 10 DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics);
@@ -11,7 +12,9 @@ struct netns_sctp {
11#ifdef CONFIG_PROC_FS 12#ifdef CONFIG_PROC_FS
12 struct proc_dir_entry *proc_net_sctp; 13 struct proc_dir_entry *proc_net_sctp;
13#endif 14#endif
14 15#ifdef CONFIG_SYSCTL
16 struct ctl_table_header *sysctl_header;
17#endif
15 /* This is the global socket data structure used for responding to 18 /* This is the global socket data structure used for responding to
16 * the Out-of-the-blue (OOTB) packets. A control sock will be created 19 * the Out-of-the-blue (OOTB) packets. A control sock will be created
17 * for this socket at the initialization time. 20 * for this socket at the initialization time.
@@ -32,6 +35,7 @@ struct netns_sctp {
32 35
33 /* Lock that protects the local_addr_list writers */ 36 /* Lock that protects the local_addr_list writers */
34 spinlock_t local_addr_lock; 37 spinlock_t local_addr_lock;
38
35}; 39};
36 40
37#endif /* __NETNS_SCTP_H__ */ 41#endif /* __NETNS_SCTP_H__ */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 7dcd4dfd7c3f..c07421d1772f 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -375,9 +375,13 @@ static inline void sctp_dbg_objcnt_exit(struct net *) { return; }
375#if defined CONFIG_SYSCTL 375#if defined CONFIG_SYSCTL
376void sctp_sysctl_register(void); 376void sctp_sysctl_register(void);
377void sctp_sysctl_unregister(void); 377void sctp_sysctl_unregister(void);
378int sctp_sysctl_net_register(struct net *net);
379void sctp_sysctl_net_unregister(struct net *net);
378#else 380#else
379static inline void sctp_sysctl_register(void) { return; } 381static inline void sctp_sysctl_register(void) { return; }
380static inline void sctp_sysctl_unregister(void) { return; } 382static inline void sctp_sysctl_unregister(void) { return; }
383static inline int sctp_sysctl_net_register(struct net *net) { return 0; }
384static inline void sctp_sysctl_net_unregister(struct net *net) { return; }
381#endif 385#endif
382 386
383/* Size of Supported Address Parameter for 'x' address types. */ 387/* Size of Supported Address Parameter for 'x' address types. */
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index d58db315db85..0f2342be61f3 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1169,6 +1169,10 @@ static int sctp_net_init(struct net *net)
1169{ 1169{
1170 int status; 1170 int status;
1171 1171
1172 status = sctp_sysctl_net_register(net);
1173 if (status)
1174 goto err_sysctl_register;
1175
1172 /* Allocate and initialise sctp mibs. */ 1176 /* Allocate and initialise sctp mibs. */
1173 status = init_sctp_mibs(net); 1177 status = init_sctp_mibs(net);
1174 if (status) 1178 if (status)
@@ -1208,6 +1212,8 @@ err_ctl_sock_init:
1208err_init_proc: 1212err_init_proc:
1209 cleanup_sctp_mibs(net); 1213 cleanup_sctp_mibs(net);
1210err_init_mibs: 1214err_init_mibs:
1215 sctp_sysctl_net_unregister(net);
1216err_sysctl_register:
1211 return status; 1217 return status;
1212} 1218}
1213 1219
@@ -1224,6 +1230,7 @@ static void sctp_net_exit(struct net *net)
1224 1230
1225 sctp_proc_exit(net); 1231 sctp_proc_exit(net);
1226 cleanup_sctp_mibs(net); 1232 cleanup_sctp_mibs(net);
1233 sctp_sysctl_net_unregister(net);
1227} 1234}
1228 1235
1229static struct pernet_operations sctp_net_ops = { 1236static struct pernet_operations sctp_net_ops = {
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 2b2bfe933ff1..bee36c408dde 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -284,6 +284,27 @@ static ctl_table sctp_table[] = {
284 { /* sentinel */ } 284 { /* sentinel */ }
285}; 285};
286 286
287static ctl_table sctp_net_table[] = {
288 { /* sentinel */ }
289};
290
291int sctp_sysctl_net_register(struct net *net)
292{
293 struct ctl_table *table;
294
295 table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);
296 if (!table)
297 return -ENOMEM;
298
299 net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table);
300 return 0;
301}
302
303void sctp_sysctl_net_unregister(struct net *net)
304{
305 unregister_net_sysctl_table(net->sctp.sysctl_header);
306}
307
287static struct ctl_table_header * sctp_sysctl_header; 308static struct ctl_table_header * sctp_sysctl_header;
288 309
289/* Sysctl registration. */ 310/* Sysctl registration. */