Skip to contentSkip to conversation

New pre-1.3.3 beta

Openvpn-devel James Yonan 2 participants 4 messages Mar 14, 2003 – Mar 15, 2003 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

If you have a chance, please test this beta. I mostly use linux 2.4 for development, so I don't have much of a chance to test on linux 2.2 and non-linux OSes.

Since the last beta announcement on this list, there's been a bunch of changes including build system portability fixes, --dev-name, and --mtu-disc. The latter gives access to a linux system call that allows some manual control over how and whether Path MTU Discovery is implemented on the UDP socket.

You can download via CVS or from a tarball:

http://openvpn.sourceforge.net/beta/openvpn-1.3.2.17.tar.gz

Change Log:

* Added --replay-persist feature to allow replay protection across sessions.
* Fixed bug where --ifconfig could not be used with --tun-mtu.
* Added --tun-mtu-extra parameter to deal with the situation where a read on a TUN/TAP device returns more data than the device's MTU size.
* Fixed bug where some IPv6 support code for Linux was not being properly ifdefed out for Linux 2.2, causing compile errors.
* Added OPENVPN_EXIT_STATUS_x codes to openvpn.h to control which status value openvpn returns to its caller (such as
a shell or inetd/xinetd) for various conditions.
* Added OPENVPN_DEBUG_COMMAND_LINE flag to openvpn.h to allow debugging in situations where stdout, stderr, and syslog cannot be used for message output, such as when OpenVPN is instantiated by inetd/xinetd.
* Removed owner-execute permission from file created by static key generator (Herbert Xu and Alberto Gonzalez Iniesta).
* Added --passtos option to allow IPv4 TOS bits to be passed from TUN/TAP input packets to the outgoing UDP socket (Craig Knox).
* Added code to prevent open socket file descriptors from being accessible to called scripts.
* Added --dev-name option (Christian Lademann).
* Added --mtu-disc option for manual control over MTU options.
* Show OS MTU value on UDP socket write failures (linux only).
* Numerous build system and portability fixes (Matthias Andree).
* Added better sensing of compiler support for variable argument macros, including (a) gcc style, (b) ISO C 1999 style, and (c) no support.
* Removed generated files from CVS. Note INSTALL file for new CVS build commands.
* Changed all internal _* symbols to x_*
for C standards compliance.

James

#1 lore raw
Quoted 3 lines · James Yonan

If you have a chance, please test this beta. I mostly use linux 2.4 for development, so I don't have much of a chance to test on linux 2.2 and non-linux OSes.

There are some warnings with Sun's compiler about uint8_t vs. char clashes. Do you intend to silence the warnings or are you interested to see them? I think they're harmless but annoying.

Other than that, it compiles on FreeBSD 4.8-RC x86 and Solaris 8 sparc (32-bit mode), on the latter with Sun's compiler and gcc 2.95.

Signature · 1 line
Matthias Andree
#3 lore raw
In reply to a message not in the archive
Quoted 5 lines · James Yonan

Yes, I think we should try to fix if it's only a trivial cast involved to silence the warning.

I don't see them on gcc 2.96, even with "-Wall -W -Wpointer-arith -Wsign-compare -Winline".

Indeed, it takes the sun compiler or the even more picky splint utility (www.splint.org) to see them.

The patch below doesn't fix
"crypto.c", line 228: warning: end-of-loop code not reached

also on ll. 237 259 269 273 277 281 286 299 312 327.

Fixing that would require a rewrite of crypto.c, the issue is the

do { goto ...; } while(false);

I'm not fixing this and I don't recommend changing that at this time (after 1.3.3 maybe, if you're to fix that at all).

Here's the patch:

# buffer.c     |   14 +++++++-------
# crypto.c     |   12 ++++++------
# error.c      |    2 +-
# lzo.c        |    2 ++
# misc.c       |    2 +-
# packet_id.c  |    4 ++--
# reliable.c   |    2 ++
# session_id.c |    2 ++
# socket.c     |    4 ++--
# ssl.c        |    6 ++++--
# thread.c     |    2 ++
# tun.c        |    4 ++--
# 12 files changed, 33 insertions(+), 23 deletions(-)

Index: buffer.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/buffer.c,v
retrieving revision 1.11

buffer.c +7 -7
diff -u -r1.11 buffer.c
@@ -115,14 +115,14 @@
 {
   va_list arglist;
 
-  char *ptr = BEND (buf);
+  uint8_t *ptr = BEND (buf);
   int cap = buf_forward_capacity (buf);
 
   va_start (arglist, format);
-  vsnprintf (ptr, cap, format, arglist);
+  vsnprintf ((char *)ptr, cap, format, arglist);
   va_end (arglist);
 
-  buf->len += strlen (ptr);
+  buf->len += strlen ((char *)ptr);
 }
 
 /*
@@ -137,7 +137,7 @@
       int len = strlen (str) + 1;
       if (len < buf_forward_capacity_total (buf))
 	{
-	  strncpynt (buf->data + buf->capacity - len, str, len);
+	  strncpynt ((char *)(buf->data + buf->capacity - len), str, len);
 	}
     }
 }
@@ -148,7 +148,7 @@
 void
 convert_to_one_line (struct buffer *buf)
 {
-  char *cp = BPTR(buf);
+  uint8_t *cp = BPTR(buf);
   int len = BLEN(buf);
   while (len--)
     {
@@ -185,7 +185,7 @@
   struct gc_entry *e;
   struct gc_thread* thread = &x_gc_thread[thread_number()];
 
-  while (e = thread->gc_stack)
+  while ((e = thread->gc_stack))
     {
       if (e->level < level)
 	break;
@@ -235,5 +235,5 @@
       buf_printf (&out, "%02x", data[i]);
     }
   buf_catrunc (&out, "[more...]");
-  return out.data;
+  return (char *)out.data;
 }

Index: crypto.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/crypto.c,v
retrieving revision 1.14

crypto.c +6 -6
diff -u -r1.14 crypto.c
@@ -184,7 +184,7 @@
 	  HMAC_Update (ctx->hmac, BPTR (&work), BLEN (&work));
 	  output = buf_prepend (&work, HMAC_size (ctx->hmac));
 	  ASSERT (output);
-	  HMAC_Final (ctx->hmac, output, &hmac_len);
+	  HMAC_Final (ctx->hmac, output, (unsigned int *)&hmac_len);
 	  ASSERT (hmac_len == HMAC_size (ctx->hmac));
 	}
 
@@ -229,7 +229,7 @@
 
 	  HMAC_Update (ctx->hmac, BPTR (buf) + hmac_len,
 		       BLEN (buf) - hmac_len);
-	  HMAC_Final (ctx->hmac, local_hmac, &in_hmac_len);
+	  HMAC_Final (ctx->hmac, local_hmac, (unsigned int *)&in_hmac_len);
 	  ASSERT (hmac_len == in_hmac_len);
 
 	  /* Compare locally computed HMAC with packet HMAC */
@@ -883,9 +883,9 @@
   if (fd == -1)
     msg (M_ERR, "Cannot open shared secret file %s", filename);
 
-  while (size = read (fd, in.data, in.capacity))
+  while ((size = read (fd, in.data, in.capacity)))
     {
-      const char *cp = in.data;
+      const char *cp = (char *)in.data;
       while (size)
 	{
 	  const char c = *cp;
@@ -923,7 +923,7 @@
 		    if (hb_index == 2)
 		      {
 			unsigned int u;
-			ASSERT(sscanf(hex_byte, "%x", &u) == 1);
+			ASSERT(sscanf((const char *)hex_byte, "%x", &u) == 1);
 			*out++ = u;
 			hb_index = 0;
 			if (++count == keylen)
@@ -982,7 +982,7 @@
   buf_printf (&out, "%s\n", static_key_foot);
 
   /* write data to file */
-  len = strlen (BPTR(&out));
+  len = strlen ((char *)BPTR(&out));
   size = write (fd, BPTR(&out), len);
   if (size != len)
     msg (M_ERR, "Write error on shared secret file %s", filename);

Index: error.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/error.c,v
retrieving revision 1.15

error.c +1 -1
diff -u -r1.15 error.c
@@ -177,7 +177,7 @@
     {
       int nerrs = 0;
       int err;
-      while (err = ERR_get_error ())
+      while ((err = ERR_get_error ()))
 	{
 	  snprintf (m2, ERR_BUF_SIZE, "%s: %s", m1, ERR_error_string (err, NULL));
 	  SWAP;

Index: lzo.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/lzo.c,v
retrieving revision 1.11

lzo.c +2 -0
diff -u -r1.11 lzo.c
@@ -239,4 +239,6 @@
   msg (M_INFO, " post-decompress bytes:" counter_format, lzo_compwork->post_decompress);
 }
 
+#else
+static void dummy(void) {}
 #endif /* USE_LZO */

Index: misc.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/misc.c,v
retrieving revision 1.15

misc.c +1 -1
diff -u -r1.15 misc.c
@@ -285,7 +285,7 @@
       else
 	buf_printf (&out, "shell command exited with error status: %d", cmd_ret);
     }
-  return out.data;
+  return (const char *)out.data;
 }
 
 /*

Index: packet_id.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/packet_id.c,v
retrieving revision 1.11

packet_id.c +2 -2
diff -u -r1.11 packet_id.c
@@ -124,7 +124,7 @@
     }
 
   buf_printf (&out, " ]");
-  return out.data;
+  return (char *)out.data;
 }
 
 /* initialize the packet_id_persist structure in a disabled state */
@@ -265,7 +265,7 @@
     }
 
   buf_printf (&out, " ]");
-  return out.data;
+  return (char *)out.data;
 }
 
 #ifdef PID_TEST

Index: reliable.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/reliable.c,v
retrieving revision 1.10

reliable.c +2 -0
diff -u -r1.10 reliable.c
@@ -500,4 +500,6 @@
 
 #endif
 
+#else
+static void dummy(void) {}
 #endif /* USE_CRYPTO && USE_SSL*/

Index: session_id.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/session_id.c,v
retrieving revision 1.4

session_id.c +2 -0
diff -u -r1.4 session_id.c
@@ -60,4 +60,6 @@
   return format_hex (sid->id, SID_SIZE, 0);
 }
 
+#else
+static void dummy(void) {}
 #endif /* USE_CRYPTO && USE_SSL*/

Index: socket.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/socket.c,v
retrieving revision 1.17

socket.c +2 -2
diff -u -r1.17 socket.c
@@ -255,7 +255,7 @@
 	    {
 	      char command[256];
 	      struct buffer out;
-	      buf_set_write (&out, command, sizeof (command));
+	      buf_set_write (&out, (uint8_t *)command, sizeof (command));
 	      buf_printf (&out, "%s %s",
 			  sock->ipchange_command,
 			  print_sockaddr_ex (&usa->actual, true, " "));
@@ -356,5 +356,5 @@
 
       buf_printf (&out, "%d", port);
     }
-  return out.data;
+  return (char *)out.data;
 }

Index: ssl.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/ssl.c,v
retrieving revision 1.30

ssl.c +4 -2
diff -u -r1.30 ssl.c
@@ -228,7 +228,7 @@
 system_safe_string (char *cp)
 {
   int c;
-  while (c = *cp)
+  while ((c = *cp))
     {
       if (isalnum (c)
 	  || c == '/'
@@ -494,7 +494,7 @@
 
   printf ("Available TLS Ciphers,\n");
   printf ("listed in order of preference:\n\n");
-  while (cipher_name = SSL_get_cipher_list (ssl, priority++))
+  while ((cipher_name = SSL_get_cipher_list (ssl, priority++)))
     printf ("%s\n", cipher_name);
   printf ("\n");
 
@@ -2491,4 +2491,6 @@
   return out.data;
 }
 
+#else
+static void dummy(void) {}
 #endif /* USE_CRYPTO && USE_SSL*/

Index: thread.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/thread.c,v
retrieving revision 1.4

thread.c +2 -0
diff -u -r1.4 thread.c
@@ -175,4 +175,6 @@
     }
 }
 
+#else
+static void dummy(void) {}
 #endif

Index: tun.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/tun.c,v
retrieving revision 1.25

tun.c +2 -2
diff -u -r1.25 tun.c
@@ -609,7 +609,7 @@
 {
   struct strbuf sbuf;
   sbuf.len = len;
-  sbuf.buf = buf;
+  sbuf.buf = (char *)buf;
   return putmsg (tt->fd, NULL, &sbuf, 0) >= 0 ? sbuf.len : -1;
 }
 
@@ -620,7 +620,7 @@
   int f = 0;
 
   sbuf.maxlen = len;
-  sbuf.buf = buf;
+  sbuf.buf = (char *)buf;
   return getmsg (tt->fd, NULL, &sbuf, &f) >= 0 ? sbuf.len : -1;
 }
 
#4 lore raw

Matthias,

Patch looks good, though why the dummy() functions? They generate warnings on gcc 2.96 if you build with --disable-lzo, --disable-crypto, etc. Some compiler that doesn't like empty source files?

James

Quoted 177 lines · Matthias Andree
Quoted 5 lines · James Yonan

Yes, I think we should try to fix if it's only a trivial cast involved to silence the warning.

I don't see them on gcc 2.96, even with "-Wall -W -Wpointer-arith -Wsign-compare -Winline".

Indeed, it takes the sun compiler or the even more picky splint utility (www.splint.org) to see them.

The patch below doesn't fix
"crypto.c", line 228: warning: end-of-loop code not reached

also on ll. 237 259 269 273 277 281 286 299 312 327.

Fixing that would require a rewrite of crypto.c, the issue is the

do { goto ...; } while(false);

I'm not fixing this and I don't recommend changing that at this time (after 1.3.3 maybe, if you're to fix that at all).

Here's the patch:

# buffer.c     |   14 +++++++-------
# crypto.c     |   12 ++++++------
# error.c      |    2 +-
# lzo.c        |    2 ++
# misc.c       |    2 +-
# packet_id.c  |    4 ++--
# reliable.c   |    2 ++
# session_id.c |    2 ++
# socket.c     |    4 ++--
# ssl.c        |    6 ++++--
# thread.c     |    2 ++
# tun.c        |    4 ++--
# 12 files changed, 33 insertions(+), 23 deletions(-)

Index: buffer.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/buffer.c,v
retrieving revision 1.11
diff -u -r1.11 buffer.c

buffer.c +7 -7
@@ -115,14 +115,14 @@
 {
   va_list arglist;
 
-  char *ptr = BEND (buf);
+  uint8_t *ptr = BEND (buf);
   int cap = buf_forward_capacity (buf);
 
   va_start (arglist, format);
-  vsnprintf (ptr, cap, format, arglist);
+  vsnprintf ((char *)ptr, cap, format, arglist);
   va_end (arglist);
 
-  buf->len += strlen (ptr);
+  buf->len += strlen ((char *)ptr);
 }
 
 /*
@@ -137,7 +137,7 @@
       int len = strlen (str) + 1;
       if (len < buf_forward_capacity_total (buf))
 	{
-	  strncpynt (buf->data + buf->capacity - len, str, len);
+	  strncpynt ((char *)(buf->data + buf->capacity - len), str, len);
 	}
     }
 }
@@ -148,7 +148,7 @@
 void
 convert_to_one_line (struct buffer *buf)
 {
-  char *cp = BPTR(buf);
+  uint8_t *cp = BPTR(buf);
   int len = BLEN(buf);
   while (len--)
     {
@@ -185,7 +185,7 @@
   struct gc_entry *e;
   struct gc_thread* thread = &x_gc_thread[thread_number()];
 
-  while (e = thread->gc_stack)
+  while ((e = thread->gc_stack))
     {
       if (e->level < level)
 	break;
@@ -235,5 +235,5 @@
       buf_printf (&out, "%02x", data[i]);
     }
   buf_catrunc (&out, "[more...]");
-  return out.data;
+  return (char *)out.data;
 }

Index: crypto.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/crypto.c,v
retrieving revision 1.14
diff -u -r1.14 crypto.c

crypto.c +6 -6
@@ -184,7 +184,7 @@
 	  HMAC_Update (ctx->hmac, BPTR (&work), BLEN (&work));
 	  output = buf_prepend (&work, HMAC_size (ctx->hmac));
 	  ASSERT (output);
-	  HMAC_Final (ctx->hmac, output, &hmac_len);
+	  HMAC_Final (ctx->hmac, output, (unsigned int *)&hmac_len);
 	  ASSERT (hmac_len == HMAC_size (ctx->hmac));
 	}
 
@@ -229,7 +229,7 @@
 
 	  HMAC_Update (ctx->hmac, BPTR (buf) + hmac_len,
 		       BLEN (buf) - hmac_len);
-	  HMAC_Final (ctx->hmac, local_hmac, &in_hmac_len);
+	  HMAC_Final (ctx->hmac, local_hmac, (unsigned int *)&in_hmac_len);
 	  ASSERT (hmac_len == in_hmac_len);
 
 	  /* Compare locally computed HMAC with packet HMAC */
@@ -883,9 +883,9 @@
   if (fd == -1)
     msg (M_ERR, "Cannot open shared secret file %s", filename);
 
-  while (size = read (fd, in.data, in.capacity))
+  while ((size = read (fd, in.data, in.capacity)))
     {
-      const char *cp = in.data;
+      const char *cp = (char *)in.data;
       while (size)
 	{
 	  const char c = *cp;
@@ -923,7 +923,7 @@
 		    if (hb_index == 2)
 		      {
 			unsigned int u;
-			ASSERT(sscanf(hex_byte, "%x", &u) == 1);
+			ASSERT(sscanf((const char *)hex_byte, "%x", &u) == 1);
 			*out++ = u;
 			hb_index = 0;
 			if (++count == keylen)
@@ -982,7 +982,7 @@
   buf_printf (&out, "%s\n", static_key_foot);
 
   /* write data to file */
-  len = strlen (BPTR(&out));
+  len = strlen ((char *)BPTR(&out));
   size = write (fd, BPTR(&out), len);
   if (size != len)
     msg (M_ERR, "Write error on shared secret file %s", filename);

Index: error.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/error.c,v
retrieving revision 1.15
diff -u -r1.15 error.c

error.c +1 -1
@@ -177,7 +177,7 @@
     {
       int nerrs = 0;
       int err;
-      while (err = ERR_get_error ())
+      while ((err = ERR_get_error ()))
 	{
 	  snprintf (m2, ERR_BUF_SIZE, "%s: %s", m1, ERR_error_string (err, NULL));
 	  SWAP;

Index: lzo.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/lzo.c,v
retrieving revision 1.11
diff -u -r1.11 lzo.c

lzo.c line 239

Quoted 1 line
lzo.c +0 -0
@@ -239,4 +239,6 @@
   msg (M_INFO, " post-decompress bytes:" counter_format,

lzo_compwork->post_decompress);

Quoted 180 lines
lzo.c +2 -0
 }
 
+#else
+static void dummy(void) {}
 #endif /* USE_LZO */

Index: misc.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/misc.c,v
retrieving revision 1.15
diff -u -r1.15 misc.c

misc.c +1 -1
@@ -285,7 +285,7 @@
       else
 	buf_printf (&out, "shell command exited with error status: %d", cmd_ret);
     }
-  return out.data;
+  return (const char *)out.data;
 }
 
 /*

Index: packet_id.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/packet_id.c,v
retrieving revision 1.11
diff -u -r1.11 packet_id.c

packet_id.c +2 -2
@@ -124,7 +124,7 @@
     }
 
   buf_printf (&out, " ]");
-  return out.data;
+  return (char *)out.data;
 }
 
 /* initialize the packet_id_persist structure in a disabled state */
@@ -265,7 +265,7 @@
     }
 
   buf_printf (&out, " ]");
-  return out.data;
+  return (char *)out.data;
 }
 
 #ifdef PID_TEST

Index: reliable.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/reliable.c,v
retrieving revision 1.10
diff -u -r1.10 reliable.c

reliable.c +2 -0
@@ -500,4 +500,6 @@
 
 #endif
 
+#else
+static void dummy(void) {}
 #endif /* USE_CRYPTO && USE_SSL*/

Index: session_id.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/session_id.c,v
retrieving revision 1.4
diff -u -r1.4 session_id.c

session_id.c +2 -0
@@ -60,4 +60,6 @@
   return format_hex (sid->id, SID_SIZE, 0);
 }
 
+#else
+static void dummy(void) {}
 #endif /* USE_CRYPTO && USE_SSL*/

Index: socket.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/socket.c,v
retrieving revision 1.17
diff -u -r1.17 socket.c

socket.c +2 -2
@@ -255,7 +255,7 @@
 	    {
 	      char command[256];
 	      struct buffer out;
-	      buf_set_write (&out, command, sizeof (command));
+	      buf_set_write (&out, (uint8_t *)command, sizeof (command));
 	      buf_printf (&out, "%s %s",
 			  sock->ipchange_command,
 			  print_sockaddr_ex (&usa->actual, true, " "));
@@ -356,5 +356,5 @@
 
       buf_printf (&out, "%d", port);
     }
-  return out.data;
+  return (char *)out.data;
 }

Index: ssl.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/ssl.c,v
retrieving revision 1.30
diff -u -r1.30 ssl.c

ssl.c +4 -2
@@ -228,7 +228,7 @@
 system_safe_string (char *cp)
 {
   int c;
-  while (c = *cp)
+  while ((c = *cp))
     {
       if (isalnum (c)
 	  || c == '/'
@@ -494,7 +494,7 @@
 
   printf ("Available TLS Ciphers,\n");
   printf ("listed in order of preference:\n\n");
-  while (cipher_name = SSL_get_cipher_list (ssl, priority++))
+  while ((cipher_name = SSL_get_cipher_list (ssl, priority++)))
     printf ("%s\n", cipher_name);
   printf ("\n");
 
@@ -2491,4 +2491,6 @@
   return out.data;
 }
 
+#else
+static void dummy(void) {}
 #endif /* USE_CRYPTO && USE_SSL*/

Index: thread.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/thread.c,v
retrieving revision 1.4
diff -u -r1.4 thread.c

thread.c +2 -0
@@ -175,4 +175,6 @@
     }
 }
 
+#else
+static void dummy(void) {}
 #endif

Index: tun.c
===================================================================
RCS file: /cvsroot/openvpn/openvpn/tun.c,v
retrieving revision 1.25
diff -u -r1.25 tun.c

tun.c +2 -3
@@ -609,7 +609,7 @@
 {
   struct strbuf sbuf;
   sbuf.len = len;
-  sbuf.buf = buf;
+  sbuf.buf = (char *)buf;
   return putmsg (tt->fd, NULL, &sbuf, 0) >= 0 ? sbuf.len : -1;
 }
 
@@ -620,7 +620,7 @@
   int f = 0;
 
   sbuf.maxlen = len;
-  sbuf.buf = buf;
+  sbuf.buf = (char *)buf;
   return getmsg (tt->fd, NULL, &sbuf, &f) >= 0 ? sbuf.len : -1;
 }
 
 
 
-------------------------------------------------------

This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel