Skip to content

Commit

Permalink
Rename and move cstp_free_splits
Browse files Browse the repository at this point in the history
... to script.c which probably isn't the perfect place for it either, but
it *isn't* CSTP-specific.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jan 26, 2015
1 parent 6bdbab7 commit 7d86a78
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
25 changes: 1 addition & 24 deletions cstp.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion library.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion openconnect-internal.h
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
24 changes: 24 additions & 0 deletions script.c
Expand Up @@ -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)
{
Expand Down

0 comments on commit 7d86a78

Please sign in to comment.