void full_restart_ipv6(int ipv6_type_old) { int ipv6_type = get_ipv6_type(); int ipv6_toggled = ((ipv6_type == IPV6_DISABLED || ipv6_type_old == IPV6_DISABLED) && (ipv6_type != ipv6_type_old)) ? 1 : 0; if (ipv6_toggled) { stop_lltd(); stop_httpd(); } stop_upnp(); stop_dhcp6c(); stop_dns_dhcpd(); if (ipv6_type == IPV6_DISABLED) { clear_all_route6(); clear_all_addr6(); clear_if_neigh6(IFNAME_BR); stop_sit_tunnel(); reset_lan6_vars(); reset_wan6_vars(); control_if_ipv6_all(0); set_libc_gai(1); update_resolvconf(0, 1); reload_nat_modules(); restart_firewall(); start_dns_dhcpd(0); } else { set_libc_gai(0); control_if_ipv6_all(1); clear_all_addr6(); reset_lan6_vars(); reload_lan_addr6(); full_restart_wan(); if (!is_dns_dhcpd_run()) start_dns_dhcpd(0); } if (ipv6_toggled) { start_httpd(0); start_lltd(); } }
/* Sometimes, dnsmasq crashed, try to re-run it */ static void dnsmasq_process_check(void) { if (!is_dns_dhcpd_run()) dnsmasq_missing++; else dnsmasq_missing = 0; if (dnsmasq_missing > 1) { dnsmasq_missing = 0; logmessage("watchdog", "dnsmasq is missing, start again!"); start_dns_dhcpd(0); } }
void init_router(void) { int log_remote, is_ap_mode, nvram_need_commit; #if defined (USE_RTL8367) rtl8367_node(); #endif #if defined (USE_MTK_ESW) || defined (USE_MTK_GSW) mtk_esw_node(); #endif nvram_convert_old_params(); nvram_need_commit = nvram_restore_defaults(); get_eeprom_params(); nvram_convert_misc_values(); if (nvram_need_commit) nvram_commit(); init_gpio_leds_buttons(); gen_ralink_config_2g(0); gen_ralink_config_5g(0); load_wireless_modules(); #if (BOARD_NUM_USB_PORTS > 0) load_usb_modules(); #endif recreate_passwd_unix(1); set_timezone(); set_pagecache_reclaim(); storage_load_time(); is_ap_mode = get_ap_mode(); log_remote = nvram_invmatch("log_ipaddr", ""); if (!log_remote) start_logger(1); init_loopback(); init_bridge(is_ap_mode); #if defined (USE_IPV6) init_ipv6(); #endif start_detect_link(); start_detect_internet(0); start_lan(is_ap_mode, 0); if (log_remote) start_logger(1); start_dns_dhcpd(is_ap_mode); #if defined(APP_SMBD) || defined(APP_NMBD) start_wins(); #endif if (!is_ap_mode) { ipt_nat_default(); ipt_filter_default(); #if defined (USE_IPV6) ip6t_filter_default(); #endif start_wan(); } start_services_once(is_ap_mode); notify_leds_detect_link(); // system ready system("/etc/storage/started_script.sh &"); }