summaryrefslogtreecommitdiff
path: root/src/openvpn/openvpn.c
diff options
context:
space:
mode:
authorBernhard Schmidt <berni@debian.org>2020-08-15 21:29:54 +0200
committerBernhard Schmidt <berni@debian.org>2020-08-15 21:29:54 +0200
commit7c229d538824cb679351220ad8911f7b2daa7c23 (patch)
tree5c4d64b60da9018c7db3a9335a9787d326beade3 /src/openvpn/openvpn.c
parentd3986a312f5fbcfd0e78e6b147eef419fb4e5f54 (diff)
parent1079962e4c06f88a54e50d997c1b7e84303d30b4 (diff)
Update upstream source from tag 'upstream/2.5_beta1'
Update to upstream version '2.5~beta1' with Debian dir d53f9a482ac24eb491a294b26c24bb1d87afad24
Diffstat (limited to 'src/openvpn/openvpn.c')
-rw-r--r--src/openvpn/openvpn.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c
index 3d244fc..857c5fa 100644
--- a/src/openvpn/openvpn.c
+++ b/src/openvpn/openvpn.c
@@ -37,8 +37,6 @@
#include "memdbg.h"
-#include "forward-inline.h"
-
#define P2P_CHECK_SIG() EVENT_LOOP_CHECK_SIGNAL(c, process_signal_p2p, c);
static bool
@@ -48,28 +46,6 @@ process_signal_p2p(struct context *c)
return process_signal(c);
}
-/* Write our PID to a file */
-static void
-write_pid(const char *filename)
-{
- if (filename)
- {
- unsigned int pid = 0;
- FILE *fp = platform_fopen(filename, "w");
- if (!fp)
- {
- msg(M_ERR, "Open error on pid file %s", filename);
- }
-
- pid = platform_getpid();
- fprintf(fp, "%u\n", pid);
- if (fclose(fp))
- {
- msg(M_ERR, "Close error on pid file %s", filename);
- }
- }
-}
-
/**************************************************************************/
/**
@@ -217,6 +193,8 @@ openvpn_main(int argc, char *argv[])
open_plugins(&c, true, OPENVPN_PLUGIN_INIT_PRE_CONFIG_PARSE);
#endif
+ net_ctx_init(&c, &c.net_ctx);
+
/* init verbosity and mute levels */
init_verb_mute(&c, IVM_LEVEL_1);
@@ -236,7 +214,7 @@ openvpn_main(int argc, char *argv[])
}
/* tun/tap persist command? */
- if (do_persist_tuntap(&c.options))
+ if (do_persist_tuntap(&c.options, &c.net_ctx))
{
break;
}
@@ -274,7 +252,7 @@ openvpn_main(int argc, char *argv[])
if (c.first_time)
{
c.did_we_daemonize = possibly_become_daemon(&c.options);
- write_pid(c.options.writepid);
+ write_pid_file(c.options.writepid, c.options.chroot_dir);
}
#ifdef ENABLE_MANAGEMENT
@@ -305,12 +283,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);
}
@@ -332,6 +308,7 @@ openvpn_main(int argc, char *argv[])
env_set_destroy(c.es);
uninit_options(&c.options);
gc_reset(&c.gc);
+ net_ctx_free(&c.net_ctx);
}
while (c.sig->signal_received == SIGHUP);
}