From a854cd0f039aa10b19cb57e7898620d037cfa037 Mon Sep 17 00:00:00 2001 From: Sean Brady <60947265+Swangeon@users.noreply.github.com> Date: Thu, 31 Aug 2023 13:48:59 -0500 Subject: [PATCH] Adding OpenVPN patchset to work with Haiku (#9300) * Adding OpenVPN Patchset * Update openvpn-2.6.4.patchset * Update openvpn-2.6.4.patchset * Update openvpn-2.6.4.patchset * Update openvpn-2.6.4.patchset * Update openvpn-2.6.4.recipe --- net-vpn/openvpn/openvpn-2.6.4.recipe | 5 ++- .../openvpn/patches/openvpn-2.6.4.patchset | 45 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 net-vpn/openvpn/patches/openvpn-2.6.4.patchset diff --git a/net-vpn/openvpn/openvpn-2.6.4.recipe b/net-vpn/openvpn/openvpn-2.6.4.recipe index 2410ce19b..4711c6da2 100644 --- a/net-vpn/openvpn/openvpn-2.6.4.recipe +++ b/net-vpn/openvpn/openvpn-2.6.4.recipe @@ -7,10 +7,13 @@ HOMEPAGE="https://openvpn.net" COPYRIGHT="2002-2023 OpenVPN Inc" LICENSE="OpenVPN GNU GPL v2" -REVISION="1" +REVISION="2" SOURCE_URI="https://github.com/OpenVPN/openvpn/archive/refs/tags/v$portVersion.tar.gz" CHECKSUM_SHA256="bfab07b900262a990fc4519596b29c380ed5a89216593f04719279715ebd04d3" SOURCE_FILENAME="openvpn-$portVersion.tar.gz" +PATCHES=" + openvpn-$portVersion.patchset + " ARCHITECTURES="all !x86_gcc2" SECONDARY_ARCHITECTURES="x86" diff --git a/net-vpn/openvpn/patches/openvpn-2.6.4.patchset b/net-vpn/openvpn/patches/openvpn-2.6.4.patchset new file mode 100644 index 000000000..bc2cd4c7c --- /dev/null +++ b/net-vpn/openvpn/patches/openvpn-2.6.4.patchset @@ -0,0 +1,45 @@ +From c94b287ff24a5b50941ab9e5c00a64f64f809380 Mon Sep 17 00:00:00 2001 +From: Swangeon +Date: Sun, 27 Aug 2023 15:00:18 -0500 +Subject: [PATCH] Changed configure.ac to recognize Haiku and tun.c to use + ifconfig + + +diff --git a/configure.ac b/configure.ac +index 67f680b..26b3e4b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -373,6 +373,10 @@ case "$host" in + have_tap_header="yes" + ac_cv_header_net_if_h="no" # exists, but breaks things + ;; ++ *-*-haiku*) ++ AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?]) ++ AC_DEFINE_UNQUOTED([TARGET_PREFIX]. ["H"], [Target prefix]) ++ ;; + *) + AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix]) + have_tap_header="yes" +diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c +index 2320e8b..2fb0de9 100644 +--- a/src/openvpn/tun.c ++++ b/src/openvpn/tun.c +@@ -1578,6 +1578,16 @@ do_ifconfig_ipv4(struct tuntap *tt, const char *ifname, int tun_mtu, + { + windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu); + } ++#elif defined (TARGET_HAIKU) ++ { ++ /* example: ifconfig tap0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */ ++ // Need to add ifconfig_remote_netmask since right now it is just NULL ++ argv_printf(&argv, "%s %s inet %s 255.255.255.0 mtu %d up", IFCONFIG_PATH, ++ ifname, ifconfig_local, tun_mtu); ++ ++ argv_msg(M_INFO, &argv); ++ openvpn_execve_check(&argv, es, S_FATAL, "HAIKU ifconfig failed"); ++ } + #else /* if defined(TARGET_LINUX) */ + msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system. You should ifconfig your TUN/TAP device manually or use an --up script."); + #endif /* if defined(TARGET_LINUX) */ +-- +2.42.0.windows.1