From 7d86a7882d6dc73f2a7daf75cc432b0ec40ad903 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 16 Jan 2015 11:21:43 -0800 Subject: [PATCH] Rename and move cstp_free_splits ... to script.c which probably isn't the perfect place for it either, but it *isn't* CSTP-specific. Signed-off-by: David Woodhouse --- cstp.c | 25 +------------------------ library.c | 2 +- openconnect-internal.h | 2 +- script.c | 24 ++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/cstp.c b/cstp.c index bb1196ab..3901616f 100644 --- a/cstp.c +++ b/cstp.c @@ -123,29 +123,6 @@ static void calculate_mtu(struct openconnect_info *vpninfo, int *base_mtu, int * *mtu = 1280; } -void cstp_free_splits(struct openconnect_info *vpninfo) -{ - struct oc_split_include *inc; - - for (inc = vpninfo->ip_info.split_includes; inc; ) { - struct oc_split_include *next = inc->next; - free(inc); - inc = next; - } - for (inc = vpninfo->ip_info.split_excludes; inc; ) { - struct oc_split_include *next = inc->next; - free(inc); - inc = next; - } - for (inc = vpninfo->ip_info.split_dns; inc; ) { - struct oc_split_include *next = inc->next; - free(inc); - inc = next; - } - vpninfo->ip_info.split_dns = vpninfo->ip_info.split_includes = - vpninfo->ip_info.split_excludes = NULL; -} - /* if DTLS 1.2 is supported */ #if defined(DTLS_GNUTLS) && GNUTLS_VERSION_NUMBER >= 0x030200 # define DEFAULT_CIPHER_LIST "OC-DTLS1_2-AES256-GCM:OC-DTLS1_2-AES128-GCM:AES256-SHA:AES128-SHA:DES-CBC3-SHA:DES-CBC-SHA" @@ -200,7 +177,7 @@ static int start_cstp_connection(struct openconnect_info *vpninfo) for (i = 0; i < 3; i++) vpninfo->ip_info.dns[i] = vpninfo->ip_info.nbns[i] = NULL; - cstp_free_splits(vpninfo); + free_split_routes(vpninfo); retry: calculate_mtu(vpninfo, &base_mtu, &mtu); diff --git a/library.c b/library.c index 2e8dad9b..664439ca 100644 --- a/library.c +++ b/library.c @@ -220,7 +220,7 @@ void openconnect_vpninfo_free(struct openconnect_info *vpninfo) free_optlist(vpninfo->cookies); free_optlist(vpninfo->cstp_options); free_optlist(vpninfo->dtls_options); - cstp_free_splits(vpninfo); + free_split_routes(vpninfo); free(vpninfo->hostname); free(vpninfo->unique_hostname); free(vpninfo->urlpath); diff --git a/openconnect-internal.h b/openconnect-internal.h index f7fe272c..ce87e153 100644 --- a/openconnect-internal.h +++ b/openconnect-internal.h @@ -650,6 +650,7 @@ int script_setenv_int(struct openconnect_info *vpninfo, const char *opt, int val void prepare_script_env(struct openconnect_info *vpninfo); int script_config_tun(struct openconnect_info *vpninfo, const char *reason); int apply_script_env(struct oc_vpn_option *envs); +void free_split_routes(struct openconnect_info *vpninfo); /* tun.c / tun-win32.c */ void os_shutdown_tun(struct openconnect_info *vpninfo); @@ -671,7 +672,6 @@ void cstp_common_headers(struct openconnect_info *vpninfo, struct oc_text_buf *b int cstp_connect(struct openconnect_info *vpninfo); int cstp_mainloop(struct openconnect_info *vpninfo, int *timeout); int cstp_bye(struct openconnect_info *vpninfo, const char *reason); -void cstp_free_splits(struct openconnect_info *vpninfo); int decompress_and_queue_packet(struct openconnect_info *vpninfo, unsigned char *buf, int len); int compress_packet(struct openconnect_info *vpninfo, int compr_type, struct pkt *this); diff --git a/script.c b/script.c index dda79245..65156c6c 100644 --- a/script.c +++ b/script.c @@ -328,6 +328,30 @@ void prepare_script_env(struct openconnect_info *vpninfo) setenv_cstp_opts(vpninfo); } +void free_split_routes(struct openconnect_info *vpninfo) +{ + struct oc_split_include *inc; + + for (inc = vpninfo->ip_info.split_includes; inc; ) { + struct oc_split_include *next = inc->next; + free(inc); + inc = next; + } + for (inc = vpninfo->ip_info.split_excludes; inc; ) { + struct oc_split_include *next = inc->next; + free(inc); + inc = next; + } + for (inc = vpninfo->ip_info.split_dns; inc; ) { + struct oc_split_include *next = inc->next; + free(inc); + inc = next; + } + vpninfo->ip_info.split_dns = vpninfo->ip_info.split_includes = + vpninfo->ip_info.split_excludes = NULL; +} + + #ifdef _WIN32 static wchar_t *create_script_env(struct openconnect_info *vpninfo) {