File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44struct sock ;
55struct proc_dir_entry ;
66struct sctp_mib ;
7+ struct ctl_table_header ;
78
89struct netns_sctp {
910 DEFINE_SNMP_STAT (struct sctp_mib , sctp_statistics );
1011
1112#ifdef CONFIG_PROC_FS
1213 struct proc_dir_entry * proc_net_sctp ;
1314#endif
14-
15+ #ifdef CONFIG_SYSCTL
16+ struct ctl_table_header * sysctl_header ;
17+ #endif
1518 /* This is the global socket data structure used for responding to
1619 * the Out-of-the-blue (OOTB) packets. A control sock will be created
1720 * for this socket at the initialization time.
@@ -32,6 +35,7 @@ struct netns_sctp {
3235
3336 /* Lock that protects the local_addr_list writers */
3437 spinlock_t local_addr_lock ;
38+
3539};
3640
3741#endif /* __NETNS_SCTP_H__ */
Original file line number Diff line number Diff line change @@ -375,9 +375,13 @@ static inline void sctp_dbg_objcnt_exit(struct net *) { return; }
375375#if defined CONFIG_SYSCTL
376376void sctp_sysctl_register (void );
377377void sctp_sysctl_unregister (void );
378+ int sctp_sysctl_net_register (struct net * net );
379+ void sctp_sysctl_net_unregister (struct net * net );
378380#else
379381static inline void sctp_sysctl_register (void ) { return ; }
380382static inline void sctp_sysctl_unregister (void ) { return ; }
383+ static inline int sctp_sysctl_net_register (struct net * net ) { return 0 ; }
384+ static inline void sctp_sysctl_net_unregister (struct net * net ) { return ; }
381385#endif
382386
383387/* Size of Supported Address Parameter for 'x' address types. */
Original file line number Diff line number Diff line change @@ -1169,6 +1169,10 @@ static int sctp_net_init(struct net *net)
11691169{
11701170 int status ;
11711171
1172+ status = sctp_sysctl_net_register (net );
1173+ if (status )
1174+ goto err_sysctl_register ;
1175+
11721176 /* Allocate and initialise sctp mibs. */
11731177 status = init_sctp_mibs (net );
11741178 if (status )
@@ -1208,6 +1212,8 @@ static int sctp_net_init(struct net *net)
12081212err_init_proc :
12091213 cleanup_sctp_mibs (net );
12101214err_init_mibs :
1215+ sctp_sysctl_net_unregister (net );
1216+ err_sysctl_register :
12111217 return status ;
12121218}
12131219
@@ -1224,6 +1230,7 @@ static void sctp_net_exit(struct net *net)
12241230
12251231 sctp_proc_exit (net );
12261232 cleanup_sctp_mibs (net );
1233+ sctp_sysctl_net_unregister (net );
12271234}
12281235
12291236static struct pernet_operations sctp_net_ops = {
Original file line number Diff line number Diff line change @@ -284,6 +284,27 @@ static ctl_table sctp_table[] = {
284284 { /* sentinel */ }
285285};
286286
287+ static ctl_table sctp_net_table [] = {
288+ { /* sentinel */ }
289+ };
290+
291+ int 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+
303+ void sctp_sysctl_net_unregister (struct net * net )
304+ {
305+ unregister_net_sysctl_table (net -> sctp .sysctl_header );
306+ }
307+
287308static struct ctl_table_header * sctp_sysctl_header ;
288309
289310/* Sysctl registration. */
You can’t perform that action at this time.
0 commit comments