summaryrefslogtreecommitdiff
path: root/Ports/wireguard-tools
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-01-10 19:53:40 +0100
committerLinus Groh <mail@linusgroh.de>2022-01-10 21:22:41 +0100
commitd099527dbb60059091cdf4bb9f237f4c7ede444b (patch)
tree78916012b1fcb576b860725aa36f30bf78928c0d /Ports/wireguard-tools
parent60ace3771322f4614a0353cd9db80de5ee1adf09 (diff)
downloadserenity-d099527dbb60059091cdf4bb9f237f4c7ede444b.zip
Ports: Add wireguard-tools
What will it take to port WireGuard to SerenityOS? No idea. But this is a start :^)
Diffstat (limited to 'Ports/wireguard-tools')
-rwxr-xr-xPorts/wireguard-tools/package.sh8
-rw-r--r--Ports/wireguard-tools/patches/replace-strsep-with-strtok.patch28
2 files changed, 36 insertions, 0 deletions
diff --git a/Ports/wireguard-tools/package.sh b/Ports/wireguard-tools/package.sh
new file mode 100755
index 0000000000..34dd44432c
--- /dev/null
+++ b/Ports/wireguard-tools/package.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env -S bash ../.port_include.sh
+port=wireguard-tools
+version=1.0.20210914
+files="https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-${version}.tar.xz wireguard-tools-${version}.tar.xz 97ff31489217bb265b7ae850d3d0f335ab07d2652ba1feec88b734bc96bd05ac"
+auth_type=sha256
+makeopts=("--directory=src")
+# NOTE: PREFIX extends DESTDIR and therefore must not include $SERENITY_INSTALL_ROOT!
+installopts=("--directory=src" "PREFIX=/usr/local")
diff --git a/Ports/wireguard-tools/patches/replace-strsep-with-strtok.patch b/Ports/wireguard-tools/patches/replace-strsep-with-strtok.patch
new file mode 100644
index 0000000000..23f0039da5
--- /dev/null
+++ b/Ports/wireguard-tools/patches/replace-strsep-with-strtok.patch
@@ -0,0 +1,28 @@
+--- wireguard-tools-1.0.20210914/src/ipc-uapi.h 2022-01-10 19:32:48.333858269 +0100
++++ wireguard-tools-1.0.20210914/src/ipc-uapi.h 2022-01-10 19:34:25.996423462 +0100
+@@ -246,7 +246,7 @@
+ peer->flags |= WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL;
+ } else if (peer && !strcmp(key, "allowed_ip")) {
+ struct wgallowedip *new_allowedip;
+- char *end, *mask = value, *ip = strsep(&mask, "/");
++ char *end, *mask = value, *ip = strtok(mask, "/");
+
+ if (!mask || !char_is_digit(mask[0]))
+ break;
+--- wireguard-tools-1.0.20210914/src/config.c 2022-01-10 19:35:02.057260483 +0100
++++ wireguard-tools-1.0.20210914/src/config.c 2022-01-10 19:35:23.359164203 +0100
+@@ -352,12 +352,12 @@
+ return true;
+ }
+ sep = mutable;
+- while ((mask = strsep(&sep, ","))) {
++ while ((mask = strtok(sep, ","))) {
+ unsigned long cidr;
+ char *end, *ip;
+
+ saved_entry = strdup(mask);
+- ip = strsep(&mask, "/");
++ ip = strtok(mask, "/");
+
+ new_allowedip = calloc(1, sizeof(*new_allowedip));
+ if (!new_allowedip) {