[PATCH] Fix incorrect return value of inet_aton() shim

Joe Hu i at sapika.ch
Thu Jul 10 01:43:26 PDT 2014


inet_aton() returns nonzero if the address is valid, zero if not.

This bug caused INTERNAL_IP4_NETMASK not getting set and all split
routes was considered invalid under Windows.

Signed-off-by: Joe Hu <i at sapika.ch>
---
 compat.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/compat.c b/compat.c
index f70d0af..5844f6f 100644
--- a/compat.c
+++ b/compat.c
@@ -216,14 +216,14 @@ int openconnect__inet_aton(const char *cp, struct in_addr *addr)
   addr->s_addr = inet_addr(cp);
 #if INADDR_NONE == 0xffffffff
   if (addr->s_addr != 0xffffffff)
-	  return 0;
+	  return 1;
   /* Is it an error, or was it really 255.255.255.255? */
   if (!strcmp(cp, "255.255.255.255"))
-	  return 0;
+	  return 1;
 #else
 #error What is your INADDR_NONE?
 #endif
-  return 1;
+  return 0;
 }
 #endif
 
-- 
1.7.5.GIT




More information about the openconnect-devel mailing list