static void openvpn_tunif_start(const char *ifname) { if (!is_interface_exist(ifname)) doSystem("%s %s --dev %s", OPENVPN_EXE, "--mktun", ifname); set_vpn_balancing(ifname); }
static void openvpn_tapif_start(const char *ifname, int insert_to_bridge) { if (!is_interface_exist(ifname)) doSystem("%s %s --dev %s", OPENVPN_EXE, "--mktun", ifname); if (insert_to_bridge) br_add_del_if(IFNAME_BR, ifname, 1); doSystem("ifconfig %s %s %s", ifname, "0.0.0.0", "promisc up"); set_vpn_balancing(ifname); }
int ipup_vpnc_main(int argc, char **argv) { char buf[256]; char *script_name = VPN_CLIENT_UPDOWN_SCRIPT; char *ifname = safe_getenv("IFNAME"); char *gw = getenv("IPREMOTE"); umask(0000); vpnc_route_to_remote_lan(ifname, gw, 1); vpnc_route_dgw(ifname, gw, 1); set_vpn_balancing(ifname); nvram_set_int_temp("vpnc_state_t", 1); buf[0] = 0; if (nvram_get_int("vpnc_pdns") > 0) { char *value; value = getenv("DNS1"); if (value) snprintf(buf, sizeof(buf), "%s", value); value = getenv("DNS2"); if (value && strcmp(value, buf) != 0) { int buf_len = strlen(buf); snprintf(buf + buf_len, sizeof(buf) - buf_len, "%s%s", (buf_len) ? " " : "", value); } } nvram_set_temp("vpnc_dns_t", buf); if (strlen(buf) > 0) update_resolvconf(0, 0); if (check_if_file_exist(script_name)) doSystem("%s %s", script_name, "up"); return 0; }