From c7fc5003107d56d81e518e784a2bc72f7d7c2f8e Mon Sep 17 00:00:00 2001 From: Andrey Kaipov <3871647-andreykaipov@users.noreply.gitlab.com> Date: Fri, 19 Apr 2019 21:10:12 -0400 Subject: [PATCH] Allow routes with no netmask; default to /32 Signed-off-by: Andrey Kaipov <3871647-andreykaipov@users.noreply.gitlab.com> --- script.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/script.c b/script.c index 5b751ad55..cd9282d3c 100644 --- a/script.c +++ b/script.c @@ -98,7 +98,22 @@ static int process_split_xxclude(struct openconnect_info *vpninfo, int masklen; slash = strchr(route, '/'); - if (!slash) { + if (slash) { + *slash = 0; + } else if (inet_aton(route, &addr)) { + envname[79] = 0; + snprintf(envname, 79, "CISCO_SPLIT_%sC_%d_ADDR", in_ex, *v4_incs); + script_setenv(vpninfo, envname, route, 0); + + snprintf(envname, 79, "CISCO_SPLIT_%sC_%d_MASK", in_ex, *v4_incs); + script_setenv(vpninfo, envname, "255.255.255.255", 0); + + snprintf(envname, 79, "CISCO_SPLIT_%sC_%d_MASKLEN", in_ex, *v4_incs); + script_setenv_int(vpninfo, envname, 32); + + (*v4_incs)++; + return 0; + } else { badinc: if (include) vpn_progress(vpninfo, PRG_ERR, @@ -111,8 +126,6 @@ static int process_split_xxclude(struct openconnect_info *vpninfo, return -EINVAL; } - *slash = 0; - if (strchr(route, ':')) { snprintf(envname, 79, "CISCO_IPV6_SPLIT_%sC_%d_ADDR", in_ex, *v6_incs); -- GitLab