Module Name:    src
Committed By:   tteras
Date:           Tue Jan 10 12:07:30 UTC 2012

Modified Files:
        src/crypto/dist/ipsec-tools: configure.ac
        src/crypto/dist/ipsec-tools/src/racoon: isakmp_unity.c

Log Message:
>From Rainer Weikusat <[email protected]>: Enhance splitnet
environment variable string value generation.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/crypto/dist/ipsec-tools/configure.ac
cvs rdiff -u -r1.10 -r1.11 \
    src/crypto/dist/ipsec-tools/src/racoon/isakmp_unity.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/dist/ipsec-tools/configure.ac
diff -u src/crypto/dist/ipsec-tools/configure.ac:1.10 src/crypto/dist/ipsec-tools/configure.ac:1.11
--- src/crypto/dist/ipsec-tools/configure.ac:1.10	Fri Jan 23 08:25:06 2009
+++ src/crypto/dist/ipsec-tools/configure.ac	Tue Jan 10 12:07:30 2012
@@ -112,7 +112,7 @@ esac
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(limits.h sys/time.h unistd.h stdarg.h varargs.h)
-AC_CHECK_HEADERS(shadow.h)
+AC_CHECK_HEADERS(shadow.h strings.h)
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST

Index: src/crypto/dist/ipsec-tools/src/racoon/isakmp_unity.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/isakmp_unity.c:1.10 src/crypto/dist/ipsec-tools/src/racoon/isakmp_unity.c:1.11
--- src/crypto/dist/ipsec-tools/src/racoon/isakmp_unity.c:1.10	Sun Jan  1 17:31:42 2012
+++ src/crypto/dist/ipsec-tools/src/racoon/isakmp_unity.c	Tue Jan 10 12:07:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: isakmp_unity.c,v 1.10 2012/01/01 17:31:42 tteras Exp $	*/
+/*	$NetBSD: isakmp_unity.c,v 1.11 2012/01/10 12:07:30 tteras Exp $	*/
 
 /* Id: isakmp_unity.c,v 1.10 2006/07/31 04:49:23 manubsd Exp */
 
@@ -62,6 +62,9 @@
 #endif
 #include <ctype.h>
 #include <resolv.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
 
 #include "var.h"
 #include "misc.h"
@@ -399,16 +402,17 @@ char * splitnet_list_2str(list, splitnet
 	while (netentry != NULL) {
 
 		inet_ntop(AF_INET, &netentry->network.addr4, tmp1, 40);
-		inet_ntop(AF_INET, &netentry->network.mask4, tmp2, 40);
 		if (splitnet_ipaddr == CIDR) {
 			uint32_t tmp3;
 			int cidrmask;
 
 			tmp3 = ntohl(netentry->network.mask4.s_addr);
-			for (cidrmask = 0; tmp3 != 0; cidrmask++)
-				tmp3 <<= 1;
+			cidrmask = 33 - ffs(tmp3);
+			if (cidrmask == 33) cidrmask = 0;
+			
 			len += sprintf(str+len, "%s/%d ", tmp1, cidrmask);
 		} else {
+			inet_ntop(AF_INET, &netentry->network.mask4, tmp2, 40);
 			len += sprintf(str+len, "%s/%s ", tmp1, tmp2);
 		}
 

Reply via email to