~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/xfrm/xfrm_sysctl.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 #include <linux/sysctl.h>
  3 #include <linux/slab.h>
  4 #include <net/net_namespace.h>
  5 #include <net/xfrm.h>
  6 
  7 static void __net_init __xfrm_sysctl_init(struct net *net)
  8 {
  9         net->xfrm.sysctl_aevent_etime = XFRM_AE_ETIME;
 10         net->xfrm.sysctl_aevent_rseqth = XFRM_AE_SEQT_SIZE;
 11         net->xfrm.sysctl_larval_drop = 1;
 12         net->xfrm.sysctl_acq_expires = 30;
 13 }
 14 
 15 #ifdef CONFIG_SYSCTL
 16 static struct ctl_table xfrm_table[] = {
 17         {
 18                 .procname       = "xfrm_aevent_etime",
 19                 .maxlen         = sizeof(u32),
 20                 .mode           = 0644,
 21                 .proc_handler   = proc_douintvec
 22         },
 23         {
 24                 .procname       = "xfrm_aevent_rseqth",
 25                 .maxlen         = sizeof(u32),
 26                 .mode           = 0644,
 27                 .proc_handler   = proc_douintvec
 28         },
 29         {
 30                 .procname       = "xfrm_larval_drop",
 31                 .maxlen         = sizeof(int),
 32                 .mode           = 0644,
 33                 .proc_handler   = proc_dointvec
 34         },
 35         {
 36                 .procname       = "xfrm_acq_expires",
 37                 .maxlen         = sizeof(int),
 38                 .mode           = 0644,
 39                 .proc_handler   = proc_dointvec
 40         },
 41 };
 42 
 43 int __net_init xfrm_sysctl_init(struct net *net)
 44 {
 45         struct ctl_table *table;
 46         size_t table_size = ARRAY_SIZE(xfrm_table);
 47 
 48         __xfrm_sysctl_init(net);
 49 
 50         table = kmemdup(xfrm_table, sizeof(xfrm_table), GFP_KERNEL);
 51         if (!table)
 52                 goto out_kmemdup;
 53         table[0].data = &net->xfrm.sysctl_aevent_etime;
 54         table[1].data = &net->xfrm.sysctl_aevent_rseqth;
 55         table[2].data = &net->xfrm.sysctl_larval_drop;
 56         table[3].data = &net->xfrm.sysctl_acq_expires;
 57 
 58         /* Don't export sysctls to unprivileged users */
 59         if (net->user_ns != &init_user_ns)
 60                 table_size = 0;
 61 
 62         net->xfrm.sysctl_hdr = register_net_sysctl_sz(net, "net/core", table,
 63                                                       table_size);
 64         if (!net->xfrm.sysctl_hdr)
 65                 goto out_register;
 66         return 0;
 67 
 68 out_register:
 69         kfree(table);
 70 out_kmemdup:
 71         return -ENOMEM;
 72 }
 73 
 74 void __net_exit xfrm_sysctl_fini(struct net *net)
 75 {
 76         const struct ctl_table *table;
 77 
 78         table = net->xfrm.sysctl_hdr->ctl_table_arg;
 79         unregister_net_sysctl_table(net->xfrm.sysctl_hdr);
 80         kfree(table);
 81 }
 82 #else
 83 int __net_init xfrm_sysctl_init(struct net *net)
 84 {
 85         __xfrm_sysctl_init(net);
 86         return 0;
 87 }
 88 #endif
 89 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php