mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Add mtu option
This commit is contained in:
@@ -18,6 +18,8 @@ pub(crate) struct ConnectOptions {
|
||||
|
||||
pub csd_uid: u32,
|
||||
pub csd_wrapper: *const c_char,
|
||||
|
||||
pub mtu: u32,
|
||||
}
|
||||
|
||||
#[link(name = "vpn")]
|
||||
|
@@ -63,6 +63,7 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
|
||||
INFO("OS: %s", options->os);
|
||||
INFO("CSD_USER: %d", options->csd_uid);
|
||||
INFO("CSD_WRAPPER: %s", options->csd_wrapper);
|
||||
INFO("MTU: %d", options->mtu);
|
||||
|
||||
vpninfo = openconnect_vpninfo_new(options->user_agent, validate_peer_cert, NULL, NULL, print_progress, NULL);
|
||||
|
||||
@@ -97,6 +98,11 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
|
||||
openconnect_setup_csd(vpninfo, options->csd_uid, 1, options->csd_wrapper);
|
||||
}
|
||||
|
||||
if (options->mtu > 0) {
|
||||
int mtu = options->mtu < 576 ? 576 : options->mtu;
|
||||
openconnect_set_reqmtu(vpninfo, mtu);
|
||||
}
|
||||
|
||||
g_cmd_pipe_fd = openconnect_setup_cmd_pipe(vpninfo);
|
||||
if (g_cmd_pipe_fd < 0)
|
||||
{
|
||||
|
@@ -19,6 +19,8 @@ typedef struct vpn_options
|
||||
|
||||
const uid_t csd_uid;
|
||||
const char *csd_wrapper;
|
||||
|
||||
const int mtu;
|
||||
} vpn_options;
|
||||
|
||||
int vpn_connect(const vpn_options *options, vpn_connected_callback callback);
|
||||
|
Reference in New Issue
Block a user