mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 22:46:14 -05:00
feat: support the --script-tun option
This commit is contained in:
5 files changed
+44
-18
No files matched your search
@@ -13,6 +13,7 @@ pub(crate) struct ConnectOptions {
|
||||
|
||||
pub script: *const c_char,
|
||||
pub interface: *const c_char,
|
||||
pub script_tun: u32,
|
||||
pub os: *const c_char,
|
||||
pub certificate: *const c_char,
|
||||
pub sslkey: *const c_char,
|
||||
|
||||
@@ -12,6 +12,7 @@ void *g_user_data;
|
||||
static int g_cmd_pipe_fd;
|
||||
static const char *g_vpnc_script;
|
||||
static const char *g_vpnc_interface;
|
||||
static int g_script_tun;
|
||||
static vpn_connected_callback on_vpn_connected;
|
||||
|
||||
/* Validate the peer certificate */
|
||||
@@ -41,8 +42,14 @@ static void print_progress(__attribute__((unused)) void *_vpninfo, int level,
|
||||
|
||||
static void setup_tun_handler(void *_vpninfo)
|
||||
{
|
||||
int ret = openconnect_setup_tun_device(_vpninfo, g_vpnc_script,
|
||||
g_vpnc_interface);
|
||||
int ret;
|
||||
if (g_script_tun) {
|
||||
ret = openconnect_setup_tun_script(_vpninfo, g_vpnc_script);
|
||||
} else {
|
||||
ret = openconnect_setup_tun_device(_vpninfo, g_vpnc_script,
|
||||
g_vpnc_interface);
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
on_vpn_connected(g_cmd_pipe_fd, g_user_data);
|
||||
}
|
||||
@@ -58,11 +65,13 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
|
||||
g_user_data = options->user_data;
|
||||
g_vpnc_script = options->script;
|
||||
g_vpnc_interface = options->interface;
|
||||
g_script_tun = options->script_tun;
|
||||
on_vpn_connected = callback;
|
||||
|
||||
INFO("User agent: %s", options->user_agent);
|
||||
INFO("VPNC script: %s", options->script);
|
||||
INFO("USER_AGENT: %s", options->user_agent);
|
||||
INFO("OS: %s", options->os);
|
||||
INFO("VPNC_SCRIPT: %s", options->script);
|
||||
INFO("SCRIPT_TUN: %d", g_script_tun);
|
||||
INFO("CSD_USER: %d", options->csd_uid);
|
||||
INFO("CSD_WRAPPER: %s", options->csd_wrapper);
|
||||
INFO("RECONNECT_TIMEOUT: %d", options->reconnect_timeout);
|
||||
|
||||
@@ -13,6 +13,7 @@ typedef struct vpn_options {
|
||||
|
||||
const char *script;
|
||||
const char *interface;
|
||||
const int script_tun;
|
||||
const char *os;
|
||||
const char *certificate;
|
||||
const char *sslkey;
|
||||
|
||||
Reference in new issue
Block a user