static void flash_firmware(void) { char* svcs[] = { "l2tpd", "xl2tpd", "pppd", "wpa_cli", "wpa_supplicant", NULL }; stop_misc(); stop_services(0); // don't stop httpd/telnetd/sshd/vpn #if (BOARD_NUM_USB_PORTS > 0) stop_usb_printer_spoolers(); safe_remove_usb_device(0, NULL, 0); #endif stop_igmpproxy(NULL); kill_services(svcs, 6, 1); /* save storage (if changed) */ storage_save_time(60); write_storage_to_mtd(); sync(); sleep(1); if (eval("/tmp/mtd_write", "-r", "write", FW_IMG_NAME, FW_MTD_NAME) != 0) { start_watchdog(); } }
void stop_services(int stopall) { if (stopall) { stop_telnetd(); #if defined(APP_SSHD) stop_sshd(); #endif stop_httpd(); stop_vpn_server(); } #if (BOARD_NUM_USB_PORTS > 0) stop_p910nd(); #if defined(SRV_LPRD) stop_lpd(); #endif #if defined(SRV_U2EC) stop_u2ec(); #endif #endif stop_networkmap(); stop_lltd(); stop_detect_internet(); stop_rstats(); stop_infosvr(); stop_igmpproxy(NULL); }