예제 #1
0
void
stop_vpn_server(void)
{
	int i;
	char pppd_pid[32];
	char* svcs[] = { "bcrelay", "pptpd", NULL,  NULL };

	if (get_xl2tpd_vpns_active()) {
		svcs[2] = "xl2tpd";
		xl2tpd_killed_vpns = 1;
	}

	kill_services(svcs, 5, 1);

	/* force kill all clients pppd */
	for (i=0; i<MAX_CLIENTS_NUM; i++) {
		sprintf(pppd_pid, "/var/run/ppp%d.pid", VPN_SERVER_PPP_UNIT+i);
		kill_pidfile_s(pppd_pid, SIGKILL);
	}

	nvram_set_int_temp("l2tp_srv_t", 0);

	unlink(VPNS_PPP_UP_SCRIPT);
	unlink(VPNS_PPP_DW_SCRIPT);

#if defined(APP_OPENVPN)
	stop_openvpn_server();
#endif

	unlink(VPN_SERVER_LEASE_FILE);
}
예제 #2
0
void
restart_openvpn_server(void)
{
    /* Note: SIGHUP is buggy with server drop privilegies */

    stop_openvpn_server();
    unlink(VPN_SERVER_LEASE_FILE);
    start_openvpn_server();
}