aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Sommerseth2020-02-27 21:54:43 +0100
committerGert Doering2020-05-07 21:53:22 +0200
commit042429d3454ca57564e932a727a27c7d6bfeb2d6 (patch)
treea230f14a76ddf4b2b387c56fde82dddfbad78386 /src
parentcb2e9218f2bc73fa22da1f6e850e5fe97f689730 (diff)
downloadopenvpn-042429d3454ca57564e932a727a27c7d6bfeb2d6.zip
openvpn-042429d3454ca57564e932a727a27c7d6bfeb2d6.tar.gz
build: Remove --disable-server from ./configure
After some discussion among the core community developers [1,2], it was decided to remove the possibility to build openvpn as a pure client. This was alterted on the mailing list [3] that it was scheduled for removal unless anyone had strong arguments why it was needed. The general consensus was that we had not received any strong arguments to keep this possibility after approximately 5 months, so it was fine to remove this ./configure option. By removing this, we remove quite some entangled sections of #ifdef scattered all over the code base, making it more readable. One note: Inside the options_postprocess_mutate_invariant() function, the #ifdef P2MP_SERVER and #ifdef _WIN32 blocks where slightly reworked to make the _WIN32 block more continous and avoiding having an empty if(options->mode == MODE_SERVER) block. Signed-off-by: David Sommerseth <davids@openvpn.net> [1] https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg18830.h tml [2] https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19505.h tml [3] https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg18829.h tml Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <20200227205443.27562-1-davids@openvpn.net> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19506.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src')
-rw-r--r--src/openvpn/forward.c5
-rw-r--r--src/openvpn/helper.c8
-rw-r--r--src/openvpn/init.c14
-rw-r--r--src/openvpn/list.c8
-rw-r--r--src/openvpn/list.h3
-rw-r--r--src/openvpn/misc.c3
-rw-r--r--src/openvpn/misc.h3
-rw-r--r--src/openvpn/mroute.c8
-rw-r--r--src/openvpn/mroute.h3
-rw-r--r--src/openvpn/mtcp.c4
-rw-r--r--src/openvpn/mtcp.h3
-rw-r--r--src/openvpn/mudp.c3
-rw-r--r--src/openvpn/mudp.h5
-rw-r--r--src/openvpn/multi.c9
-rw-r--r--src/openvpn/multi.h3
-rw-r--r--src/openvpn/openvpn.c2
-rw-r--r--src/openvpn/openvpn.h5
-rw-r--r--src/openvpn/options.c32
-rw-r--r--src/openvpn/options.h4
-rw-r--r--src/openvpn/push.c19
-rw-r--r--src/openvpn/push.h2
-rw-r--r--src/openvpn/pushlist.h5
-rw-r--r--src/openvpn/schedule.c3
-rw-r--r--src/openvpn/schedule.h3
-rw-r--r--src/openvpn/ssl.c4
-rw-r--r--src/openvpn/ssl_common.h4
-rw-r--r--src/openvpn/ssl_mbedtls.c2
-rw-r--r--src/openvpn/ssl_openssl.c2
-rw-r--r--src/openvpn/ssl_verify.c2
-rw-r--r--src/openvpn/ssl_verify.h3
-rw-r--r--src/openvpn/syshead.h16
-rw-r--r--src/openvpn/vlan.c4
-rw-r--r--src/openvpn/vlan.h4
33 files changed, 13 insertions, 185 deletions
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 2082b9e..fd08f12 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -682,7 +682,6 @@ encrypt_sign(struct context *c, bool comp_frag)
const uint8_t *orig_buf = c->c2.buf.data;
struct crypto_options *co = NULL;
-#if P2MP_SERVER
/*
* Drop non-TLS outgoing packet if client-connect script/plugin
* has not yet succeeded.
@@ -691,7 +690,6 @@ encrypt_sign(struct context *c, bool comp_frag)
{
c->c2.buf.len = 0;
}
-#endif
if (comp_frag)
{
@@ -1111,7 +1109,7 @@ process_incoming_link_part1(struct context *c, struct link_socket_info *lsi, boo
{
co = &c->c2.crypto_options;
}
-#if P2MP_SERVER
+
/*
* Drop non-TLS packet if client-connect script/plugin has not
* yet succeeded.
@@ -1120,7 +1118,6 @@ process_incoming_link_part1(struct context *c, struct link_socket_info *lsi, boo
{
c->c2.buf.len = 0;
}
-#endif
/* authenticate and decrypt the incoming packet */
decrypt_status = openvpn_decrypt(&c->c2.buf, c->c2.buffers->decrypt_buf,
diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c
index ff9df50..34cfa6b 100644
--- a/src/openvpn/helper.c
+++ b/src/openvpn/helper.c
@@ -36,7 +36,6 @@
#include "memdbg.h"
-#if P2MP_SERVER
static const char *
print_netmask(int netbits, struct gc_arena *gc)
@@ -139,7 +138,6 @@ verify_common_subnet(const char *opt, const in_addr_t a, const in_addr_t b, cons
gc_free(&gc);
}
-#endif /* if P2MP_SERVER */
/*
* Process server, server-bridge, and client helper
@@ -152,7 +150,6 @@ helper_client_server(struct options *o)
struct gc_arena gc = gc_new();
#if P2MP
-#if P2MP_SERVER
/*
* Get tun/tap/null device type
@@ -464,7 +461,6 @@ helper_client_server(struct options *o)
}
}
else
-#endif /* P2MP_SERVER */
/*
* HELPER DIRECTIVE:
@@ -541,7 +537,6 @@ helper_keepalive(struct options *o)
o->ping_send_timeout = o->keepalive_ping;
o->ping_rec_timeout = o->keepalive_timeout;
}
-#if P2MP_SERVER
else if (o->mode == MODE_SERVER)
{
o->ping_rec_timeout_action = PING_RESTART;
@@ -550,7 +545,6 @@ helper_keepalive(struct options *o)
push_option(o, print_str_int("ping", o->keepalive_ping, &o->gc), M_USAGE);
push_option(o, print_str_int("ping-restart", o->keepalive_timeout, &o->gc), M_USAGE);
}
-#endif
else
{
ASSERT(0);
@@ -573,7 +567,6 @@ helper_keepalive(struct options *o)
void
helper_tcp_nodelay(struct options *o)
{
-#if P2MP_SERVER
if (o->server_flags & SF_TCP_NODELAY_HELPER)
{
if (o->mode == MODE_SERVER)
@@ -586,5 +579,4 @@ helper_tcp_nodelay(struct options *o)
o->sockflags |= SF_TCP_NODELAY;
}
}
-#endif
}
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 10aad9f..f82faf3 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -2658,7 +2658,6 @@ do_init_tls_wrap_key(struct context *c)
}
-#if P2MP_SERVER
/*
* Initialise the auth-token key context
*/
@@ -2674,7 +2673,6 @@ do_init_auth_token_key(struct context *c)
c->options.auth_token_secret_file,
c->options.auth_token_secret_file_inline);
}
-#endif
/*
* Initialize the persistent component of OpenVPN's TLS mode,
@@ -2728,10 +2726,8 @@ do_init_crypto_tls_c1(struct context *c)
/* initialize tls-auth/crypt/crypt-v2 key */
do_init_tls_wrap_key(c);
-#if P2MP_SERVER
/* initialise auth-token crypto support */
do_init_auth_token_key(c);
-#endif
#if 0 /* was: #if ENABLE_INLINE_FILES -- Note that enabling this code will break restarts */
if (options->priv_key_file_inline)
@@ -2895,7 +2891,6 @@ do_init_crypto_tls(struct context *c, const unsigned int flags)
to.mda_context = &c->c2.mda_context;
#endif
-#if P2MP_SERVER
to.auth_user_pass_verify_script = options->auth_user_pass_verify_script;
to.auth_user_pass_verify_script_via_file = options->auth_user_pass_verify_script_via_file;
to.tmp_dir = options->tmp_dir;
@@ -2908,7 +2903,6 @@ do_init_crypto_tls(struct context *c, const unsigned int flags)
to.auth_token_lifetime = options->auth_token_lifetime;
to.auth_token_call_auth = options->auth_token_call_auth;
to.auth_token_key = c->c1.ks.auth_token_key;
-#endif
to.x509_track = options->x509_track;
@@ -3218,7 +3212,6 @@ do_option_warnings(struct context *c)
msg(M_WARN, "WARNING: using --pull/--client and --ifconfig together is probably not what you want");
}
-#if P2MP_SERVER
if (o->server_bridge_defined | o->server_bridge_proxy_dhcp)
{
msg(M_WARN, "NOTE: when bridging your LAN adapter with the TAP adapter, note that the new bridge adapter will often take on its own IP address that is different from what the LAN adapter was previously set to");
@@ -3239,7 +3232,6 @@ do_option_warnings(struct context *c)
msg(M_WARN, "WARNING: --keepalive option is missing from server config");
}
}
-#endif /* if P2MP_SERVER */
#endif /* if P2MP */
if (!o->replay)
@@ -3735,20 +3727,17 @@ do_close_status_output(struct context *c)
static void
do_open_ifconfig_pool_persist(struct context *c)
{
-#if P2MP_SERVER
if (!c->c1.ifconfig_pool_persist && c->options.ifconfig_pool_persist_filename)
{
c->c1.ifconfig_pool_persist = ifconfig_pool_persist_init(c->options.ifconfig_pool_persist_filename,
c->options.ifconfig_pool_persist_refresh_freq);
c->c1.ifconfig_pool_persist_owned = true;
}
-#endif
}
static void
do_close_ifconfig_pool_persist(struct context *c)
{
-#if P2MP_SERVER
if (!(c->sig->signal_received == SIGUSR1))
{
if (c->c1.ifconfig_pool_persist && c->c1.ifconfig_pool_persist_owned)
@@ -3758,7 +3747,6 @@ do_close_ifconfig_pool_persist(struct context *c)
c->c1.ifconfig_pool_persist_owned = false;
}
}
-#endif
}
/*
@@ -4604,9 +4592,7 @@ inherit_context_top(struct context *dest,
/* detach c1 ownership */
dest->c1.tuntap_owned = false;
dest->c1.status_output_owned = false;
-#if P2MP_SERVER
dest->c1.ifconfig_pool_persist_owned = false;
-#endif
/* detach c2 ownership */
dest->c2.event_set_owned = false;
diff --git a/src/openvpn/list.c b/src/openvpn/list.c
index 6023ea6..549ebdf 100644
--- a/src/openvpn/list.c
+++ b/src/openvpn/list.c
@@ -29,7 +29,6 @@
#include "syshead.h"
-#if P2MP_SERVER
#include "integer.h"
#include "list.h"
@@ -656,10 +655,3 @@ hash_func(const uint8_t *k, uint32_t length, uint32_t initval)
/*-------------------------------------- report the result */
return c;
}
-
-#else /* if P2MP_SERVER */
-static void
-dummy(void)
-{
-}
-#endif /* P2MP_SERVER */
diff --git a/src/openvpn/list.h b/src/openvpn/list.h
index 6177157..c381acd 100644
--- a/src/openvpn/list.h
+++ b/src/openvpn/list.h
@@ -33,8 +33,6 @@
* client instances over various key spaces.
*/
-#if P2MP_SERVER
-
/* define this to enable special list test mode */
/*#define LIST_TEST*/
@@ -194,5 +192,4 @@ hash_remove(struct hash *hash, const void *key)
return ret;
}
-#endif /* P2MP_SERVER */
#endif /* LIST */
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index b4eff3b..1038b38 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -700,8 +700,6 @@ sanitize_control_message(const char *src, struct gc_arena *gc)
return ret;
}
-#if P2MP_SERVER
-
/* helper to parse peer_info received from multi client, validate
* (this is untrusted data) and put into environment
*/
@@ -784,4 +782,3 @@ get_num_elements(const char *string, char delimiter)
return element_count;
}
-#endif /* P2MP_SERVER */
diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
index a3095c1..a03d94e 100644
--- a/src/openvpn/misc.h
+++ b/src/openvpn/misc.h
@@ -167,15 +167,12 @@ const char *sanitize_control_message(const char *str, struct gc_arena *gc);
extern const char *iproute_path;
#endif
-#if P2MP_SERVER
/* helper to parse peer_info received from multi client, validate
* (this is untrusted data) and put into environment */
bool validate_peer_info_line(char *line);
void output_peer_info_env(struct env_set *es, const char *peer_info);
-#endif /* P2MP_SERVER */
-
/**
* Returns the occurrences of 'delimiter' in a string +1
* This is typically used to find out the number elements in a
diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c
index a7e7821..793c7e3 100644
--- a/src/openvpn/mroute.c
+++ b/src/openvpn/mroute.c
@@ -29,7 +29,6 @@
#include "syshead.h"
-#if P2MP_SERVER
#include "mroute.h"
#include "proto.h"
@@ -614,10 +613,3 @@ mroute_helper_free(struct mroute_helper *mh)
{
free(mh);
}
-
-#else /* if P2MP_SERVER */
-static void
-dummy(void)
-{
-}
-#endif /* P2MP_SERVER */
diff --git a/src/openvpn/mroute.h b/src/openvpn/mroute.h
index 113aa8c..c94b132 100644
--- a/src/openvpn/mroute.h
+++ b/src/openvpn/mroute.h
@@ -24,8 +24,6 @@
#ifndef MROUTE_H
#define MROUTE_H
-#if P2MP_SERVER
-
#include "buffer.h"
#include "list.h"
#include "route.h"
@@ -270,5 +268,4 @@ mroute_addr_reset(struct mroute_addr *ma)
ma->type = MR_ADDR_NONE;
}
-#endif /* P2MP_SERVER */
#endif /* MROUTE_H */
diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c
index ee28a71..458e6e4 100644
--- a/src/openvpn/mtcp.c
+++ b/src/openvpn/mtcp.c
@@ -29,8 +29,6 @@
#include "syshead.h"
-#if P2MP_SERVER
-
#include "multi.h"
#include "forward.h"
@@ -861,5 +859,3 @@ tunnel_server_tcp(struct context *top)
multi_top_free(&multi);
close_instance(top);
}
-
-#endif /* if P2MP_SERVER */
diff --git a/src/openvpn/mtcp.h b/src/openvpn/mtcp.h
index bba455b..680ab10 100644
--- a/src/openvpn/mtcp.h
+++ b/src/openvpn/mtcp.h
@@ -28,8 +28,6 @@
#ifndef MTCP_H
#define MTCP_H
-#if P2MP_SERVER
-
#include "event.h"
/*
@@ -75,5 +73,4 @@ void tunnel_server_tcp(struct context *top);
void multi_tcp_delete_event(struct multi_tcp *mtcp, event_t event);
-#endif /* if P2MP_SERVER */
#endif /* ifndef MTCP_H */
diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c
index 6a29ccc..e95a7ac 100644
--- a/src/openvpn/mudp.c
+++ b/src/openvpn/mudp.c
@@ -29,8 +29,6 @@
#include "syshead.h"
-#if P2MP_SERVER
-
#include "multi.h"
#include <inttypes.h>
#include "forward.h"
@@ -384,4 +382,3 @@ tunnel_server_udp(struct context *top)
tunnel_server_udp_single_threaded(top);
}
-#endif /* if P2MP_SERVER */
diff --git a/src/openvpn/mudp.h b/src/openvpn/mudp.h
index 7e31151..460a768 100644
--- a/src/openvpn/mudp.h
+++ b/src/openvpn/mudp.h
@@ -28,8 +28,6 @@
#ifndef MUDP_H
#define MUDP_H
-#if P2MP_SERVER
-
struct context;
struct multi_context;
@@ -66,5 +64,4 @@ void tunnel_server_udp(struct context *top);
*/
struct multi_instance *multi_get_create_instance_udp(struct multi_context *m, bool *floated);
-#endif
-#endif
+#endif /* ifndef MUDP_H */
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 056e3dc..7f61350 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -34,8 +34,6 @@
#include "syshead.h"
-#if P2MP_SERVER
-
#include "forward.h"
#include "multi.h"
#include "push.h"
@@ -3446,10 +3444,3 @@ tunnel_server(struct context *top)
tunnel_server_tcp(top);
}
}
-
-#else /* if P2MP_SERVER */
-static void
-dummy(void)
-{
-}
-#endif /* P2MP_SERVER */
diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h
index cfd86bb..3d949e3 100644
--- a/src/openvpn/multi.h
+++ b/src/openvpn/multi.h
@@ -28,8 +28,6 @@
#ifndef MULTI_H
#define MULTI_H
-#if P2MP_SERVER
-
#include "init.h"
#include "forward.h"
#include "mroute.h"
@@ -652,5 +650,4 @@ multi_set_pending(struct multi_context *m, struct multi_instance *mi)
m->pending = mi;
}
-#endif /* P2MP_SERVER */
#endif /* MULTI_H */
diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c
index a58d507..dc7001d 100644
--- a/src/openvpn/openvpn.c
+++ b/src/openvpn/openvpn.c
@@ -305,12 +305,10 @@ openvpn_main(int argc, char *argv[])
tunnel_point_to_point(&c);
break;
-#if P2MP_SERVER
case MODE_SERVER:
tunnel_server(&c);
break;
-#endif
default:
ASSERT(0);
}
diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h
index 595a9b1..1afc3a9 100644
--- a/src/openvpn/openvpn.h
+++ b/src/openvpn/openvpn.h
@@ -190,12 +190,9 @@ struct context_1
bool socks_proxy_owned;
#if P2MP
-
-#if P2MP_SERVER
/* persist --ifconfig-pool db to file */
struct ifconfig_pool_persist *ifconfig_pool_persist;
bool ifconfig_pool_persist_owned;
-#endif
/* if client mode, hash of option strings we pulled from server */
struct sha256_digest pulled_options_digest_save;
@@ -434,7 +431,6 @@ struct context_2
#if P2MP
-#if P2MP_SERVER
/* --ifconfig endpoints to be pushed to client */
bool push_reply_deferred;
#ifdef ENABLE_ASYNC_PUSH
@@ -458,7 +454,6 @@ struct context_2
#define CAS_PARTIAL 3 /* at least one client-connect script/plugin
* succeeded while a later one in the chain failed */
int context_auth;
-#endif /* if P2MP_SERVER */
struct event_timeout push_request_interval;
int n_sent_push_requests;
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index b83b504..611652f 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -410,7 +410,6 @@ static const char usage_message[] =
"--vlan-accept tagged|untagged|all : Set VLAN tagging mode. Default is 'all'.\n"
"--vlan-pvid v : Sets the Port VLAN Identifier. Defaults to 1.\n"
#if P2MP
-#if P2MP_SERVER
"\n"
"Multi-Client Server options (when --mode server is used):\n"
"--server network netmask : Helper option to easily configure server mode.\n"
@@ -495,7 +494,6 @@ static const char usage_message[] =
" sessions to a web server at host:port. dir specifies an\n"
" optional directory to write origin IP:port data.\n"
#endif
-#endif /* if P2MP_SERVER */
"\n"
"Client options (when connecting to a multi-client server):\n"
"--client : Helper option to easily configure client mode.\n"
@@ -859,7 +857,6 @@ init_options(struct options *o, const bool init_gc)
#endif
o->vlan_accept = VLAN_ALL;
o->vlan_pvid = 1;
-#if P2MP_SERVER
o->real_hash_size = 256;
o->virtual_hash_size = 256;
o->n_bcast_buf = 256;
@@ -868,7 +865,6 @@ init_options(struct options *o, const bool init_gc)
o->max_routes_per_client = 256;
o->stale_routes_check_interval = 0;
o->ifconfig_pool_persist_refresh_freq = 600;
-#endif
#if P2MP
o->scheduled_exit_interval = 5;
#endif
@@ -906,7 +902,6 @@ init_options(struct options *o, const bool init_gc)
#endif /* ENABLE_PKCS11 */
/* P2MP server context features */
-#if P2MP_SERVER
o->auth_token_generate = false;
/* Set default --tmp-dir */
@@ -921,7 +916,6 @@ init_options(struct options *o, const bool init_gc)
o->tmp_dir = "/tmp";
}
#endif /* _WIN32 */
-#endif /* P2MP_SERVER */
o->allow_recursive_routing = false;
}
@@ -1260,7 +1254,6 @@ show_p2mp_parms(const struct options *o)
{
struct gc_arena gc = gc_new();
-#if P2MP_SERVER
msg(D_SHOW_PARMS, " server_network = %s", print_in_addr_t(o->server_network, 0, &gc));
msg(D_SHOW_PARMS, " server_netmask = %s", print_in_addr_t(o->server_netmask, 0, &gc));
msg(D_SHOW_PARMS, " server_network_ipv6 = %s", print_in6_addr(o->server_network_ipv6, 0, &gc) );
@@ -1324,7 +1317,6 @@ show_p2mp_parms(const struct options *o)
SHOW_BOOL(vlan_tagging);
msg(D_SHOW_PARMS, " vlan_accept = %s", print_vlan_accept(o->vlan_accept));
SHOW_INT(vlan_pvid);
-#endif /* P2MP_SERVER */
SHOW_BOOL(client);
SHOW_BOOL(pull);
@@ -1335,8 +1327,6 @@ show_p2mp_parms(const struct options *o)
#endif /* ! ENABLE_SMALL */
-#if P2MP_SERVER
-
static void
option_iroute(struct options *o,
const char *network_str,
@@ -1384,7 +1374,6 @@ option_iroute_ipv6(struct options *o,
ir->next = o->iroutes_ipv6;
o->iroutes_ipv6 = ir;
}
-#endif /* P2MP_SERVER */
#endif /* P2MP */
#ifndef ENABLE_SMALL
@@ -1422,9 +1411,7 @@ options_detach(struct options *o)
gc_detach(&o->gc);
o->routes = NULL;
o->client_nat = NULL;
-#if P2MP_SERVER
clone_push_list(o);
-#endif
}
void
@@ -2261,8 +2248,6 @@ options_postprocess_verify_ce(const struct options *options, const struct connec
msg(M_USAGE, "TCP server mode allows at most one --remote address");
}
-#if P2MP_SERVER
-
/*
* Check consistency of --mode server options.
*/
@@ -2516,7 +2501,6 @@ options_postprocess_verify_ce(const struct options *options, const struct connec
msg(M_USAGE, "--vlan-tagging requires --mode server");
}
}
-#endif /* P2MP_SERVER */
if (options->keysize)
{
@@ -2830,7 +2814,6 @@ options_postprocess_mutate_ce(struct options *o, struct connection_entry *ce)
{
const int dev = dev_type_enum(o->dev, o->dev_type);
-#if P2MP_SERVER
if (o->server_defined || o->server_bridge_defined || o->server_bridge_proxy_dhcp)
{
if (ce->proto == PROTO_TCP)
@@ -2838,7 +2821,7 @@ options_postprocess_mutate_ce(struct options *o, struct connection_entry *ce)
ce->proto = PROTO_TCP_SERVER;
}
}
-#endif
+
#if P2MP
if (o->client)
{
@@ -3028,15 +3011,12 @@ options_postprocess_mutate_invariant(struct options *options)
}
remap_redirect_gateway_flags(options);
-#endif /* ifdef _WIN32 */
-#if P2MP_SERVER
/*
* Check consistency of --mode server options.
*/
if (options->mode == MODE_SERVER)
{
-#ifdef _WIN32
/*
* We need to explicitly set --tap-sleep because
* we do not schedule event timers in the top-level context.
@@ -3047,9 +3027,8 @@ options_postprocess_mutate_invariant(struct options *options)
options->tuntap_options.tap_sleep = options->route_delay;
}
options->route_delay_defined = false;
-#endif
}
-#endif
+#endif /* ifdef _WIN32 */
#ifdef DEFAULT_PKCS11_MODULE
/* If p11-kit is present on the system then load its p11-kit-proxy.so
@@ -3497,14 +3476,11 @@ options_postprocess_filechecks(struct options *options)
/* ** Config related ** */
errs |= check_file_access_chroot(options->chroot_dir, CHKACC_FILE, options->tls_export_cert,
R_OK|W_OK|X_OK, "--tls-export-cert");
-#if P2MP_SERVER
errs |= check_file_access_chroot(options->chroot_dir, CHKACC_FILE, options->client_config_dir,
R_OK|X_OK, "--client-config-dir");
errs |= check_file_access_chroot(options->chroot_dir, CHKACC_FILE, options->tmp_dir,
R_OK|W_OK|X_OK, "Temporary directory (--tmp-dir)");
-#endif /* P2MP_SERVER */
-
if (errs)
{
msg(M_USAGE, "Please correct these errors.");
@@ -5422,12 +5398,10 @@ add_option(struct options *options,
{
options->mode = MODE_POINT_TO_POINT;
}
-#if P2MP_SERVER
else if (streq(p[1], "server"))
{
options->mode = MODE_SERVER;
}
-#endif
else
{
msg(msglevel, "Bad --mode parameter: %s", p[1]);
@@ -6682,7 +6656,6 @@ add_option(struct options *options,
}
#endif
#if P2MP
-#if P2MP_SERVER
else if (streq(p[0], "server") && p[1] && p[2] && !p[4])
{
const int lev = M_WARN;
@@ -7234,7 +7207,6 @@ add_option(struct options *options,
options->stale_routes_ageing_time = ageing_time;
options->stale_routes_check_interval = check_interval;
}
-#endif /* P2MP_SERVER */
else if (streq(p[0], "client") && !p[1])
{
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index 96e302b..375a4fc 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -404,7 +404,6 @@ struct options
#if P2MP
-#if P2MP_SERVER
/* the tmp dir is for now only used in the P2P server context */
const char *tmp_dir;
bool server_defined;
@@ -487,7 +486,6 @@ struct options
char *port_share_port;
const char *port_share_journal_dir;
#endif
-#endif /* if P2MP_SERVER */
bool client;
bool pull; /* client pull of config options from server */
@@ -696,10 +694,8 @@ struct options
#if P2MP
#define PULL_DEFINED(opt) ((opt)->pull)
-#if P2MP_SERVER
#define PUSH_DEFINED(opt) ((opt)->push_list)
#endif
-#endif
#ifndef PULL_DEFINED
#define PULL_DEFINED(opt) (false)
diff --git a/src/openvpn/push.c b/src/openvpn/push.c
index ab0cdf6..0e58b83 100644
--- a/src/openvpn/push.c
+++ b/src/openvpn/push.c
@@ -40,9 +40,7 @@
#if P2MP
-#ifdef P2MP_SERVER
static char push_reply_cmd[] = "PUSH_REPLY";
-#endif
/*
* Auth username/password
@@ -179,7 +177,6 @@ server_pushed_signal(struct context *c, const struct buffer *buffer, const bool
}
}
-#if P2MP_SERVER
/**
* Add an option to the given push list by providing a format string.
*
@@ -246,8 +243,6 @@ send_restart(struct context *c, const char *kill_msg)
send_control_channel_string(c, kill_msg ? kill_msg : "RESTART", D_PUSH);
}
-#endif /* if P2MP_SERVER */
-
/*
* Push/Pull
*/
@@ -331,7 +326,6 @@ send_push_request(struct context *c)
}
}
-#if P2MP_SERVER
/**
* Prepare push option for auth-token
* @param tls_multi tls multi context of VPN tunnel
@@ -716,9 +710,7 @@ push_remove_option(struct options *o, const char *p)
}
}
}
-#endif /* if P2MP_SERVER */
-#if P2MP_SERVER
int
process_incoming_push_request(struct context *c)
{
@@ -764,7 +756,6 @@ process_incoming_push_request(struct context *c)
return ret;
}
-#endif /* if P2MP_SERVER */
static void
push_update_digest(md_ctx_t *ctx, struct buffer *buf, const struct options *opt)
@@ -796,15 +787,12 @@ process_incoming_push_msg(struct context *c,
int ret = PUSH_MSG_ERROR;
struct buffer buf = *buffer;
-#if P2MP_SERVER
if (buf_string_compare_advance(&buf, "PUSH_REQUEST"))
{
ret = process_incoming_push_request(c);
}
- else
-#endif
-
- if (honor_received_options && buf_string_compare_advance(&buf, "PUSH_REPLY"))
+ else if (honor_received_options
+ && buf_string_compare_advance(&buf, "PUSH_REPLY"))
{
const uint8_t ch = buf_read_u8(&buf);
if (ch == ',')
@@ -856,7 +844,6 @@ process_incoming_push_msg(struct context *c,
return ret;
}
-#if P2MP_SERVER
/*
* Remove iroutes from the push_list.
@@ -920,6 +907,4 @@ remove_iroutes_from_push_route_list(struct options *o)
}
}
-#endif /* if P2MP_SERVER */
-
#endif /* if P2MP */
diff --git a/src/openvpn/push.h b/src/openvpn/push.h
index 6cabc44..53deae0 100644
--- a/src/openvpn/push.h
+++ b/src/openvpn/push.h
@@ -52,7 +52,6 @@ void server_pushed_signal(struct context *c, const struct buffer *buffer, const
void incoming_push_message(struct context *c, const struct buffer *buffer);
-#if P2MP_SERVER
void clone_push_list(struct options *o);
void push_option(struct options *o, const char *opt, int msglevel);
@@ -78,6 +77,5 @@ void send_restart(struct context *c, const char *kill_msg);
*/
void send_push_reply_auth_token(struct tls_multi *multi);
-#endif
#endif /* if P2MP */
#endif /* ifndef PUSH_H */
diff --git a/src/openvpn/pushlist.h b/src/openvpn/pushlist.h
index 23b0ee5..967eda2 100644
--- a/src/openvpn/pushlist.h
+++ b/src/openvpn/pushlist.h
@@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#if !defined(PUSHLIST_H) && P2MP && P2MP_SERVER
+#if !defined(PUSHLIST_H) && P2MP
#define PUSHLIST_H
/* parameters to be pushed to peer */
@@ -37,5 +37,4 @@ struct push_list {
struct push_entry *tail;
};
-
-#endif
+#endif /* if !defined(PUSHLIST_H) && P2MP */
diff --git a/src/openvpn/schedule.c b/src/openvpn/schedule.c
index 76cf7c3..13be323 100644
--- a/src/openvpn/schedule.c
+++ b/src/openvpn/schedule.c
@@ -29,8 +29,6 @@
#include "syshead.h"
-#if P2MP_SERVER
-
#include "buffer.h"
#include "misc.h"
#include "crypto.h"
@@ -723,4 +721,3 @@ schedule_test(void)
}
#endif /* ifdef SCHEDULE_TEST */
-#endif /* if P2MP_SERVER */
diff --git a/src/openvpn/schedule.h b/src/openvpn/schedule.h
index 74d37fb..8c476fd 100644
--- a/src/openvpn/schedule.h
+++ b/src/openvpn/schedule.h
@@ -35,8 +35,6 @@
* a ping or scheduling a TLS renegotiation.
*/
-#if P2MP_SERVER
-
/* define to enable a special test mode */
/*#define SCHEDULE_TEST*/
@@ -136,5 +134,4 @@ schedule_get_earliest_wakeup(struct schedule *s,
return ret;
}
-#endif /* if P2MP_SERVER */
#endif /* ifndef SCHEDULE_H */
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 88b4cc7..c2e9a4f 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -1351,11 +1351,9 @@ tls_multi_free(struct tls_multi *multi, bool clear)
ASSERT(multi);
-#if P2MP_SERVER
auth_set_client_reason(multi, NULL);
free(multi->peer_info);
-#endif
if (multi->locked_cn)
{
@@ -2600,7 +2598,6 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio
username_status = read_string(buf, up->username, USER_PASS_LEN);
password_status = read_string(buf, up->password, USER_PASS_LEN);
-#if P2MP_SERVER
/* get peer info from control channel */
free(multi->peer_info);
multi->peer_info = read_string_alloc(buf);
@@ -2624,7 +2621,6 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio
session->opt->ncp_enabled = false;
}
}
-#endif /* if P2MP_SERVER */
if (tls_session_user_pass_enabled(session))
{
diff --git a/src/openvpn/ssl_common.h b/src/openvpn/ssl_common.h
index f48990d..fe52336 100644
--- a/src/openvpn/ssl_common.h
+++ b/src/openvpn/ssl_common.h
@@ -306,7 +306,6 @@ struct tls_options
const char *tmp_dir;
const char *auth_user_pass_file;
-#ifdef P2MP_SERVER
bool auth_token_generate; /**< Generate auth-tokens on successful
* user/pass auth,seet via
* options->auth_token_generate. */
@@ -314,7 +313,6 @@ struct tls_options
unsigned int auth_token_lifetime;
struct key_ctx auth_token_key;
-#endif
/* use the client-config-dir as a positive authenticator */
const char *client_config_dir_exclusive;
@@ -530,7 +528,6 @@ struct tls_multi
time_t tas_last;
#endif
-#ifdef P2MP_SERVER
/*
* An error message to send to client on AUTH_FAILED
*/
@@ -541,7 +538,6 @@ struct tls_multi
* over control channel.
*/
char *peer_info;
-#endif
char *auth_token; /**< If server sends a generated auth-token,
* this is the token to use for future
* user/pass authentications in this session.
diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c
index 27fe7c5..f518f59 100644
--- a/src/openvpn/ssl_mbedtls.c
+++ b/src/openvpn/ssl_mbedtls.c
@@ -1063,13 +1063,11 @@ key_state_ssl_init(struct key_state_ssl *ks_ssl,
ssl_ctx->priv_key));
/* Initialise SSL verification */
-#if P2MP_SERVER
if (session->opt->ssl_flags & SSLF_CLIENT_CERT_OPTIONAL)
{
mbedtls_ssl_conf_authmode(ks_ssl->ssl_config, MBEDTLS_SSL_VERIFY_OPTIONAL);
}
else if (!(session->opt->ssl_flags & SSLF_CLIENT_CERT_NOT_REQUIRED))
-#endif
{
mbedtls_ssl_conf_authmode(ks_ssl->ssl_config, MBEDTLS_SSL_VERIFY_REQUIRED);
}
diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
index 56a84d4..06c836d 100644
--- a/src/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -353,7 +353,6 @@ tls_ctx_set_options(struct tls_root_ctx *ctx, unsigned int ssl_flags)
/* Require peer certificate verification */
int verify_flags = SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
-#if P2MP_SERVER
if (ssl_flags & SSLF_CLIENT_CERT_NOT_REQUIRED)
{
verify_flags = 0;
@@ -362,7 +361,6 @@ tls_ctx_set_options(struct tls_root_ctx *ctx, unsigned int ssl_flags)
{
verify_flags = SSL_VERIFY_PEER;
}
-#endif
SSL_CTX_set_verify(ctx->ctx, verify_flags, verify_callback);
SSL_CTX_set_info_callback(ctx->ctx, info_callback);
diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
index 9362b8e..e66d81e 100644
--- a/src/openvpn/ssl_verify.c
+++ b/src/openvpn/ssl_verify.c
@@ -1372,7 +1372,6 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi,
set_common_name(session, up->username);
}
-#if P2MP_SERVER
if ((session->opt->auth_token_generate))
{
/*
@@ -1411,7 +1410,6 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi,
*/
send_push_reply_auth_token(multi);
}
-#endif
#ifdef ENABLE_DEF_AUTH
msg(D_HANDSHAKE, "TLS: Username/Password authentication %s for username '%s' %s",
ks->auth_deferred ? "deferred" : "succeeded",
diff --git a/src/openvpn/ssl_verify.h b/src/openvpn/ssl_verify.h
index 21b37a0..b1ced95 100644
--- a/src/openvpn/ssl_verify.h
+++ b/src/openvpn/ssl_verify.h
@@ -226,7 +226,6 @@ bool tls_authenticate_key(struct tls_multi *multi, const unsigned int mda_key_id
#endif
-#ifdef P2MP_SERVER
/**
* Sets the reason why authentication of a client failed. This be will send to the client
* when the AUTH_FAILED message is sent
@@ -236,8 +235,6 @@ bool tls_authenticate_key(struct tls_multi *multi, const unsigned int mda_key_id
*/
void auth_set_client_reason(struct tls_multi *multi, const char *client_reason);
-#endif
-
static inline const char *
tls_client_reason(struct tls_multi *multi)
{
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index b031dd6..cafe471 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -521,16 +521,10 @@ socket_defined(const socket_descriptor_t sd)
#define P2MP 0
#endif
-#if P2MP && !defined(ENABLE_CLIENT_ONLY)
-#define P2MP_SERVER 1
-#else
-#define P2MP_SERVER 0
-#endif
-
/*
* HTTPS port sharing capability
*/
-#if defined(ENABLE_PORT_SHARE) && P2MP_SERVER && defined(SCM_RIGHTS) && defined(HAVE_MSGHDR) && defined(HAVE_CMSGHDR) && defined(HAVE_IOVEC) && defined(CMSG_FIRSTHDR) && defined(CMSG_NXTHDR) && defined(HAVE_RECVMSG) && defined(HAVE_SENDMSG)
+#if defined(ENABLE_PORT_SHARE) && defined(SCM_RIGHTS) && defined(HAVE_MSGHDR) && defined(HAVE_CMSGHDR) && defined(HAVE_IOVEC) && defined(CMSG_FIRSTHDR) && defined(CMSG_NXTHDR) && defined(HAVE_RECVMSG) && defined(HAVE_SENDMSG)
#define PORT_SHARE 1
#else
#define PORT_SHARE 0
@@ -539,10 +533,10 @@ socket_defined(const socket_descriptor_t sd)
/*
* Enable deferred authentication?
*/
-#if defined(ENABLE_DEF_AUTH) && P2MP_SERVER && defined(ENABLE_PLUGIN)
+#if defined(ENABLE_DEF_AUTH) && defined(ENABLE_PLUGIN)
#define PLUGIN_DEF_AUTH
#endif
-#if defined(ENABLE_DEF_AUTH) && P2MP_SERVER && defined(ENABLE_MANAGEMENT)
+#if defined(ENABLE_DEF_AUTH) && defined(ENABLE_MANAGEMENT)
#define MANAGEMENT_DEF_AUTH
#endif
#if !defined(PLUGIN_DEF_AUTH) && !defined(MANAGEMENT_DEF_AUTH)
@@ -556,10 +550,10 @@ socket_defined(const socket_descriptor_t sd)
/*
* Enable packet filter?
*/
-#if defined(ENABLE_PF) && P2MP_SERVER && defined(ENABLE_PLUGIN) && defined(HAVE_STAT)
+#if defined(ENABLE_PF) && defined(ENABLE_PLUGIN) && defined(HAVE_STAT)
#define PLUGIN_PF
#endif
-#if defined(ENABLE_PF) && P2MP_SERVER && defined(MANAGEMENT_DEF_AUTH)
+#if defined(ENABLE_PF) && defined(MANAGEMENT_DEF_AUTH)
#define MANAGEMENT_PF
#endif
#if !defined(PLUGIN_PF) && !defined(MANAGEMENT_PF)
diff --git a/src/openvpn/vlan.c b/src/openvpn/vlan.c
index 9290179..dd8d7c1 100644
--- a/src/openvpn/vlan.c
+++ b/src/openvpn/vlan.c
@@ -30,8 +30,6 @@
#include "syshead.h"
-#if P2MP_SERVER
-
#include "multi.h"
#include "options.h"
#include "vlan.h"
@@ -333,5 +331,3 @@ vlan_process_outgoing_tun(struct multi_context *m, struct multi_instance *mi)
vlan_encapsulate(&mi->context, &mi->context.c2.to_tun);
}
}
-
-#endif /* P2MP_SERVER */
diff --git a/src/openvpn/vlan.h b/src/openvpn/vlan.h
index a67ad0e..ed25c1d 100644
--- a/src/openvpn/vlan.h
+++ b/src/openvpn/vlan.h
@@ -25,8 +25,6 @@
#ifndef VLAN_H
#define VLAN_H
-#if P2MP_SERVER
-
#include "buffer.h"
#include "mroute.h"
#include "openvpn.h"
@@ -43,6 +41,4 @@ vlan_is_tagged(const struct buffer *buf);
void
vlan_process_outgoing_tun(struct multi_context *m, struct multi_instance *mi);
-#endif /* P2MP_SERVER */
-
#endif /* VLAN_H */