Contributors: 17
Author Tokens Token Proportion Commits Commit Proportion
Alexey Dobriyan 184 44.88% 4 12.90%
Pavel Emelyanov 65 15.85% 5 16.13%
Eric W. Biedermann 34 8.29% 3 9.68%
Art Haas 28 6.83% 1 3.23%
Linus Torvalds (pre-git) 27 6.59% 4 12.90%
Jamal Hadi Salim 20 4.88% 1 3.23%
Joel Granados 17 4.15% 1 3.23%
David S. Miller 13 3.17% 3 9.68%
Stephen Hemminger 8 1.95% 1 3.23%
Alexey Kuznetsov 3 0.73% 1 3.23%
Herbert Xu 2 0.49% 1 3.23%
Subash Abhinov Kasiviswanathan 2 0.49% 1 3.23%
James Morris 2 0.49% 1 3.23%
Joy Latten 2 0.49% 1 3.23%
Greg Kroah-Hartman 1 0.24% 1 3.23%
Kunihiro Ishiguro 1 0.24% 1 3.23%
Linus Torvalds 1 0.24% 1 3.23%
Total 410 31


// SPDX-License-Identifier: GPL-2.0
#include <linux/sysctl.h>
#include <linux/slab.h>
#include <net/net_namespace.h>
#include <net/xfrm.h>

static void __net_init __xfrm_sysctl_init(struct net *net)
{
	net->xfrm.sysctl_aevent_etime = XFRM_AE_ETIME;
	net->xfrm.sysctl_aevent_rseqth = XFRM_AE_SEQT_SIZE;
	net->xfrm.sysctl_larval_drop = 1;
	net->xfrm.sysctl_acq_expires = 30;
}

#ifdef CONFIG_SYSCTL
static struct ctl_table xfrm_table[] = {
	{
		.procname	= "xfrm_aevent_etime",
		.maxlen		= sizeof(u32),
		.mode		= 0644,
		.proc_handler	= proc_douintvec
	},
	{
		.procname	= "xfrm_aevent_rseqth",
		.maxlen		= sizeof(u32),
		.mode		= 0644,
		.proc_handler	= proc_douintvec
	},
	{
		.procname	= "xfrm_larval_drop",
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec
	},
	{
		.procname	= "xfrm_acq_expires",
		.maxlen		= sizeof(int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec
	},
	{}
};

int __net_init xfrm_sysctl_init(struct net *net)
{
	struct ctl_table *table;
	size_t table_size = ARRAY_SIZE(xfrm_table);

	__xfrm_sysctl_init(net);

	table = kmemdup(xfrm_table, sizeof(xfrm_table), GFP_KERNEL);
	if (!table)
		goto out_kmemdup;
	table[0].data = &net->xfrm.sysctl_aevent_etime;
	table[1].data = &net->xfrm.sysctl_aevent_rseqth;
	table[2].data = &net->xfrm.sysctl_larval_drop;
	table[3].data = &net->xfrm.sysctl_acq_expires;

	/* Don't export sysctls to unprivileged users */
	if (net->user_ns != &init_user_ns) {
		table[0].procname = NULL;
		table_size = 0;
	}

	net->xfrm.sysctl_hdr = register_net_sysctl_sz(net, "net/core", table,
						      table_size);
	if (!net->xfrm.sysctl_hdr)
		goto out_register;
	return 0;

out_register:
	kfree(table);
out_kmemdup:
	return -ENOMEM;
}

void __net_exit xfrm_sysctl_fini(struct net *net)
{
	struct ctl_table *table;

	table = net->xfrm.sysctl_hdr->ctl_table_arg;
	unregister_net_sysctl_table(net->xfrm.sysctl_hdr);
	kfree(table);
}
#else
int __net_init xfrm_sysctl_init(struct net *net)
{
	__xfrm_sysctl_init(net);
	return 0;
}
#endif