From 03731db31bfb22fcd0f169c692757826638dcc57 Mon Sep 17 00:00:00 2001 From: james Date: Sat, 2 Aug 2008 08:02:53 +0000 Subject: Added "--server-bridge" (without parameters) to enable DHCP proxy mode: Configure server mode for ethernet bridging using a DHCP-proxy, where clients talk to the OpenVPN server-side DHCP server to receive their IP address allocation and DNS server addresses. Added "--route-gateway dhcp", to enable the extraction of the gateway address from a DHCP negotiation with the OpenVPN server-side LAN. Modified client.conf and server.conf to reflect new option modes. Incremented version to 2.1_rc9a. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3164 e7ae566f-a301-0410-adde-c780ea21d3b5 --- options.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'options.c') diff --git a/options.c b/options.c index 68a36c2..ccbbffa 100644 --- a/options.c +++ b/options.c @@ -169,7 +169,7 @@ static const char usage_message[] = " netmask default: 255.255.255.255\n" " gateway default: taken from --route-gateway or --ifconfig\n" " Specify default by leaving blank or setting to \"nil\".\n" - "--route-gateway gw : Specify a default gateway for use with --route.\n" + "--route-gateway gw|'dhcp' : Specify a default gateway for use with --route.\n" "--route-metric m : Specify a default metric for use with --route.\n" "--route-delay n [w] : Delay n seconds after connection initiation before\n" " adding routes (may be 0). If not specified, routes will\n" @@ -339,7 +339,7 @@ static const char usage_message[] = "\n" "Multi-Client Server options (when --mode server is used):\n" "--server network netmask : Helper option to easily configure server mode.\n" - "--server-bridge IP netmask pool-start-IP pool-end-IP : Helper option to\n" + "--server-bridge [IP netmask pool-start-IP pool-end-IP] : Helper option to\n" " easily configure ethernet bridging server mode.\n" "--push \"option\" : Push a config file option back to the peer for remote\n" " execution. Peer must specify --pull in its config file.\n" @@ -1226,6 +1226,7 @@ show_settings (const struct options *o) SHOW_INT (route_delay_window); SHOW_BOOL (route_delay_defined); SHOW_BOOL (route_nopull); + SHOW_BOOL (route_gateway_via_dhcp); if (o->routes) print_route_options (o->routes, D_SHOW_PARMS); @@ -1888,7 +1889,7 @@ static void options_postprocess_mutate_ce (struct options *o, struct connection_entry *ce) { #if P2MP_SERVER - if (o->server_defined || o->server_bridge_defined) + if (o->server_defined || o->server_bridge_defined || o->server_bridge_proxy_dhcp) { if (ce->proto == PROTO_TCPv4) ce->proto = PROTO_TCPv4_SERVER; @@ -4237,14 +4238,21 @@ add_option (struct options *options, else if (streq (p[0], "route-gateway") && p[1]) { VERIFY_PERMISSION (OPT_P_ROUTE_EXTRAS); - if (ip_addr_dotted_quad_safe (p[1]) || is_special_addr (p[1])) + if (streq (p[1], "dhcp")) { - options->route_default_gateway = p[1]; + options->route_gateway_via_dhcp = true; } else { - msg (msglevel, "route-gateway parm '%s' must be an IP address", p[1]); - goto err; + if (ip_addr_dotted_quad_safe (p[1]) || is_special_addr (p[1])) + { + options->route_default_gateway = p[1]; + } + else + { + msg (msglevel, "route-gateway parm '%s' must be an IP address", p[1]); + goto err; + } } } else if (streq (p[0], "route-metric") && p[1]) @@ -4395,6 +4403,11 @@ add_option (struct options *options, options->server_bridge_pool_start = pool_start; options->server_bridge_pool_end = pool_end; } + else if (streq (p[0], "server-bridge") && !p[1]) + { + VERIFY_PERMISSION (OPT_P_GENERAL); + options->server_bridge_proxy_dhcp = true; + } else if (streq (p[0], "push") && p[1]) { VERIFY_PERMISSION (OPT_P_PUSH); -- cgit v1.2.3