]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix server routes not working in topology subnet with --server [v3]
authorArne Schwabe <arne@rfc2549.org>
Sun, 13 Jul 2014 12:28:47 +0000 (14:28 +0200)
committerGert Doering <gert@greenie.muc.de>
Sun, 13 Jul 2014 13:55:33 +0000 (15:55 +0200)
The IPv4 routing code needs an IPv4 address to point a route to, and
in --topology subnet mode, the *server* did not have one set by default.

So we now just default --route-gateway to the next address right after
the server address - the specific address doesn't matter, as the correct
next-hop will not be resolved by the host OS but by the OpenVPN daemon.
All that is needed is "it's in the subnet routed to the tun interface".

Using the server address itself would work on unix, but doesn't work with
the Windows TAP driver (as it does not spoof ARP responses for itself).

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1405254527-23833-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8904
(cherry picked from commit 4cc6a2595947a0e2f13b37637899bfc50f8509aa)

doc/openvpn.8
src/openvpn/helper.c

index 64247a48013c0c0fff5c2166d57b87a471c413ae..39b128ff2aa2fd0b06470486001739f6b2ebf034 100644 (file)
@@ -2660,7 +2660,7 @@ on sufficiently fast hardware.  SSL/TLS authentication must
 be used in this mode.
 .\"*********************************************************
 .TP
-.B \-\-server network netmask
+.B \-\-server network netmask ['nopool']
 A helper directive designed to simplify the configuration
 of OpenVPN's server mode.  This directive will set up an
 OpenVPN server which will allocate addresses to clients
@@ -2695,6 +2695,9 @@ expands as follows:
    if !nopool:
      ifconfig-pool 10.8.0.2 10.8.0.254 255.255.255.0
    push "route-gateway 10.8.0.1"
+   if route-gateway unset:
+     route-gateway 10.8.0.2
+
 .in -4
 .ft
 .fi
index d9eef03bf45153ca6ead3d3fc95e520a9be73d65..0ed0b2ba189b3572053a89a90b60c6f8fd4662b3 100644 (file)
@@ -232,6 +232,8 @@ helper_client_server (struct options *o)
    *   if !nopool: 
    *     ifconfig-pool 10.8.0.2 10.8.0.254 255.255.255.0
    *   push "route-gateway 10.8.0.1"
+   *   if route-gateway unset:
+   *     route-gateway 10.8.0.2
    */
 
   if (o->server_defined)
@@ -311,8 +313,10 @@ helper_client_server (struct options *o)
                  ifconfig_pool_verify_range (M_USAGE, o->ifconfig_pool_start, o->ifconfig_pool_end);
                }
              o->ifconfig_pool_netmask = o->server_netmask;
-                 
+
              push_option (o, print_opt_route_gateway (o->server_network + 1, &o->gc), M_USAGE);
+             if (!o->route_default_gateway)
+               o->route_default_gateway = print_in_addr_t (o->server_network + 2, 0, &o->gc);
            }
          else
            ASSERT (0);