``persist-key`` option has been enabled by default.
All the keys will be kept in memory across restart.
-Default for ``--topology`` changed to ``subnet``
- Previous releases used ``net30`` as default. This only affects
- configs with ``--dev tun`` and only IPv4. Note that this
- changes the semantics of ``--ifconfig``, so if you have manual
- settings for that in your config but not set ``--topology``
+Default for ``--topology`` changed to ``subnet`` for ``--mode server``
+ Previous releases always used ``net30`` as default. This only affects
+ configs with ``--mode server`` or ``--server`` (the latter implies the
+ former), and ``--dev tun``, and only if IPv4 is enabled.
+ Note that this changes the semantics of ``--ifconfig``, so if you have
+ manual settings for that in your config but not set ``--topology``
your config might fail to parse with the new version. Just adding
``--topology net30`` to the config should fix the problem.
By default ``--topology`` is pushed from server to client.
}
+/**
+ * Set --topology default depending on --mode
+ */
+void
+helper_setdefault_topology(struct options *o)
+{
+ if (o->topology != TOP_UNDEF)
+ {
+ return;
+ }
+ int dev = dev_type_enum(o->dev, o->dev_type);
+ if (dev != DEV_TYPE_TUN)
+ {
+ return;
+ }
+ if (o->mode == MODE_SERVER)
+ {
+ o->topology = TOP_SUBNET;
+ }
+ else
+ {
+ o->topology = TOP_NET30;
+ }
+}
+
+
/*
* Process server, server-bridge, and client helper
* directives after the parameters themselves have been
* Get tun/tap/null device type
*/
const int dev = dev_type_enum(o->dev, o->dev_type);
- const int topology = o->topology;
/*
*
if (o->server_flags & SF_NOPOOL)
{
- msg( M_USAGE, "--server-ipv6 is incompatible with 'nopool' option" );
+ msg(M_USAGE, "--server-ipv6 is incompatible with 'nopool' option");
}
if (o->ifconfig_ipv6_pool_defined)
{
- msg( M_USAGE, "--server-ipv6 already defines an ifconfig-ipv6-pool, so you can't also specify --ifconfig-pool explicitly");
+ msg(M_USAGE, "--server-ipv6 already defines an ifconfig-ipv6-pool, so you can't also specify --ifconfig-pool explicitly");
}
o->mode = MODE_SERVER;
o->server_netbits_ipv6 < 112 ? 0x1000 : 2);
o->ifconfig_ipv6_pool_netbits = o->server_netbits_ipv6;
- push_option( o, "tun-ipv6", M_USAGE );
+ push_option(o, "tun-ipv6", M_USAGE);
}
/*
o->mode = MODE_SERVER;
o->tls_server = true;
+ /* Need to know topology now */
+ helper_setdefault_topology(o);
- if (topology == TOP_NET30 || topology == TOP_P2P)
+ if (o->topology == TOP_NET30 || o->topology == TOP_P2P)
{
o->ifconfig_local = print_in_addr_t(o->server_network + 1, 0, &o->gc);
o->ifconfig_remote_netmask = print_in_addr_t(o->server_network + 2, 0, &o->gc);
{
push_option(o, print_opt_route(o->server_network, o->server_netmask, &o->gc), M_USAGE);
}
- else if (topology == TOP_NET30)
+ else if (o->topology == TOP_NET30)
{
push_option(o, print_opt_route(o->server_network + 1, 0, &o->gc), M_USAGE);
}
}
- else if (topology == TOP_SUBNET)
+ else if (o->topology == TOP_SUBNET)
{
o->ifconfig_local = print_in_addr_t(o->server_network + 1, 0, &o->gc);
o->ifconfig_remote_netmask = print_in_addr_t(o->server_netmask, 0, &o->gc);
ASSERT(0);
}
- push_option(o, print_opt_topology(topology, &o->gc), M_USAGE);
+ push_option(o, print_opt_topology(o->topology, &o->gc), M_USAGE);
- if (topology == TOP_NET30 && !(o->server_flags & SF_NOPOOL))
+ if (o->topology == TOP_NET30 && !(o->server_flags & SF_NOPOOL))
{
msg(M_WARN, "WARNING: --topology net30 support for server "
"configs with IPv4 pools will be removed in a future "
}
/* set push-ifconfig-constraint directive */
- if ((dev == DEV_TYPE_TAP || topology == TOP_SUBNET))
+ if ((dev == DEV_TYPE_TAP || o->topology == TOP_SUBNET))
{
o->push_ifconfig_constraint_defined = true;
o->push_ifconfig_constraint_network = o->server_network;