/* Daemon init sequence */ static void start_vrrp(void) { /* Initialize sub-system */ init_interface_queue(); kernel_netlink_init(); gratuitous_arp_init(); ndisc_init(); #ifdef _WITH_SNMP_ if (!reload && snmp) vrrp_snmp_agent_init(); #endif #ifdef _WITH_LVS_ /* Initialize ipvs related */ ipvs_start(); #endif /* Parse configuration file */ data = alloc_global_data(); vrrp_data = alloc_vrrp_data(); alloc_vrrp_buffer(); init_data(conf_file, vrrp_init_keywords); if (!vrrp_data) { stop_vrrp(); return; } if (reload) { clear_diff_saddresses(); clear_diff_sroutes(); clear_diff_vrrp(); clear_diff_script(); } /* Complete VRRP initialization */ if (!vrrp_complete_init()) { stop_vrrp(); return; } /* Post initializations */ log_message(LOG_INFO, "Configuration is using : %lu Bytes", mem_allocated); /* Set static entries */ netlink_iplist(vrrp_data->static_addresses, IPADDRESS_ADD); netlink_rtlist_ipv4(vrrp_data->static_routes, IPROUTE_ADD); /* Dump configuration */ if (debug & 4) { dump_global_data(data); dump_vrrp_data(vrrp_data); } /* Initialize linkbeat */ init_interface_linkbeat(); /* Init & start the VRRP packet dispatcher */ thread_add_event(master, vrrp_dispatcher_init, NULL, VRRP_DISPATCHER); }
/* Daemon init sequence */ static void start_vrrp(void) { /* Initialize sub-system */ init_interface_queue(); kernel_netlink_init(); gratuitous_arp_init(); ndisc_init(); /* Parse configuration file */ global_data = alloc_global_data(); vrrp_data = alloc_vrrp_data(); init_data(conf_file, vrrp_init_keywords); if (!vrrp_data) { stop_vrrp(); return; } init_global_data(global_data); #ifdef _WITH_SNMP_ if (!reload && (global_data->enable_snmp_keepalived || global_data->enable_snmp_rfc)) { vrrp_snmp_agent_init(global_data->snmp_socket); #ifdef _WITH_SNMP_RFC_ vrrp_start_time = timer_now(); #endif } #endif #ifdef _WITH_LVS_ if (vrrp_ipvs_needed()) { /* Initialize ipvs related */ if (ipvs_start() != IPVS_SUCCESS) { stop_vrrp(); return; } } #endif if (reload) { clear_diff_saddresses(); clear_diff_srules(); clear_diff_sroutes(); clear_diff_vrrp(); clear_diff_script(); } /* Complete VRRP initialization */ if (!vrrp_complete_init()) { if (vrrp_ipvs_needed()) { stop_vrrp(); } return; } #ifdef _HAVE_LIBIPTC_ iptables_init(); #endif /* Post initializations */ #ifdef _DEBUG_ log_message(LOG_INFO, "Configuration is using : %lu Bytes", mem_allocated); #endif /* Set static entries */ netlink_iplist(vrrp_data->static_addresses, IPADDRESS_ADD); netlink_rulelist(vrrp_data->static_rules, IPRULE_ADD); netlink_rtlist(vrrp_data->static_routes, IPROUTE_ADD); /* Dump configuration */ if (__test_bit(DUMP_CONF_BIT, &debug)) { dump_global_data(global_data); dump_vrrp_data(vrrp_data); } /* Initialize linkbeat */ init_interface_linkbeat(); /* Init & start the VRRP packet dispatcher */ thread_add_event(master, vrrp_dispatcher_init, NULL, VRRP_DISPATCHER); }
/* Daemon init sequence */ static void start_vrrp(void) { /* Initialize sub-system */ init_interface_queue(); kernel_netlink_init(); gratuitous_arp_init(); ndisc_init(); global_data = alloc_global_data(); #ifdef _HAVE_LIBIPTC_ iptables_init(); #endif /* Parse configuration file */ vrrp_data = alloc_vrrp_data(); init_data(conf_file, vrrp_init_keywords); if (!vrrp_data) { stop_vrrp(); return; } init_global_data(global_data); /* Set the process priority and non swappable if configured */ if (global_data->vrrp_process_priority) set_process_priority(global_data->vrrp_process_priority); if (global_data->vrrp_no_swap) set_process_dont_swap(4096); /* guess a stack size to reserve */ #ifdef _WITH_SNMP_ if (!reload && (global_data->enable_snmp_keepalived || global_data->enable_snmp_rfcv2 || global_data->enable_snmp_rfcv3)) { vrrp_snmp_agent_init(global_data->snmp_socket); #ifdef _WITH_SNMP_RFC_ vrrp_start_time = timer_now(); #endif } #endif #ifdef _WITH_LVS_ if (vrrp_ipvs_needed()) { /* Initialize ipvs related */ if (ipvs_start() != IPVS_SUCCESS) { stop_vrrp(); return; } #ifdef _HAVE_IPVS_SYNCD_ /* If we are managing the sync daemon, then stop any * instances of it that may have been running if * we terminated abnormally */ ipvs_syncd_cmd(IPVS_STOPDAEMON, NULL, IPVS_MASTER, 0, true); ipvs_syncd_cmd(IPVS_STOPDAEMON, NULL, IPVS_BACKUP, 0, true); #endif } #endif if (reload) { clear_diff_saddresses(); #ifdef _HAVE_FIB_ROUTING_ clear_diff_srules(); clear_diff_sroutes(); #endif clear_diff_vrrp(); clear_diff_script(); } else { /* Clear leftover static entries */ netlink_iplist(vrrp_data->static_addresses, IPADDRESS_DEL); #ifdef _HAVE_FIB_ROUTING_ netlink_rtlist(vrrp_data->static_routes, IPROUTE_DEL); netlink_error_ignore = ENOENT; netlink_rulelist(vrrp_data->static_rules, IPRULE_DEL, true); netlink_error_ignore = 0; #endif } /* Complete VRRP initialization */ if (!vrrp_complete_init()) { if (vrrp_ipvs_needed()) { stop_vrrp(); } return; } #ifdef _HAVE_LIBIPTC_ iptables_startup(); #endif /* Post initializations */ #ifdef _DEBUG_ log_message(LOG_INFO, "Configuration is using : %lu Bytes", mem_allocated); #endif /* Set static entries */ netlink_iplist(vrrp_data->static_addresses, IPADDRESS_ADD); #ifdef _HAVE_FIB_ROUTING_ netlink_rtlist(vrrp_data->static_routes, IPROUTE_ADD); netlink_rulelist(vrrp_data->static_rules, IPRULE_ADD, false); #endif /* Dump configuration */ if (__test_bit(DUMP_CONF_BIT, &debug)) { list ifl; dump_global_data(global_data); dump_vrrp_data(vrrp_data); ifl = get_if_list(); if (!LIST_ISEMPTY(ifl)) dump_list(ifl); } /* Initialize linkbeat */ init_interface_linkbeat(); /* Init & start the VRRP packet dispatcher */ thread_add_event(master, vrrp_dispatcher_init, NULL, VRRP_DISPATCHER); }