[PATCH] cstp: Add workaround for 255.255.255.255 netmask on windows

Aleksandar Kanchev aleksandar.kanchev at gmail.com
Tue May 27 00:44:25 PDT 2014


inet_aton("255.255.255.255") would fail on windows which would
result of the script variable INTERNAL_IP4_NETMASK not being set.

Another side effect is that if the TAP Windows driver is being
initialized with 255.255.255.255 netmask then there's no way
to convince windows to route packets through that interface.
---
 cstp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/cstp.c b/cstp.c
index fb801ab..23dd3ef 100644
--- a/cstp.c
+++ b/cstp.c
@@ -380,8 +380,13 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
 			if (strchr(new_option->value, ':')) {
 				if (!vpninfo->disable_ipv6)
 					vpninfo->ip_info.netmask6 = new_option->value;
-			} else
+			} else {
 				vpninfo->ip_info.netmask = new_option->value;
+#ifdef _WIN32
+				if (!strcmp(new_option->value, "255.255.255.255"))
+					vpninfo->ip_info.netmask = "255.255.255.0";
+#endif
+			}
 		} else if (!strcmp(buf + 7, "DNS")) {
 			int j;
 			for (j = 0; j < 3; j++) {
-- 
1.9.3




More information about the openconnect-devel mailing list