Ejemplo n.º 1
0
static int ipv4_net_init(struct net *net)
{
	int ret = 0;

	ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_tcp4);
	if (ret < 0) {
		pr_err("nf_conntrack_tcp4: pernet registration failed\n");
		goto out_tcp;
	}
	ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_udp4);
	if (ret < 0) {
		pr_err("nf_conntrack_udp4: pernet registration failed\n");
		goto out_udp;
	}
	ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_icmp);
	if (ret < 0) {
		pr_err("nf_conntrack_icmp4: pernet registration failed\n");
		goto out_icmp;
	}
	ret = nf_ct_l3proto_pernet_register(net, &nf_conntrack_l3proto_ipv4);
	if (ret < 0) {
		pr_err("nf_conntrack_ipv4: pernet registration failed\n");
		goto out_ipv4;
	}
	return 0;
out_ipv4:
	nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_icmp);
out_icmp:
	nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_udp4);
out_udp:
	nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_tcp4);
out_tcp:
	return ret;
}
Ejemplo n.º 2
0
int nf_conntrack_proto_pernet_init(struct net *net)
{
	int err;
	struct nf_proto_net *pn = nf_ct_l4proto_net(net,
					&nf_conntrack_l4proto_generic);

	err = nf_conntrack_l4proto_generic.init_net(net,
					nf_conntrack_l4proto_generic.l3proto);
	if (err < 0)
		return err;
	err = nf_ct_l4proto_register_sysctl(net,
					    pn,
					    &nf_conntrack_l4proto_generic);
	if (err < 0)
		return err;

	err = nf_ct_l4proto_pernet_register(net, builtin_l4proto,
					    ARRAY_SIZE(builtin_l4proto));
	if (err < 0) {
		nf_ct_l4proto_unregister_sysctl(net, pn,
						&nf_conntrack_l4proto_generic);
		return err;
	}

	pn->users++;
	return 0;
}
Ejemplo n.º 3
0
static __net_init int dccp_net_init(struct net *net)
{
	int ret = 0;
	ret = nf_ct_l4proto_pernet_register(net, &dccp_proto4);
	if (ret < 0) {
		pr_err("nf_conntrack_dccp4: pernet registration failed.\n");
		goto out;
	}
	ret = nf_ct_l4proto_pernet_register(net, &dccp_proto6);
	if (ret < 0) {
		pr_err("nf_conntrack_dccp6: pernet registration failed.\n");
		goto cleanup_dccp4;
	}
	return 0;
cleanup_dccp4:
	nf_ct_l4proto_pernet_unregister(net, &dccp_proto4);
out:
	return ret;
}