Browse code

svn merge -r 771:780 $SO/trunk/openvpn

git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@781 e7ae566f-a301-0410-adde-c780ea21d3b5

james authored on 2005/11/05 16:42:33
Showing 10 changed files
... ...
@@ -7,9 +7,12 @@ $Id$
7 7
 
8 8
 * Allow blank passwords to be passed via the management
9 9
   interface.
10
+* Fixed bug where "make check" inside a FreeBSD "jail"
11
+  would never complete (Matthias Andree).
10 12
 * Fixed bug where --server directive in --dev tap mode
11 13
   claimed that it would support subnets of /30 or less
12 14
   but actually would only accept /29 or less.
15
+* Extend byte counters to 64 bits (M. van Cuijk).
13 16
 * Fixed bug in Linux get_default_gateway function
14 17
   introduced in 2.0.4, which would cause redirect-gateway
15 18
   on Linux clients to fail.
... ...
@@ -28,7 +28,7 @@
28 28
 /*
29 29
  * Statistics counters.
30 30
  */
31
-typedef unsigned long counter_type;
31
+typedef unsigned long long int counter_type;
32 32
 
33 33
 /*
34 34
  * Time intervals
... ...
@@ -43,7 +43,7 @@ typedef int interval_t;
43 43
 /*
44 44
  * Printf formats for special types
45 45
  */
46
-#define counter_format          "%lu"
46
+#define counter_format          "%llu"
47 47
 #define ptr_format              "0x%08lx"
48 48
 #define time_format             "%lu"
49 49
 #define fragment_header_format  "0x%08x"
... ...
@@ -25,7 +25,7 @@ dnl Process this file with autoconf to produce a configure script.
25 25
 
26 26
 AC_PREREQ(2.50)
27 27
 
28
-AC_INIT([OpenVPN], [2.1_beta6], [openvpn-users@lists.sourceforge.net], [openvpn])
28
+AC_INIT([OpenVPN], [2.1_beta5], [openvpn-users@lists.sourceforge.net], [openvpn])
29 29
 AM_CONFIG_HEADER(config.h)
30 30
 AC_CONFIG_SRCDIR(syshead.h)
31 31
 
... ...
@@ -843,6 +843,14 @@ manage_env (char *str)
843 843
 /* add/modify/delete environmental strings */
844 844
 
845 845
 void
846
+setenv_counter (struct env_set *es, const char *name, counter_type value)
847
+{
848
+  char buf[64];
849
+  openvpn_snprintf (buf, sizeof(buf), counter_format, value);
850
+  setenv_str (es, name, buf);
851
+}
852
+
853
+void
846 854
 setenv_int (struct env_set *es, const char *name, int value)
847 855
 {
848 856
   char buf[64];
... ...
@@ -158,6 +158,7 @@ void setenv_str_ex (struct env_set *es,
158 158
 		    const unsigned int value_exclude,
159 159
 		    const char value_replace);
160 160
 
161
+void setenv_counter (struct env_set *es, const char *name, counter_type value);
161 162
 void setenv_int (struct env_set *es, const char *name, int value);
162 163
 void setenv_str (struct env_set *es, const char *name, const char *value);
163 164
 void setenv_del (struct env_set *es, const char *name);
... ...
@@ -404,8 +404,8 @@ multi_client_disconnect_setenv (struct multi_context *m,
404 404
   setenv_trusted (mi->context.c2.es, get_link_socket_info (&mi->context));
405 405
 
406 406
   /* setenv stats */
407
-  setenv_int (mi->context.c2.es, "bytes_received", mi->context.c2.link_read_bytes);
408
-  setenv_int (mi->context.c2.es, "bytes_sent", mi->context.c2.link_write_bytes);
407
+  setenv_counter (mi->context.c2.es, "bytes_received", mi->context.c2.link_read_bytes);
408
+  setenv_counter (mi->context.c2.es, "bytes_sent", mi->context.c2.link_write_bytes);
409 409
 
410 410
 }
411 411
 
... ...
@@ -161,13 +161,16 @@ check_send_occ_req_dowork (struct context *c)
161 161
 	 * Give up.
162 162
 	 */
163 163
 	msg (D_SHOW_OCC,
164
-	     "NOTE: failed to obtain options consistency info from peer -- this could occur if the remote peer is running a version of "
164
+	     "NOTE: failed to obtain options consistency info from peer -- "
165
+	     "this could occur if the remote peer is running a version of "
165 166
 	     PACKAGE_NAME
166 167
 	     " before 1.5-beta8 or if there is a network connectivity problem, and will not necessarily prevent "
167 168
 	     PACKAGE_NAME
168
-	     " from running (%u bytes received from peer, %u bytes authenticated data channel traffic) -- you can disable the options consistency check with --disable-occ.",
169
-	     (unsigned int) c->c2.link_read_bytes,
170
-	     (unsigned int) c->c2.link_read_bytes_auth);
169
+             " from running (" counter_format " bytes received from peer, " counter_format
170
+	     " bytes authenticated data channel traffic) -- you can disable the options consistency "
171
+	     "check with --disable-occ.",
172
+             c->c2.link_read_bytes,
173
+             c->c2.link_read_bytes_auth);
171 174
       event_timeout_clear (&c->c2.occ_interval);
172 175
     }
173 176
   else
... ...
@@ -587,6 +587,15 @@ socket_do_accept (socket_descriptor_t sd,
587 587
       new_sd = accept (sd, (struct sockaddr *) &act->dest.sa, &remote_len);
588 588
     }
589 589
 
590
+#if 0 /* For debugging only, test the effect of accept() failures */
591
+ {
592
+   static int foo = 0;
593
+   ++foo;
594
+   if (foo & 1)
595
+     new_sd = -1;
596
+ }
597
+#endif
598
+
590 599
   if (!socket_defined (new_sd))
591 600
     {
592 601
       msg (D_LINK_ERRORS | M_ERRNO_SOCK, "TCP: accept(%d) failed", sd);
... ...
@@ -20,19 +20,33 @@
20 20
 
21 21
 set -e
22 22
 echo "the following test will run about two minutes..." >&2
23
-trap "rm -f log.$$ ; false" 1 2 3 15
23
+trap "rm -f log.$$ log.$$.signal ; trap 0 ; exit 77" 1 2 15
24
+trap "rm -f log.$$ log.$$.signal ; exit 1" 0 3
25
+addopts=
26
+case `uname -s` in
27
+    FreeBSD)
28
+    # FreeBSD jails map the outgoing IP to the jail IP - we need to
29
+    # allow the real IP unless we want the test to run forever.
30
+    if test `sysctl -n security.jail.jailed` != 0 ; then
31
+	addopts="--float"
32
+    fi
33
+    ;;
34
+esac
24 35
 set +e
25 36
 (
26
-./openvpn --cd "${srcdir}" --config sample-config-files/loopback-server &
27
-./openvpn --cd "${srcdir}" --config sample-config-files/loopback-client
28
-) >log.$$ 2>&1
37
+./openvpn --cd "${srcdir}" ${addopts} --down 'echo "srv:${signal}" >&3 ; : #' --tls-exit --ping-exit 180 --config sample-config-files/loopback-server &
38
+./openvpn --cd "${srcdir}" ${addopts} --down 'echo "clt:${signal}" >&3 ; : #' --tls-exit --ping-exit 180 --config sample-config-files/loopback-client
39
+) 3>log.$$.signal >log.$$ 2>&1
29 40
 e1=$?
30 41
 wait $!
31 42
 e2=$?
43
+grep -v ":inactive$" log.$$.signal >/dev/null && { cat log.$$.signal ; echo ; cat log.$$ ; exit 1 ; }
44
+
32 45
 set -e
33 46
 
34 47
 if [ $e1 != 0 ] || [ $e2 != 0 ] ; then
35 48
     cat log.$$
36 49
     exit 1
37 50
 fi
38
-rm log.$$
51
+rm log.$$ log.$$.signal
52
+trap 0
... ...
@@ -19,11 +19,13 @@
19 19
 # 02110-1301, USA.
20 20
 
21 21
 set -e
22
-trap "rm -f key.$$ log.$$ ; false" 1 2 3 15
22
+trap "rm -f key.$$ log.$$ ; trap 0 ; exit 77" 1 2 15
23
+trap "rm -f key.$$ log.$$ ; exit 1" 0 3
23 24
 ./openvpn --genkey --secret key.$$
24 25
 set +e
25 26
 ( ./openvpn --test-crypto --secret key.$$ ) >log.$$ 2>&1
26 27
 e=$?
27 28
 if [ $e != 0 ] ; then cat log.$$ ; fi
28
-rm key.$$
29
+rm key.$$ log.$$
30
+trap 0
29 31
 exit $e