diff -Naur openvpn-2.1_alpha3/openvpn.8 openvpn-2.1_alpha3_patched/openvpn.8
--- openvpn-2.1_alpha3/openvpn.8	2005-06-12 19:25:48.000000000 +0100
+++ openvpn-2.1_alpha3_patched/openvpn.8	2005-08-09 10:14:11.771028000 +0100
@@ -187,6 +187,7 @@
 [\ \fB\-\-nice\fR\ \fIn\fR\ ]
 [\ \fB\-\-no\-iv\fR\ ]
 [\ \fB\-\-no\-replay\fR\ ]
+[\ \fB\-\-bind\fR\ ]
 [\ \fB\-\-nobind\fR\ ]
 [\ \fB\-\-ns\-cert\-type\fR\ \fIclient|server\fR\ ]
 [\ \fB\-\-passtos\fR\ ]
@@ -430,7 +431,7 @@
 .\"*********************************************************
 .TP
 .B --local host
-Local host name or IP address.
+Local host name or IP address for bind.
 If specified, OpenVPN will bind to this address only.
 If unspecified, OpenVPN will bind to all interfaces.
 .\"*********************************************************
@@ -701,13 +702,23 @@
 .\"*********************************************************
 .TP
 .B --lport port
-TCP/UDP port number for local.
+TCP/UDP port number for bind.
 .\"*********************************************************
 .TP
 .B --rport port
 TCP/UDP port number for remote.
 .\"*********************************************************
 .TP
+.B --bind
+Bind to local address and port. This is the default unless any of 
+.B --proto tcp-client
+,
+.B --http-proxy
+or
+.B --socks-proxy
+are used.
+.\"*********************************************************
+.TP
 .B --nobind
 Do not bind to local address and port.  The IP stack will allocate
 a dynamic port for returning packets.  Since the value of the dynamic port
diff -Naur openvpn-2.1_alpha3/options.c openvpn-2.1_alpha3_patched/options.c
--- openvpn-2.1_alpha3/options.c	2005-07-27 21:17:24.000000000 +0100
+++ openvpn-2.1_alpha3_patched/options.c	2005-08-09 10:14:11.807030000 +0100
@@ -99,7 +99,7 @@
   "--version       : Show copyright and version information.\n"
   "\n"
   "Tunnel Options:\n"
-  "--local host    : Local host name or ip address.\n"
+  "--local host    : Local host name or ip address. Implies --bind.\n"
   "--remote host [port] : Remote host name or ip address.\n"
   "--remote-random : If multiple --remote options specified, choose one randomly.\n"
   "--mode m        : Major mode, m = 'p2p' (default, point-to-point) or 'server'.\n"
@@ -139,8 +139,17 @@
   "--ipchange cmd  : Execute shell command cmd on remote ip address initial\n"
   "                  setting or change -- execute as: cmd ip-address port#\n"
   "--port port     : TCP/UDP port # for both local and remote.\n"
-  "--lport port    : TCP/UDP port # for local (default=%d).\n"
+  "--lport port    : TCP/UDP port # for local (default=%d). Implies --bind.\n"
   "--rport port    : TCP/UDP port # for remote (default=%d).\n"
+  "--bind          : Bind to local address and port. (This is the default unless\n"
+  "                  --proto tcp-client"
+#ifdef ENABLE_HTTP_PROXY
+                   " or --http-proxy"
+#endif
+#ifdef ENABLE_SOCKS
+                   " or --socks-proxy"
+#endif
+                   " is used).\n"
   "--nobind        : Do not bind to local address and port.\n"
   "--dev tunX|tapX : tun/tap device (X can be omitted for dynamic device.\n"
   "--dev-type dt   : Which device type are we using? (dt = tun or tap) Use\n"
@@ -673,6 +682,20 @@
 	  setenv_int (es, remote_port_string, o->remote_list->array[i].port);
 	}
     }
+#ifdef ENABLE_HTTP_PROXY
+    if (o->http_proxy_options)
+      {
+        setenv_str (es, "http_proxy_server", o->http_proxy_options->server);
+        setenv_int (es, "http_proxy_port", o->http_proxy_options->port);
+      }
+#endif
+#ifdef ENABLE_SOCKS
+    if(o->socks_proxy_server)
+      {
+        setenv_str (es, "socks_proxy_server", o->socks_proxy_server);
+        setenv_int (es, "socks_proxy_port", o->socks_proxy_port);
+      }
+#endif
 }
 
 static in_addr_t
@@ -998,6 +1021,7 @@
   SHOW_INT (remote_port);
   SHOW_BOOL (remote_float);
   SHOW_STR (ipchange);
+  SHOW_BOOL (bind_defined);
   SHOW_BOOL (bind_local);
   SHOW_STR (dev);
   SHOW_STR (dev_type);
@@ -1414,12 +1438,29 @@
   if (string_defined_equal (options->ifconfig_local, options->ifconfig_remote_netmask))
     msg (M_USAGE, "local and remote/netmask --ifconfig addresses must be different");
 
+  if (options->bind_defined && !options->bind_local)
+    msg (M_USAGE, "--bind and --nobind can't be used together");
+
+  if (options->local && !options->bind_local)
+    msg (M_USAGE, "--local and --nobind don't make sense when used together");
+
   if (options->local_port_defined && !options->bind_local)
     msg (M_USAGE, "--lport and --nobind don't make sense when used together");
 
   if (!options->remote_list && !options->bind_local)
     msg (M_USAGE, "--nobind doesn't make sense unless used with --remote");
 
+  if (options->proto == PROTO_TCPv4_CLIENT && !options->local && !options->local_port_defined && !options->bind_defined)
+    options->bind_local = false;
+
+#ifdef ENABLE_SOCKS
+  if (options->proto == PROTO_UDPv4 && options->socks_proxy_server && !options->local && !options->local_port_defined && !options->bind_defined)
+    options->bind_local = false;
+#endif
+
+  if (!options->bind_local)
+    options->local_port = 0;
+
   /*
    * Check for consistency of management options
    */
@@ -3323,6 +3364,11 @@
       options->port_option_used = true;
       options->remote_port = port;
     }
+  else if (streq (p[0], "bind"))
+    {
+      VERIFY_PERMISSION (OPT_P_GENERAL);
+      options->bind_defined = true;
+    }
   else if (streq (p[0], "nobind"))
     {
       VERIFY_PERMISSION (OPT_P_GENERAL);
diff -Naur openvpn-2.1_alpha3/options.h openvpn-2.1_alpha3_patched/options.h
--- openvpn-2.1_alpha3/options.h	2005-07-26 16:10:52.000000000 +0100
+++ openvpn-2.1_alpha3_patched/options.h	2005-08-09 10:14:11.822034000 +0100
@@ -120,6 +120,7 @@
   struct remote_list *remote_list;
   bool remote_random;
   const char *ipchange;
+  bool bind_defined;
   bool bind_local;
   const char *dev;
   const char *dev_type;
diff -Naur openvpn-2.1_alpha3/socket.c openvpn-2.1_alpha3_patched/socket.c
--- openvpn-2.1_alpha3/socket.c	2005-07-25 03:38:38.000000000 +0100
+++ openvpn-2.1_alpha3_patched/socket.c	2005-08-09 10:35:49.048864000 +0100
@@ -704,7 +704,26 @@
 }
 
 static void
+socket_bind (socket_descriptor_t sd,
+             struct openvpn_sockaddr *local)
+{
+  struct gc_arena gc = gc_new ();
+
+  if (bind (sd, (struct sockaddr *) local,
+                sizeof (struct openvpn_sockaddr)))
+    {
+      const int errnum = openvpn_errno_socket ();
+      msg (M_FATAL, "TCP/UDP: Socket bind failed on local address %s: %s",
+           print_sockaddr (local, &gc),
+           strerror_ts (errnum, &gc));
+    }
+  gc_free (&gc);
+}
+
+static void
 socket_connect (socket_descriptor_t *sd,
+                struct openvpn_sockaddr *local,
+                bool bind_local,
 		struct openvpn_sockaddr *remote,
 		struct remote_list *remote_list,
 		const char *remote_dynamic,
@@ -747,6 +766,8 @@
 	}
 
       *sd = create_socket_tcp ();
+      if (bind_local)
+        socket_bind (*sd, local);
       update_remote (remote_dynamic, remote, remote_changed);
       break;
 default:
@@ -858,13 +879,13 @@
   /* bind to local address/port */
   if (sock->bind_local)
     {
-      if (bind (sock->sd,  &sock->info.lsa->local.addr.sa, addrlen))
-	{
-	  const int errnum = openvpn_errno_socket ();
-	  msg (M_FATAL, "TCP/UDP: Socket bind failed on local address %s: %s",
-	       print_sockaddr (&sock->info.lsa->local, &gc),
-	       strerror_ts (errnum, &gc));
-	}
+#ifdef ENABLE_SOCKS
+      if (sock->socks_proxy && sock->info.proto == PROTO_UDPv4)
+          socket_bind (sock->ctrl_sd, &sock->info.lsa->local);
+      else
+#endif
+          socket_bind (sock->sd, &sock->info.lsa->local);
+
     }
   gc_free (&gc);
 }
@@ -1163,10 +1184,6 @@
       else
 	sock->bind_local = true;
     }
-  else if (sock->info.proto == PROTO_TCPv4_CLIENT)
-    {
-      sock->bind_local = false;
-    }
 
   /* were we started by inetd or xinetd? */
   if (sock->inetd)
@@ -1269,6 +1286,8 @@
       else if (sock->info.proto == PROTO_TCPv4_CLIENT || sock->info.proto == PROTO_TCPv6_CLIENT)
 	{
 	  socket_connect (&sock->sd,
+                          &sock->info.lsa->local,
+                          sock->bind_local,
 			  &sock->info.lsa->actual,
 			  sock->remote_list,
 			  remote_dynamic,
@@ -1307,6 +1326,8 @@
       else if (sock->info.proto == PROTO_UDPv4 && sock->socks_proxy)
 	{
 	  socket_connect (&sock->ctrl_sd,
+                          &sock->info.lsa->local,
+                          sock->bind_local,
 			  &sock->info.lsa->actual,
 			  NULL,
 			  remote_dynamic,
