fed up with those stupid warnings
[mmotm.git] / net / xfrm / xfrm_sysctl.c
blob2e6ffb66f06f1a2ee7bf935ab216ba9658278fdb
1 #include <linux/sysctl.h>
2 #include <net/net_namespace.h>
3 #include <net/xfrm.h>
5 static void __xfrm_sysctl_init(struct net *net)
7 net->xfrm.sysctl_aevent_etime = XFRM_AE_ETIME;
8 net->xfrm.sysctl_aevent_rseqth = XFRM_AE_SEQT_SIZE;
9 net->xfrm.sysctl_larval_drop = 1;
10 net->xfrm.sysctl_acq_expires = 30;
13 #ifdef CONFIG_SYSCTL
14 static struct ctl_table xfrm_table[] = {
16 .ctl_name = NET_CORE_AEVENT_ETIME,
17 .procname = "xfrm_aevent_etime",
18 .maxlen = sizeof(u32),
19 .mode = 0644,
20 .proc_handler = proc_dointvec
23 .ctl_name = NET_CORE_AEVENT_RSEQTH,
24 .procname = "xfrm_aevent_rseqth",
25 .maxlen = sizeof(u32),
26 .mode = 0644,
27 .proc_handler = proc_dointvec
30 .ctl_name = CTL_UNNUMBERED,
31 .procname = "xfrm_larval_drop",
32 .maxlen = sizeof(int),
33 .mode = 0644,
34 .proc_handler = proc_dointvec
37 .ctl_name = CTL_UNNUMBERED,
38 .procname = "xfrm_acq_expires",
39 .maxlen = sizeof(int),
40 .mode = 0644,
41 .proc_handler = proc_dointvec
46 int __net_init xfrm_sysctl_init(struct net *net)
48 struct ctl_table *table;
50 __xfrm_sysctl_init(net);
52 table = kmemdup(xfrm_table, sizeof(xfrm_table), GFP_KERNEL);
53 if (!table)
54 goto out_kmemdup;
55 table[0].data = &net->xfrm.sysctl_aevent_etime;
56 table[1].data = &net->xfrm.sysctl_aevent_rseqth;
57 table[2].data = &net->xfrm.sysctl_larval_drop;
58 table[3].data = &net->xfrm.sysctl_acq_expires;
60 net->xfrm.sysctl_hdr = register_net_sysctl_table(net, net_core_path, table);
61 if (!net->xfrm.sysctl_hdr)
62 goto out_register;
63 return 0;
65 out_register:
66 kfree(table);
67 out_kmemdup:
68 return -ENOMEM;
71 void xfrm_sysctl_fini(struct net *net)
73 struct ctl_table *table;
75 table = net->xfrm.sysctl_hdr->ctl_table_arg;
76 unregister_net_sysctl_table(net->xfrm.sysctl_hdr);
77 kfree(table);
79 #else
80 int __net_init xfrm_sysctl_init(struct net *net)
82 __xfrm_sysctl_init(net);
83 return 0;
85 #endif