/* Reload thread */ int reload_vrrp_thread(thread * thread_obj) { /* set the reloading flag */ SET_RELOAD; SYS_VRRP_LOG_INFO("VRRP configure have been reload."); /* Close sockpool */ free_vrrp_sockpool(vrrp_data); /* Signal handling */ signal_reset(); signal_set(SIGHUP, sighup_vrrp, NULL); signal_set(SIGINT, sigend_vrrp, NULL); signal_set(SIGTERM, sigend_vrrp, NULL); signal_ignore(SIGPIPE); /* Destroy master thread */ thread_destroy_master(master); master = thread_make_master(); free_global_data(data); /* add by zhouben */ backup_if_queue(); kernel_netlink_close(); free_vrrp_buffer(); gratuitous_arp_close(); ndisc_close(); vrrp_trackip_close(); /* Save previous conf data */ old_vrrp_data = vrrp_data; vrrp_data = NULL; #ifdef _WITH_LVS_ /* Clean ipvs related */ //ipvs_stop(); #endif /* Reload the conf */ mem_allocated = 0; vrrp_signal_init(); signal_set(SIGCHLD, thread_child_handler, master); start_vrrp(); /* free backup data */ free_old_interface_queue_only(); free_vrrp_data(old_vrrp_data); UNSET_RELOAD; /*end of reload, store the state to file*/ reloading = 0; vrrp_state_store(); return 0; }
/* Daemon stop sequence */ static void stop_vrrp(void) { /* Destroy master thread */ signal_handler_destroy(); thread_destroy_master(master); if (!(debug & 8)) shutdown_vrrp_instances(); /* Clear static entries */ netlink_rtlist_ipv4(vrrp_data->static_routes, IPROUTE_DEL); netlink_iplist(vrrp_data->static_addresses, IPADDRESS_DEL); free_vrrp_sockpool(vrrp_data); free_interface_queue(); gratuitous_arp_close(); ndisc_close(); #ifdef _WITH_SNMP_ if (snmp) vrrp_snmp_agent_close(); #endif /* Stop daemon */ pidfile_rm(vrrp_pidfile); /* Clean data */ free_global_data(data); free_vrrp_data(vrrp_data); free_vrrp_buffer(); #ifdef _WITH_LVS_ /* Clean ipvs related */ ipvs_stop(); #endif #ifdef _DEBUG_ keepalived_free_final("VRRP Child process"); #endif /* * Reached when terminate signal catched. * finally return to parent process. */ closelog(); exit(0); }
/* Reload thread */ int reload_vrrp_thread(thread_t * thread) { /* set the reloading flag */ SET_RELOAD; /* Close sockpool */ free_vrrp_sockpool(vrrp_data); /* Signal handling */ signal_reset(); signal_handler_destroy(); /* Destroy master thread */ thread_destroy_master(master); master = thread_make_master(); free_global_data(data); free_interface_queue(); free_vrrp_buffer(); gratuitous_arp_close(); ndisc_close(); /* Save previous conf data */ old_vrrp_data = vrrp_data; vrrp_data = NULL; #ifdef _WITH_LVS_ /* Clean ipvs related */ ipvs_stop(); #endif /* Reload the conf */ mem_allocated = 0; vrrp_signal_init(); signal_set(SIGCHLD, thread_child_handler, master); start_vrrp(); /* free backup data */ free_vrrp_data(old_vrrp_data); UNSET_RELOAD; return 0; }