Browse code

Version 2.1_beta11 released

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

james authored on 2006/02/19 21:17:59
Showing 3 changed files
... ...
@@ -3,6 +3,11 @@ Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>
3 3
 
4 4
 $Id$
5 5
 
6
+2006.02.19 -- Version 2.1-beta11
7
+
8
+* Fixed --port-share bug that caused premature closing
9
+  of proxied sessions.
10
+
6 11
 2006.02.17 -- Version 2.1-beta10
7 12
 
8 13
 * Fixed --port-share breakage introduced in 2.1-beta9.
... ...
@@ -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_beta10a], [openvpn-users@lists.sourceforge.net], [openvpn])
28
+AC_INIT([OpenVPN], [2.1_beta11], [openvpn-users@lists.sourceforge.net], [openvpn])
29 29
 AM_CONFIG_HEADER(config.h)
30 30
 AC_CONFIG_SRCDIR(syshead.h)
31 31
 
... ...
@@ -62,8 +62,10 @@ struct port_share *port_share = NULL; /* GLOBAL */
62 62
 #define IOSTAT_WRITE_ERROR      3 /* the other end of our write socket (pc->counterpart) was closed */
63 63
 #define IOSTAT_GOOD             4 /* nothing to report */
64 64
 
65
-/* A foreign (non-OpenVPN) connection we are proxying,
66
-   usually HTTPS */
65
+/*
66
+ * A foreign (non-OpenVPN) connection we are proxying,
67
+ * usually HTTPS
68
+ */
67 69
 struct proxy_connection {
68 70
   bool defined;
69 71
   struct proxy_connection *next;
... ...
@@ -188,7 +190,7 @@ port_share_sendmsg (const socket_descriptor_t sd,
188 188
       ssize_t status;
189 189
 
190 190
       dmsg (D_PS_PROXY_DEBUG, "PORT SHARE: sendmsg sd=%d len=%d",
191
-	    sd_send,
191
+	    (int)sd_send,
192 192
 	    head ? BLEN(head) : -1);
193 193
 
194 194
       CLEAR (mesg);
... ...
@@ -253,7 +255,7 @@ proxy_entry_close_sd (struct proxy_connection *pc, struct event_set *es)
253 253
 {
254 254
   if (pc->defined && socket_defined (pc->sd))
255 255
     {
256
-      dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: delete sd=%d", pc->sd);
256
+      dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: delete sd=%d", (int)pc->sd);
257 257
       if (es)
258 258
 	event_del (es, pc->sd);
259 259
       openvpn_close_socket (pc->sd);
... ...
@@ -344,7 +346,7 @@ proxy_connection_io_requeue (struct proxy_connection *pc, const int rwflags_new,
344 344
 {
345 345
   if (socket_defined (pc->sd) && pc->rwflags != rwflags_new)
346 346
     {
347
-      /*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: requeue[%d] rwflags=%d", pc->sd, rwflags_new);*/
347
+      /*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: requeue[%d] rwflags=%d", (int)pc->sd, rwflags_new);*/
348 348
       event_ctl (es, pc->sd, rwflags_new, (void*)pc);
349 349
       pc->rwflags = rwflags_new;
350 350
     }
... ...
@@ -411,7 +413,7 @@ proxy_entry_new (struct proxy_connection **list,
411 411
   /* add to list */
412 412
   *list = pc;
413 413
   
414
-  dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: NEW CONNECTION [c=%d s=%d]", sd_client, sd_server);
414
+  dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: NEW CONNECTION [c=%d s=%d]", (int)sd_client, (int)sd_server);
415 415
 
416 416
   /* set initial i/o states */
417 417
   proxy_connection_io_requeue (pc, EVENT_READ, es);
... ...
@@ -474,7 +476,7 @@ control_message_from_parent (const socket_descriptor_t sd_control,
474 474
       else
475 475
 	{
476 476
 	  const socket_descriptor_t received_fd = *((socket_descriptor_t*)CMSG_DATA(h));
477
-	  dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: RECEIVED sd=%d", received_fd);
477
+	  dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: RECEIVED sd=%d", (int)received_fd);
478 478
 
479 479
 	  if (status >= 2 && command == COMMAND_REDIRECT)
480 480
 	    {
... ...
@@ -526,39 +528,39 @@ proxy_connection_io_recv (struct proxy_connection *pc)
526 526
 static int
527 527
 proxy_connection_io_send (struct proxy_connection *pc, int *bytes_sent)
528 528
 {
529
-      const socket_descriptor_t sd = pc->counterpart->sd;
530
-      const int status = send (sd, BPTR(&pc->buf), BLEN(&pc->buf), MSG_NOSIGNAL);
529
+  const socket_descriptor_t sd = pc->counterpart->sd;
530
+  const int status = send (sd, BPTR(&pc->buf), BLEN(&pc->buf), MSG_NOSIGNAL);
531 531
 
532
-      if (status < 0)
532
+  if (status < 0)
533
+    {
534
+      const int e = errno;
535
+      return (e == EAGAIN) ? IOSTAT_EAGAIN_ON_WRITE : IOSTAT_WRITE_ERROR;
536
+    }
537
+  else
538
+    {
539
+      *bytes_sent += status;
540
+      if (status != pc->buf.len)
533 541
 	{
534
-	  const int e = errno;
535
-	  return (e == EAGAIN) ? IOSTAT_EAGAIN_ON_WRITE : IOSTAT_WRITE_ERROR;
542
+	  dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: partial write[%d], tried=%d got=%d", (int)sd, pc->buf.len, status);
543
+	  buf_advance (&pc->buf, status);
544
+	  return IOSTAT_EAGAIN_ON_WRITE;
536 545
 	}
537 546
       else
538 547
 	{
539
-	  *bytes_sent += status;
540
-	  if (status != pc->buf.len)
541
-	    {
542
-	      dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: partial write[%d], tried=%d got=%d", (int)sd, pc->buf.len, status);
543
-	      buf_advance (&pc->buf, status);
544
-	      return IOSTAT_EAGAIN_ON_WRITE;
545
-	    }
546
-	  else
547
-	    {
548
-	      /*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: wrote[%d] %d", (int)sd, status);*/
549
-	      pc->buf.len = 0;
550
-	      pc->buf.offset = 0;
551
-	    }
548
+	  /*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: wrote[%d] %d", (int)sd, status);*/
549
+	  pc->buf.len = 0;
550
+	  pc->buf.offset = 0;
552 551
 	}
552
+    }
553 553
 
554
-      /* realloc send buffer after initial send */
555
-      if (pc->buffer_initial)
556
-	{
557
-	  free_buf (&pc->buf);
558
-	  pc->buf = alloc_buf (PROXY_CONNECTION_BUFFER_SIZE);
559
-	  pc->buffer_initial = false;
560
-	}
561
-      return IOSTAT_GOOD;
554
+  /* realloc send buffer after initial send */
555
+  if (pc->buffer_initial)
556
+    {
557
+      free_buf (&pc->buf);
558
+      pc->buf = alloc_buf (PROXY_CONNECTION_BUFFER_SIZE);
559
+      pc->buffer_initial = false;
560
+    }
561
+  return IOSTAT_GOOD;
562 562
 }
563 563
 
564 564
 /*