You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
5.7 KiB
149 lines
5.7 KiB
Index: src/openvpn/tun.c |
|
--- src/openvpn/tun.c.orig 2024-06-20 11:37:03.000000000 +0200 |
|
+++ src/openvpn/tun.c 2024-06-21 13:08:53.531018000 +0200 |
|
@@ -2383,7 +2383,8 @@ |
|
#elif defined(TARGET_SOLARIS) |
|
|
|
#ifndef TUNNEWPPA |
|
-#error I need the symbol TUNNEWPPA from net/if_tun.h |
|
+#warning I usually need the symbol TUNNEWPPA from net/if_tun.h -- using a shameless local copy taken from TUN 1.1 |
|
+#define TUNNEWPPA (('T'<<16) | 0x0001) |
|
#endif |
|
|
|
void |
|
Index: src/plugins/down-root/down-root.c |
|
--- src/plugins/down-root/down-root.c.orig 2024-06-20 11:37:03.000000000 +0200 |
|
+++ src/plugins/down-root/down-root.c 2024-06-21 20:20:58.755144000 +0200 |
|
@@ -60,6 +60,9 @@ |
|
/* Background process function */ |
|
static void down_root_server(const int fd, char *const *argv, char *const *envp, const int verb); |
|
|
|
+static plugin_log_t plugin_log = NULL; |
|
+static char *MODULE = "DOWN-ROOT"; |
|
+ |
|
/* |
|
* Plugin state, used by foreground |
|
*/ |
|
@@ -179,7 +182,7 @@ |
|
#endif |
|
if (daemon(0, 0) < 0) |
|
{ |
|
- warn("DOWN-ROOT: daemonization failed"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: daemonization failed"); |
|
} |
|
#if defined(__APPLE__) && defined(__clang__) |
|
#pragma clang diagnostic pop |
|
@@ -258,11 +261,12 @@ |
|
{ |
|
execve(argv[0], argv, envp); |
|
/* If execve() fails to run, exit child with exit code 127 */ |
|
- err(127, "DOWN-ROOT: Failed execute: %s", argv[0]); |
|
+ plugin_log(PLOG_ERR, MODULE, "DOWN-ROOT: Failed execute: %s", argv[0]); |
|
+ exit(127); |
|
} |
|
else if (pid < (pid_t)0) |
|
{ |
|
- warn("DOWN-ROOT: Failed to fork child to run %s", argv[0]); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: Failed to fork child to run %s", argv[0]); |
|
return -1; |
|
} |
|
else /* parent side */ |
|
@@ -289,7 +293,7 @@ |
|
context = (struct down_root_context *) calloc(1, sizeof(struct down_root_context)); |
|
if (!context) |
|
{ |
|
- warn("DOWN-ROOT: Could not allocate memory for plug-in context"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: Could not allocate memory for plug-in context"); |
|
goto error; |
|
} |
|
context->foreground_fd = -1; |
|
@@ -315,7 +319,7 @@ |
|
context->command = calloc(string_array_len(argv), sizeof(char *)); |
|
if (!context->command) |
|
{ |
|
- warn("DOWN-ROOT: Could not allocate memory for command array"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: Could not allocate memory for command array"); |
|
goto error; |
|
} |
|
|
|
@@ -359,7 +363,7 @@ |
|
*/ |
|
if (socketpair(PF_UNIX, SOCK_DGRAM, 0, fd) == -1) |
|
{ |
|
- warn("DOWN-ROOT: socketpair call failed"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: socketpair call failed"); |
|
return OPENVPN_PLUGIN_FUNC_ERROR; |
|
} |
|
|
|
@@ -385,7 +389,7 @@ |
|
/* don't let future subprocesses inherit child socket */ |
|
if (fcntl(fd[0], F_SETFD, FD_CLOEXEC) < 0) |
|
{ |
|
- warn("DOWN-ROOT: Set FD_CLOEXEC flag on socket file descriptor failed"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: Set FD_CLOEXEC flag on socket file descriptor failed"); |
|
} |
|
|
|
/* wait for background child process to initialize */ |
|
@@ -423,7 +427,7 @@ |
|
{ |
|
if (send_control(context->foreground_fd, COMMAND_RUN_SCRIPT) == -1) |
|
{ |
|
- warn("DOWN-ROOT: Error sending script execution signal to background process"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: Error sending script execution signal to background process"); |
|
} |
|
else |
|
{ |
|
@@ -434,7 +438,7 @@ |
|
} |
|
if (status == -1) |
|
{ |
|
- warn("DOWN-ROOT: Error receiving script execution confirmation from background process"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: Error receiving script execution confirmation from background process"); |
|
} |
|
} |
|
} |
|
@@ -456,7 +460,7 @@ |
|
/* tell background process to exit */ |
|
if (send_control(context->foreground_fd, COMMAND_EXIT) == -1) |
|
{ |
|
- warn("DOWN-ROOT: Error signalling background process to exit"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: Error signalling background process to exit"); |
|
} |
|
|
|
/* wait for background process to exit */ |
|
@@ -505,7 +509,7 @@ |
|
*/ |
|
if (send_control(fd, RESPONSE_INIT_SUCCEEDED) == -1) |
|
{ |
|
- warn("DOWN-ROOT: BACKGROUND: write error on response socket [1]"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: BACKGROUND: write error on response socket [1]"); |
|
goto done; |
|
} |
|
|
|
@@ -532,7 +536,7 @@ |
|
{ |
|
if (send_control(fd, RESPONSE_SCRIPT_SUCCEEDED) == -1) |
|
{ |
|
- warn("DOWN-ROOT: BACKGROUND: write error on response socket [2]"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: BACKGROUND: write error on response socket [2]"); |
|
goto done; |
|
} |
|
} |
|
@@ -541,7 +545,7 @@ |
|
fprintf(stderr, "DOWN-ROOT: BACKGROUND: %s exited with exit code %i\n", argv[0], exit_code); |
|
if (send_control(fd, RESPONSE_SCRIPT_FAILED) == -1) |
|
{ |
|
- warn("DOWN-ROOT: BACKGROUND: write error on response socket [3]"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: BACKGROUND: write error on response socket [3]"); |
|
goto done; |
|
} |
|
} |
|
@@ -551,7 +555,7 @@ |
|
goto done; |
|
|
|
case -1: |
|
- warn("DOWN-ROOT: BACKGROUND: read error on command channel"); |
|
+ plugin_log(PLOG_WARN, MODULE, "DOWN-ROOT: BACKGROUND: read error on command channel"); |
|
goto done; |
|
|
|
default:
|
|
|