aboutsummaryrefslogtreecommitdiff
path: root/forward.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-02-16 18:12:24 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-02-16 18:12:24 +0000
commit6add6b2fe78c549d174729869e26cee917e31d5f (patch)
tree7b0786b12c40853bd9742d61e07417ade430f3d2 /forward.c
parentAdded "bytecount" command to management interface. (diff)
downloadopenvpn-6add6b2fe78c549d174729869e26cee917e31d5f.tar.xz
Added --port-share option for allowing OpenVPN and HTTPS
server to share the same port number. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@893 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to '')
-rw-r--r--forward.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/forward.c b/forward.c
index be041b9..5fec532 100644
--- a/forward.c
+++ b/forward.c
@@ -36,6 +36,7 @@
#include "gremlin.h"
#include "mss.h"
#include "event.h"
+#include "ps.h"
#include "memdbg.h"
@@ -640,18 +641,31 @@ read_incoming_link (struct context *c)
if (socket_connection_reset (c->c2.link_socket, status))
{
- /* received a disconnect from a connection-oriented protocol */
- if (c->options.inetd)
+#if PORT_SHARE
+ if (port_share && socket_foreign_protocol_detected (c->c2.link_socket))
{
+ const struct buffer *fbuf = socket_foreign_protocol_head (c->c2.link_socket);
+ const int sd = socket_foreign_protocol_sd (c->c2.link_socket);
+ port_share_redirect (port_share, fbuf, sd);
c->sig->signal_received = SIGTERM;
- msg (D_STREAM_ERRORS, "Connection reset, inetd/xinetd exit [%d]", status);
+ c->sig->signal_text = "port-share-redirect";
}
else
- {
- c->sig->signal_received = SIGUSR1; /* SOFT-SIGUSR1 -- TCP connection reset */
- msg (D_STREAM_ERRORS, "Connection reset, restarting [%d]", status);
- }
- c->sig->signal_text = "connection-reset";
+#endif
+ {
+ /* received a disconnect from a connection-oriented protocol */
+ if (c->options.inetd)
+ {
+ c->sig->signal_received = SIGTERM;
+ msg (D_STREAM_ERRORS, "Connection reset, inetd/xinetd exit [%d]", status);
+ }
+ else
+ {
+ c->sig->signal_received = SIGUSR1; /* SOFT-SIGUSR1 -- TCP connection reset */
+ msg (D_STREAM_ERRORS, "Connection reset, restarting [%d]", status);
+ }
+ c->sig->signal_text = "connection-reset";
+ }
perf_pop ();
return;
}