mirror of
https://github.com/OpenVPN/openvpn.git
synced 2025-05-09 21:51:05 +08:00
Version 2.1_beta11 released
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@904 e7ae566f-a301-0410-adde-c780ea21d3b5
This commit is contained in:
parent
154adc7a21
commit
16eda09737
@ -3,6 +3,11 @@ Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>
|
|||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
|
2006.02.19 -- Version 2.1-beta11
|
||||||
|
|
||||||
|
* Fixed --port-share bug that caused premature closing
|
||||||
|
of proxied sessions.
|
||||||
|
|
||||||
2006.02.17 -- Version 2.1-beta10
|
2006.02.17 -- Version 2.1-beta10
|
||||||
|
|
||||||
* Fixed --port-share breakage introduced in 2.1-beta9.
|
* Fixed --port-share breakage introduced in 2.1-beta9.
|
||||||
|
@ -25,7 +25,7 @@ dnl Process this file with autoconf to produce a configure script.
|
|||||||
|
|
||||||
AC_PREREQ(2.50)
|
AC_PREREQ(2.50)
|
||||||
|
|
||||||
AC_INIT([OpenVPN], [2.1_beta10a], [openvpn-users@lists.sourceforge.net], [openvpn])
|
AC_INIT([OpenVPN], [2.1_beta11], [openvpn-users@lists.sourceforge.net], [openvpn])
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
AC_CONFIG_SRCDIR(syshead.h)
|
AC_CONFIG_SRCDIR(syshead.h)
|
||||||
|
|
||||||
|
68
ps.c
68
ps.c
@ -62,8 +62,10 @@ struct port_share *port_share = NULL; /* GLOBAL */
|
|||||||
#define IOSTAT_WRITE_ERROR 3 /* the other end of our write socket (pc->counterpart) was closed */
|
#define IOSTAT_WRITE_ERROR 3 /* the other end of our write socket (pc->counterpart) was closed */
|
||||||
#define IOSTAT_GOOD 4 /* nothing to report */
|
#define IOSTAT_GOOD 4 /* nothing to report */
|
||||||
|
|
||||||
/* A foreign (non-OpenVPN) connection we are proxying,
|
/*
|
||||||
usually HTTPS */
|
* A foreign (non-OpenVPN) connection we are proxying,
|
||||||
|
* usually HTTPS
|
||||||
|
*/
|
||||||
struct proxy_connection {
|
struct proxy_connection {
|
||||||
bool defined;
|
bool defined;
|
||||||
struct proxy_connection *next;
|
struct proxy_connection *next;
|
||||||
@ -188,7 +190,7 @@ port_share_sendmsg (const socket_descriptor_t sd,
|
|||||||
ssize_t status;
|
ssize_t status;
|
||||||
|
|
||||||
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE: sendmsg sd=%d len=%d",
|
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE: sendmsg sd=%d len=%d",
|
||||||
sd_send,
|
(int)sd_send,
|
||||||
head ? BLEN(head) : -1);
|
head ? BLEN(head) : -1);
|
||||||
|
|
||||||
CLEAR (mesg);
|
CLEAR (mesg);
|
||||||
@ -253,7 +255,7 @@ proxy_entry_close_sd (struct proxy_connection *pc, struct event_set *es)
|
|||||||
{
|
{
|
||||||
if (pc->defined && socket_defined (pc->sd))
|
if (pc->defined && socket_defined (pc->sd))
|
||||||
{
|
{
|
||||||
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: delete sd=%d", pc->sd);
|
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: delete sd=%d", (int)pc->sd);
|
||||||
if (es)
|
if (es)
|
||||||
event_del (es, pc->sd);
|
event_del (es, pc->sd);
|
||||||
openvpn_close_socket (pc->sd);
|
openvpn_close_socket (pc->sd);
|
||||||
@ -344,7 +346,7 @@ proxy_connection_io_requeue (struct proxy_connection *pc, const int rwflags_new,
|
|||||||
{
|
{
|
||||||
if (socket_defined (pc->sd) && pc->rwflags != rwflags_new)
|
if (socket_defined (pc->sd) && pc->rwflags != rwflags_new)
|
||||||
{
|
{
|
||||||
/*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: requeue[%d] rwflags=%d", pc->sd, rwflags_new);*/
|
/*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: requeue[%d] rwflags=%d", (int)pc->sd, rwflags_new);*/
|
||||||
event_ctl (es, pc->sd, rwflags_new, (void*)pc);
|
event_ctl (es, pc->sd, rwflags_new, (void*)pc);
|
||||||
pc->rwflags = rwflags_new;
|
pc->rwflags = rwflags_new;
|
||||||
}
|
}
|
||||||
@ -411,7 +413,7 @@ proxy_entry_new (struct proxy_connection **list,
|
|||||||
/* add to list */
|
/* add to list */
|
||||||
*list = pc;
|
*list = pc;
|
||||||
|
|
||||||
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: NEW CONNECTION [c=%d s=%d]", sd_client, sd_server);
|
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: NEW CONNECTION [c=%d s=%d]", (int)sd_client, (int)sd_server);
|
||||||
|
|
||||||
/* set initial i/o states */
|
/* set initial i/o states */
|
||||||
proxy_connection_io_requeue (pc, EVENT_READ, es);
|
proxy_connection_io_requeue (pc, EVENT_READ, es);
|
||||||
@ -474,7 +476,7 @@ control_message_from_parent (const socket_descriptor_t sd_control,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const socket_descriptor_t received_fd = *((socket_descriptor_t*)CMSG_DATA(h));
|
const socket_descriptor_t received_fd = *((socket_descriptor_t*)CMSG_DATA(h));
|
||||||
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: RECEIVED sd=%d", received_fd);
|
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: RECEIVED sd=%d", (int)received_fd);
|
||||||
|
|
||||||
if (status >= 2 && command == COMMAND_REDIRECT)
|
if (status >= 2 && command == COMMAND_REDIRECT)
|
||||||
{
|
{
|
||||||
@ -526,39 +528,39 @@ proxy_connection_io_recv (struct proxy_connection *pc)
|
|||||||
static int
|
static int
|
||||||
proxy_connection_io_send (struct proxy_connection *pc, int *bytes_sent)
|
proxy_connection_io_send (struct proxy_connection *pc, int *bytes_sent)
|
||||||
{
|
{
|
||||||
const socket_descriptor_t sd = pc->counterpart->sd;
|
const socket_descriptor_t sd = pc->counterpart->sd;
|
||||||
const int status = send (sd, BPTR(&pc->buf), BLEN(&pc->buf), MSG_NOSIGNAL);
|
const int status = send (sd, BPTR(&pc->buf), BLEN(&pc->buf), MSG_NOSIGNAL);
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
|
{
|
||||||
|
const int e = errno;
|
||||||
|
return (e == EAGAIN) ? IOSTAT_EAGAIN_ON_WRITE : IOSTAT_WRITE_ERROR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*bytes_sent += status;
|
||||||
|
if (status != pc->buf.len)
|
||||||
{
|
{
|
||||||
const int e = errno;
|
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: partial write[%d], tried=%d got=%d", (int)sd, pc->buf.len, status);
|
||||||
return (e == EAGAIN) ? IOSTAT_EAGAIN_ON_WRITE : IOSTAT_WRITE_ERROR;
|
buf_advance (&pc->buf, status);
|
||||||
|
return IOSTAT_EAGAIN_ON_WRITE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*bytes_sent += status;
|
/*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: wrote[%d] %d", (int)sd, status);*/
|
||||||
if (status != pc->buf.len)
|
pc->buf.len = 0;
|
||||||
{
|
pc->buf.offset = 0;
|
||||||
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: partial write[%d], tried=%d got=%d", (int)sd, pc->buf.len, status);
|
|
||||||
buf_advance (&pc->buf, status);
|
|
||||||
return IOSTAT_EAGAIN_ON_WRITE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: wrote[%d] %d", (int)sd, status);*/
|
|
||||||
pc->buf.len = 0;
|
|
||||||
pc->buf.offset = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* realloc send buffer after initial send */
|
/* realloc send buffer after initial send */
|
||||||
if (pc->buffer_initial)
|
if (pc->buffer_initial)
|
||||||
{
|
{
|
||||||
free_buf (&pc->buf);
|
free_buf (&pc->buf);
|
||||||
pc->buf = alloc_buf (PROXY_CONNECTION_BUFFER_SIZE);
|
pc->buf = alloc_buf (PROXY_CONNECTION_BUFFER_SIZE);
|
||||||
pc->buffer_initial = false;
|
pc->buffer_initial = false;
|
||||||
}
|
}
|
||||||
return IOSTAT_GOOD;
|
return IOSTAT_GOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user