/* void */ int ipsec_cleanup(void) { int error = 0; #ifdef CONFIG_SYSCTL ipsec_sysctl_unregister(); #endif KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling ipsec_tunnel_cleanup_devices.\n"); error |= ipsec_tunnel_cleanup_devices(); KLIPS_PRINT(debug_netlink, "called ipsec_tunnel_cleanup_devices"); /* we never actually link IPCOMP to the stack */ #ifdef IPCOMP_USED_ALONE #ifdef CONFIG_IPSEC_IPCOMP if (openswan_inet_del_protocol(&comp_protocol, IPPROTO_COMP) < 0) printk(KERN_INFO "klips_debug:ipsec_cleanup: " "comp close: can't remove protocol\n"); #endif /* CONFIG_IPSEC_IPCOMP */ #endif /* IPCOMP_USED_ALONE */ #ifdef CONFIG_IPSEC_AH if (openswan_inet_del_protocol(&ah_protocol, IPPROTO_AH) < 0) printk(KERN_INFO "klips_debug:ipsec_cleanup: " "ah close: can't remove protocol\n"); #endif /* CONFIG_IPSEC_AH */ #ifdef CONFIG_IPSEC_ESP if (openswan_inet_del_protocol(&esp_protocol, IPPROTO_ESP) < 0) printk(KERN_INFO "klips_debug:ipsec_cleanup: " "esp close: can't remove protocol\n"); #endif /* CONFIG_IPSEC_ESP */ error |= unregister_netdevice_notifier(&ipsec_dev_notifier); KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling ipsec_sadb_cleanup.\n"); error |= ipsec_sadb_cleanup(0); error |= ipsec_sadb_free(); KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling ipsec_radijcleanup.\n"); error |= ipsec_radijcleanup(); KLIPS_PRINT(debug_pfkey, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling pfkey_cleanup.\n"); error |= pfkey_cleanup(); ipsec_proc_cleanup(); prng_final(&ipsec_prng); return error; }
/* void */ int ipsec_cleanup(void) { int error = 0; #ifdef CONFIG_SYSCTL ipsec_sysctl_unregister(); #endif #if defined(NET_26) && defined(CONFIG_IPSEC_NAT_TRAVERSAL) if(udp4_unregister_esp_rcvencap(klips_old_encap) < 0) { printk(KERN_ERR "KLIPS: can not unregister klips_rcv_encap function\n"); } #endif KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling ipsec_tunnel_cleanup_devices.\n"); error |= ipsec_tunnel_cleanup_devices(); KLIPS_PRINT(debug_netlink, "called ipsec_tunnel_cleanup_devices"); /* we never actually link IPCOMP to the stack */ #ifdef IPCOMP_USED_ALONE #ifdef CONFIG_KLIPS_IPCOMP if (openswan_inet_del_protocol(&comp_protocol, IPPROTO_COMP) < 0) printk(KERN_INFO "klips_debug:ipsec_cleanup: " "comp close: can't remove protocol\n"); #endif /* CONFIG_KLIPS_IPCOMP */ #endif /* IPCOMP_USED_ALONE */ #ifdef CONFIG_KLIPS_AH if (openswan_inet_del_protocol(&ah_protocol, IPPROTO_AH) < 0) printk(KERN_INFO "klips_debug:ipsec_cleanup: " "ah close: can't remove protocol\n"); #endif /* CONFIG_KLIPS_AH */ #ifdef CONFIG_KLIPS_ESP if (openswan_inet_del_protocol(&esp_protocol, IPPROTO_ESP) < 0) printk(KERN_INFO "klips_debug:ipsec_cleanup: " "esp close: can't remove protocol\n"); #endif /* CONFIG_KLIPS_ESP */ error |= unregister_netdevice_notifier(&ipsec_dev_notifier); KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling ipsec_sadb_cleanup.\n"); error |= ipsec_sadb_cleanup(0); error |= ipsec_sadb_free(); KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling ipsec_radijcleanup.\n"); error |= ipsec_radijcleanup(); KLIPS_PRINT(debug_pfkey, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling pfkey_cleanup.\n"); error |= pfkey_cleanup(); ipsec_proc_cleanup(); prng_final(&ipsec_prng); if (ipsec_irs_cache) kmem_cache_destroy(ipsec_irs_cache); ipsec_irs_cache = NULL; if (ipsec_ixs_cache) kmem_cache_destroy(ipsec_ixs_cache); ipsec_ixs_cache = NULL; return error; }
void #else int #endif ipsec_cleanup(void) { int error = 0; #ifdef CONFIG_SYSCTL ipsec_sysctl_unregister(); #endif #if defined(NET_26) && defined(CONFIG_IPSEC_NAT_TRAVERSAL) if(udp4_unregister_esp_rcvencap(klips26_rcv_encap, klips_old_encap) < 0) { printk(KERN_ERR "KLIPS: can not unregister klips_rcv_encap function\n"); } #endif error |= ipsec_mast_cleanup_devices(); KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling ipsec_tunnel_cleanup_devices.\n"); error |= ipsec_tunnel_cleanup_devices(); KLIPS_PRINT(debug_netlink, "called ipsec_tunnel_cleanup_devices"); #ifdef CONFIG_XFRM_ALTERNATE_STACK xfrm_deregister_alternate_rcv(ipsec_rcv); #else // CONFIG_XFRM_ALTERNATE_STACK /* we never actually link IPCOMP to the stack */ #ifdef IPCOMP_USED_ALONE #ifdef CONFIG_KLIPS_IPCOMP if (openswan_inet_del_protocol(&comp_protocol, IPPROTO_COMP) < 0) printk(KERN_INFO "klips_debug:ipsec_cleanup: " "comp close: can't remove protocol\n"); #endif /* CONFIG_KLIPS_IPCOMP */ #endif /* IPCOMP_USED_ALONE */ #ifdef CONFIG_KLIPS_AH if (openswan_inet_del_protocol(&ah_protocol, IPPROTO_AH) < 0) printk(KERN_INFO "klips_debug:ipsec_cleanup: " "ah close: can't remove protocol\n"); #endif /* CONFIG_KLIPS_AH */ #ifdef CONFIG_KLIPS_ESP if (openswan_inet_del_protocol(&esp_protocol, IPPROTO_ESP) < 0) printk(KERN_INFO "klips_debug:ipsec_cleanup: " "esp close: can't remove protocol\n"); #endif /* CONFIG_KLIPS_ESP */ #endif // CONFIG_XFRM_ALTERNATE_STACK error |= unregister_netdevice_notifier(&ipsec_dev_notifier); KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling ipsec_sadb_cleanup.\n"); error |= ipsec_sadb_cleanup(0); error |= ipsec_sadb_free(); KLIPS_PRINT(debug_netlink, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling ipsec_radijcleanup.\n"); error |= ipsec_radijcleanup(); KLIPS_PRINT(debug_pfkey, /* debug_tunnel & DB_TN_INIT, */ "klips_debug:ipsec_cleanup: " "calling pfkey_cleanup.\n"); error |= pfkey_cleanup(); ipsec_rcv_state_cache_cleanup (); ipsec_xmit_state_cache_cleanup (); ipsec_proc_cleanup(); prng_final(&ipsec_prng); #ifdef NET_26 if (error) printk("ipsec_cleanup: error %d\n", error); #else return error; #endif }