static void inet6_exit(void) { /* First of all disallow new sockets creation. */ sock_unregister(PF_INET6); #ifdef CONFIG_PROC_FS proc_net_remove("raw6"); proc_net_remove("tcp6"); proc_net_remove("udp6"); proc_net_remove("sockstat6"); proc_net_remove("snmp6"); #endif /* Cleanup code parts. */ sit_cleanup(); ipv6_netdev_notif_cleanup(); ip6_flowlabel_cleanup(); addrconf_cleanup(); ip6_route_cleanup(); ipv6_packet_cleanup(); igmp6_cleanup(); ndisc_cleanup(); icmpv6_cleanup(); #ifdef CONFIG_SYSCTL ipv6_sysctl_unregister(); #endif }
void cleanup_module(void) { /* First of all disallow new sockets creation. */ sock_unregister(PF_INET6); #ifdef CONFIG_PROC_FS proc_net_unregister(proc_net_raw6.low_ino); proc_net_unregister(proc_net_tcp6.low_ino); proc_net_unregister(proc_net_udp6.low_ino); proc_net_unregister(proc_net_sockstat6.low_ino); proc_net_unregister(proc_net_snmp6.low_ino); #endif /* Cleanup code parts. */ sit_cleanup(); ipv6_netdev_notif_cleanup(); ip6_flowlabel_cleanup(); addrconf_cleanup(); ip6_route_cleanup(); ipv6_packet_cleanup(); igmp6_cleanup(); ndisc_cleanup(); icmpv6_cleanup(); #ifdef CONFIG_SYSCTL ipv6_sysctl_unregister(); #endif }
static int __init inet6_init(void) { struct sk_buff *dummy_skb; int err; #ifdef MODULE if (!mod_member_present(&__this_module, can_unload)) return -EINVAL; __this_module.can_unload = &ipv6_unload; #endif printk(KERN_INFO "IPv6 v0.8 for NET4.0\n"); if (sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)) { printk(KERN_CRIT "inet6_proto_init: size fault\n"); return -EINVAL; } /* * ipngwg API draft makes clear that the correct semantics * for TCP and UDP is to consider one TCP and UDP instance * in a host availiable by both INET and INET6 APIs and * able to communicate via both network protocols. */ #if defined(MODULE) && defined(CONFIG_SYSCTL) ipv6_sysctl_register(); #endif err = icmpv6_init(&inet6_family_ops); if (err) goto icmp_fail; err = ndisc_init(&inet6_family_ops); if (err) goto ndisc_fail; err = igmp6_init(&inet6_family_ops); if (err) goto igmp_fail; /* Create /proc/foo6 entries. */ #ifdef CONFIG_PROC_FS err = -ENOMEM; if (!proc_net_create("raw6", 0, raw6_get_info)) goto proc_raw6_fail; if (!proc_net_create("tcp6", 0, tcp6_get_info)) goto proc_tcp6_fail; if (!proc_net_create("udp6", 0, udp6_get_info)) goto proc_udp6_fail; if (!proc_net_create("sockstat6", 0, afinet6_get_info)) goto proc_sockstat6_fail; if (!proc_net_create("snmp6", 0, afinet6_get_snmp)) goto proc_snmp6_fail; #endif ipv6_netdev_notif_init(); ipv6_packet_init(); ip6_route_init(); ip6_flowlabel_init(); addrconf_init(); sit_init(); /* Init v6 transport protocols. */ udpv6_init(); tcpv6_init(); /* Now the userspace is allowed to create INET6 sockets. */ (void) sock_register(&inet6_family_ops); return 0; #ifdef CONFIG_PROC_FS proc_snmp6_fail: proc_net_remove("sockstat6"); proc_sockstat6_fail: proc_net_remove("udp6"); proc_udp6_fail: proc_net_remove("tcp6"); proc_tcp6_fail: proc_net_remove("raw6"); proc_raw6_fail: igmp6_cleanup(); #endif igmp_fail: ndisc_cleanup(); ndisc_fail: icmpv6_cleanup(); icmp_fail: #if defined(MODULE) && defined(CONFIG_SYSCTL) ipv6_sysctl_unregister(); #endif return err; }