mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-25 09:38:52 +02:00
openvpn: bump to 2.6.8, add new Haiku tunnel design
* There's still more work to do here. You have to manually ifconfig tun/0 up before running openvpn * You also have to manually still tune routes, openvpn needs route detection. * This won't work until Gerrit 7143 is merged
This commit is contained in:
104
net-vpn/openvpn/patches/openvpn-2.6.8.patchset
Normal file
104
net-vpn/openvpn/patches/openvpn-2.6.8.patchset
Normal file
@@ -0,0 +1,104 @@
|
||||
From 7a9918bd66d0d8cef4f8ab751436835772231c3d Mon Sep 17 00:00:00 2001
|
||||
From: Alexander von Gluck IV <kallisti5@unixzen.com>
|
||||
Date: Fri, 17 Nov 2023 14:39:01 -0600
|
||||
Subject: [PATCH] Haiku: Introduce basic platform support
|
||||
|
||||
* Missing gateway detection in route.c
|
||||
* Missing ipv6 routing calls
|
||||
---
|
||||
configure.ac | 4 ++++
|
||||
src/openvpn/route.c | 15 +++++++++++++++
|
||||
src/openvpn/tun.c | 18 +++++++++++++++++-
|
||||
3 files changed, 36 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 84eaad60..4ca8f4f0 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/route.c b/src/openvpn/route.c
|
||||
index ff64938a..85b542c5 100644
|
||||
--- a/src/openvpn/route.c
|
||||
+++ b/src/openvpn/route.c
|
||||
@@ -1842,6 +1842,21 @@ add_route(struct route_ipv4 *r,
|
||||
status = ret ? RTA_SUCCESS : RTA_ERROR;
|
||||
}
|
||||
|
||||
+#elif defined(TARGET_HAIKU)
|
||||
+
|
||||
+ {
|
||||
+ /* ex: route add /dev/net/ipro1000/0 default gw 192.168.1.1 netmask 255.255.255.0 */
|
||||
+ argv_printf(&argv, "route add %s inet default gw %s netmask %s",
|
||||
+ rgi->iface,
|
||||
+ gateway,
|
||||
+ netmask);
|
||||
+
|
||||
+ argv_msg(D_ROUTE, &argv);
|
||||
+ bool ret = openvpn_execve_check(&argv, es, 0,
|
||||
+ "ERROR: Haiku route add command failed");
|
||||
+ status = ret ? RTA_SUCCESS : RTA_ERROR;
|
||||
+ }
|
||||
+
|
||||
#else /* if defined(TARGET_LINUX) */
|
||||
msg(M_FATAL, "Sorry, but I don't know how to do 'route' commands on this operating system. Try putting your routes in a --route-up script");
|
||||
#endif /* if defined(TARGET_LINUX) */
|
||||
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
|
||||
index 82ab6c05..0abd0e46 100644
|
||||
--- a/src/openvpn/tun.c
|
||||
+++ b/src/openvpn/tun.c
|
||||
@@ -1643,6 +1643,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 tun/0 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 %s mtu %d up", IFCONFIG_PATH,
|
||||
+ ifname, ifconfig_local, ifconfig_remote_netmask, 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) */
|
||||
@@ -1899,7 +1909,6 @@ tun_dco_enabled(struct tuntap *tt)
|
||||
}
|
||||
#endif
|
||||
|
||||
-
|
||||
#if !(defined(_WIN32) || defined(TARGET_LINUX))
|
||||
static void
|
||||
open_tun_generic(const char *dev, const char *dev_type, const char *dev_node,
|
||||
@@ -1934,10 +1943,17 @@ open_tun_generic(const char *dev, const char *dev_type, const char *dev_node,
|
||||
{
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
+#if defined(TARGET_HAIKU)
|
||||
+ openvpn_snprintf(tunname, sizeof(tunname),
|
||||
+ "/dev/%s/%d", dev, i);
|
||||
+ openvpn_snprintf(dynamic_name, sizeof(dynamic_name),
|
||||
+ "%s/%d", dev, i);
|
||||
+#else
|
||||
openvpn_snprintf(tunname, sizeof(tunname),
|
||||
"/dev/%s%d", dev, i);
|
||||
openvpn_snprintf(dynamic_name, sizeof(dynamic_name),
|
||||
"%s%d", dev, i);
|
||||
+#endif
|
||||
if ((tt->fd = open(tunname, O_RDWR)) > 0)
|
||||
{
|
||||
dynamic_opened = true;
|
||||
--
|
||||
2.42.1
|
||||
|
||||
Reference in New Issue
Block a user