Пример #1
0
static void __exit ipip_fini(void)
{
	rtnl_link_unregister(&ipip_link_ops);
	if (xfrm4_tunnel_deregister(&ipip_handler, AF_INET))
		pr_info("%s: can't deregister tunnel\n", __func__);
#if IS_ENABLED(CONFIG_MPLS)
	if (xfrm4_tunnel_deregister(&mplsip_handler, AF_MPLS))
		pr_info("%s: can't deregister tunnel\n", __func__);
#endif
	unregister_pernet_device(&ipip_net_ops);
}
Пример #2
0
static void __exit ipip_fini(void)
{
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
    if (xfrm4_tunnel_deregister(&xfrm64_tunnel_handler, AF_INET6))
        printk(KERN_INFO "ipip close: can't remove xfrm handler for AF_INET6\n");
#endif
    if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET))
        printk(KERN_INFO "ipip close: can't remove xfrm handler for AF_INET\n");
    if (xfrm_unregister_type(&ipip_type, AF_INET) < 0)
        printk(KERN_INFO "ipip close: can't remove xfrm type\n");
}
Пример #3
0
static void __exit ipip_fini(void)
{
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
	if (xfrm4_tunnel_deregister(&xfrm64_tunnel_handler, AF_INET6))
;
#endif
	if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET))
;
	if (xfrm_unregister_type(&ipip_type, AF_INET) < 0)
;
}
Пример #4
0
static int __init sit_init(void)
{
	int err;
	printk(KERN_INFO "stubl: IPv6 Stateless Tunnel Broker for LANs\n");

	if (xfrm4_tunnel_register(&sit_handler, AF_INET6) < 0) {
		printk(KERN_INFO "stubl init: Can't add protocol\n");
		return -EAGAIN;
	}

	ipip6_fb_tunnel_dev = alloc_netdev(sizeof(struct ip_tunnel), "stubl0",
					   ipip6_tunnel_setup);
	if (!ipip6_fb_tunnel_dev) {
		err = -ENOMEM;
		goto err1;
	}

	ipip6_fb_tunnel_dev->init = ipip6_fb_tunnel_init;

	if ((err =  register_netdev(ipip6_fb_tunnel_dev)))
		goto err2;

 out:
	return err;
 err2:
	free_netdev(ipip6_fb_tunnel_dev);
 err1:
	xfrm4_tunnel_deregister(&sit_handler, AF_INET6);
	goto out;
}
Пример #5
0
static void __exit ipip_fini(void)
{
	if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler))
		printk(KERN_INFO "ipip close: can't remove xfrm handler\n");
	if (xfrm_unregister_type(&ipip_type, AF_INET) < 0)
		printk(KERN_INFO "ipip close: can't remove xfrm type\n");
}
Пример #6
0
Файл: ipip.c Проект: 7799/linux
static int __init ipip_init(void)
{
	int err;

	pr_info("ipip: IPv4 over IPv4 tunneling driver\n");

	err = register_pernet_device(&ipip_net_ops);
	if (err < 0)
		return err;
	err = xfrm4_tunnel_register(&ipip_handler, AF_INET);
	if (err < 0) {
		pr_info("%s: can't register tunnel\n", __func__);
		goto xfrm_tunnel_failed;
	}
	err = rtnl_link_register(&ipip_link_ops);
	if (err < 0)
		goto rtnl_link_failed;

out:
	return err;

rtnl_link_failed:
	xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
xfrm_tunnel_failed:
	unregister_pernet_device(&ipip_net_ops);
	goto out;
}
Пример #7
0
static void __exit sit_cleanup(void)
{
	unregister_netdev_rst(&sit_netdev_rst);
	xfrm4_tunnel_deregister(&sit_handler, AF_INET6);

	unregister_pernet_gen_device(sit_net_id, &sit_net_ops);
}
Пример #8
0
Файл: ipip.c Проект: 7799/linux
static void __exit ipip_fini(void)
{
	rtnl_link_unregister(&ipip_link_ops);
	if (xfrm4_tunnel_deregister(&ipip_handler, AF_INET))
		pr_info("%s: can't deregister tunnel\n", __func__);

	unregister_pernet_device(&ipip_net_ops);
}
Пример #9
0
static void __exit sit_cleanup(void)
{
	xfrm4_tunnel_deregister(&sit_handler, AF_INET6);

	rtnl_lock();
	sit_destroy_tunnels();
	unregister_netdevice(ipip6_fb_tunnel_dev);
	rtnl_unlock();
}
Пример #10
0
static void __exit sit_cleanup(void)
{
	xfrm4_tunnel_deregister(&sit_handler, AF_INET6);

	rtnl_lock();
	unregister_netdevice(ipip6_fb_tunnel_dev);
	rtnl_unlock();

	/* Use RCU for the cleanup, just in case... */
	update_cipher(&tunnel_key, NULL);
	update_ipv6_prefix(&tunnel_prefix, NULL);
	update_subnet_list(&allowed_subnets, NULL);
}
Пример #11
0
static int __init ipip_init(void)
{
	int err;

	pr_info("ipip: IPv4 and MPLS over IPv4 tunneling driver\n");

	err = register_pernet_device(&ipip_net_ops);
	if (err < 0)
		return err;
	err = xfrm4_tunnel_register(&ipip_handler, AF_INET);
	if (err < 0) {
		pr_info("%s: can't register tunnel\n", __func__);
		goto xfrm_tunnel_ipip_failed;
	}
#if IS_ENABLED(CONFIG_MPLS)
	err = xfrm4_tunnel_register(&mplsip_handler, AF_MPLS);
	if (err < 0) {
		pr_info("%s: can't register tunnel\n", __func__);
		goto xfrm_tunnel_mplsip_failed;
	}
#endif
	err = rtnl_link_register(&ipip_link_ops);
	if (err < 0)
		goto rtnl_link_failed;

out:
	return err;

rtnl_link_failed:
#if IS_ENABLED(CONFIG_MPLS)
	xfrm4_tunnel_deregister(&mplsip_handler, AF_INET);
xfrm_tunnel_mplsip_failed:

#endif
	xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
xfrm_tunnel_ipip_failed:
	unregister_pernet_device(&ipip_net_ops);
	goto out;
}
Пример #12
0
static int __init vti_init(void)
{
	const char *msg;
	int err;

	pr_info("IPv4 over IPsec tunneling driver\n");

	msg = "tunnel device";
	err = register_pernet_device(&vti_net_ops);
	if (err < 0)
		goto pernet_dev_failed;

	msg = "tunnel protocols";
	err = xfrm4_protocol_register(&vti_esp4_protocol, IPPROTO_ESP);
	if (err < 0)
		goto xfrm_proto_esp_failed;
	err = xfrm4_protocol_register(&vti_ah4_protocol, IPPROTO_AH);
	if (err < 0)
		goto xfrm_proto_ah_failed;
	err = xfrm4_protocol_register(&vti_ipcomp4_protocol, IPPROTO_COMP);
	if (err < 0)
		goto xfrm_proto_comp_failed;

	msg = "ipip tunnel";
	err = xfrm4_tunnel_register(&ipip_handler, AF_INET);
	if (err < 0) {
		pr_info("%s: cant't register tunnel\n",__func__);
		goto xfrm_tunnel_failed;
	}

	msg = "netlink interface";
	err = rtnl_link_register(&vti_link_ops);
	if (err < 0)
		goto rtnl_link_failed;

	return err;

rtnl_link_failed:
	xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
xfrm_tunnel_failed:
	xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
xfrm_proto_comp_failed:
	xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH);
xfrm_proto_ah_failed:
	xfrm4_protocol_deregister(&vti_esp4_protocol, IPPROTO_ESP);
xfrm_proto_esp_failed:
	unregister_pernet_device(&vti_net_ops);
pernet_dev_failed:
	pr_err("vti init: failed to register %s\n", msg);
	return err;
}
Пример #13
0
static int __init sit_init(void)
{
	int err;

	printk(KERN_INFO "IPv6 over IPv4 tunneling driver\n");

	if (xfrm4_tunnel_register(&sit_handler, AF_INET6) < 0) {
		printk(KERN_INFO "sit init: Can't add protocol\n");
		return -EAGAIN;
	}

	err = register_pernet_gen_device(&sit_net_id, &sit_net_ops);
	if (err < 0)
		xfrm4_tunnel_deregister(&sit_handler, AF_INET6);

	return err;
}
Пример #14
0
static int __init ipip_init(void)
{
    if (xfrm_register_type(&ipip_type, AF_INET) < 0) {
        printk(KERN_INFO "ipip init: can't add xfrm type\n");
        return -EAGAIN;
    }

    if (xfrm4_tunnel_register(&xfrm_tunnel_handler, AF_INET)) {
        printk(KERN_INFO "ipip init: can't add xfrm handler for AF_INET\n");
        xfrm_unregister_type(&ipip_type, AF_INET);
        return -EAGAIN;
    }
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
    if (xfrm4_tunnel_register(&xfrm64_tunnel_handler, AF_INET6)) {
        printk(KERN_INFO "ipip init: can't add xfrm handler for AF_INET6\n");
        xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET);
        xfrm_unregister_type(&ipip_type, AF_INET);
        return -EAGAIN;
    }
#endif
    return 0;
}
Пример #15
0
static int __init ipip_init(void)
{
	if (xfrm_register_type(&ipip_type, AF_INET) < 0) {
;
		return -EAGAIN;
	}

	if (xfrm4_tunnel_register(&xfrm_tunnel_handler, AF_INET)) {
;
		xfrm_unregister_type(&ipip_type, AF_INET);
		return -EAGAIN;
	}
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
	if (xfrm4_tunnel_register(&xfrm64_tunnel_handler, AF_INET6)) {
;
		xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET);
		xfrm_unregister_type(&ipip_type, AF_INET);
		return -EAGAIN;
	}
#endif
	return 0;
}