From: "cron2 (Code Review)" Date: Thu, 28 Nov 2024 11:48:41 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., alex@...2837..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="gwbfwIlB6w8="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Haiku: Introduce basic platform / tun support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kallisti5 Cc: plaisthos , flichtenheld , openvpn-devel --gwbfwIlB6w8= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/68= 7?usp=3Demail ) Change subject: Haiku: Introduce basic platform / tun support ...................................................................... Haiku: Introduce basic platform / tun support * Special thanks to Sean Brady's hard work in GSoC 2023 towards creating a TUN/TAP driver for Haiku! * More kudos to Augustin Cavalier for making it functional :-) Signed-off-by: Alexander von Gluck Acked-by: Gert Doering Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9 Message-Id: <20241128101538.12810-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29= 947.html Signed-off-by: Gert Doering --- M INSTALL M configure.ac M src/openvpn/tun.c 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index 6007338..9739272 100644 --- a/INSTALL +++ b/INSTALL @@ -263,6 +263,16 @@ http://www.whiteboard.ne.jp/~admin2/tuntap/ +* Haiku: + + Haiku can't yet dynamically create TUN/TAP devices, so you need to manu= ally + create one before running openvpn: + + # ifconfig tun/0 up + + A standard reference the dev as "tun" in your config is all that's need= ed + to use the tunnel device. + * Windows OpenVPN on Windows needs a TUN/TAP kernel driver to work. OpenVPN instal= lers diff --git a/configure.ac b/configure.ac index 0876a6a..7f6e43d 100644 --- a/configure.ac +++ b/configure.ac @@ -368,6 +368,11 @@ have_tap_header=3D"yes" ac_cv_header_net_if_h=3D"no" # exists, but breaks things ;; + *-*-haiku*) + AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?]) + AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix]) + LIBS=3D"${LIBS} -lnetwork" + ;; *) AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix]) have_tap_header=3D"yes" diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 85fe01a..29d823d 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -1631,6 +1631,13 @@ { 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 */ + 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 o= r use an --up script."); #endif /* if defined(TARGET_LINUX) */ @@ -1909,10 +1916,15 @@ { for (int i =3D 0; i < 256; ++i) { + /* some platforms have a dedicated directory per driver */ + char *sep =3D ""; +#if defined(TARGET_HAIKU) + sep =3D "/"; +#endif snprintf(tunname, sizeof(tunname), - "/dev/%s%d", dev, i); + "/dev/%s%s%d", dev, sep, i); snprintf(dynamic_name, sizeof(dynamic_name), - "%s%d", dev, i); + "%s%s%d", dev, sep, i); if ((tt->fd =3D open(tunname, O_RDWR)) > 0) { dynamic_opened =3D true; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9 Gerrit-Change-Number: 687 Gerrit-PatchSet: 7 Gerrit-Owner: kallisti5 Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --gwbfwIlB6w8= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

Haiku: Introduce basic platform / tun support<=
br>
* Special thanks to Sean Brady's hard work in GSoC 2023 towards = creating
a TUN/TAP driver for Haiku!
* More kudos to Augustin Caval= ier for making it functional :-)

Signed-off-by: Alexander von Gluck = <alex@...2837...>
Acked-by: Gert Doering <gert@...1296...>Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Message-Id: <2= 0241128101538.12810-1-gert@...1296...>
URL: https://www.mail-archive.= com/openvpn-devel@lists.sourceforge.net/msg29947.html
Signed-off-by: Ger= t Doering <gert@...1296...>
---
M INSTALL
M configure.ac
= M src/openvpn/tun.c
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/INSTALL b/INSTALL
index 6007338..9739272 10= 0644
--- a/INSTALL
+++ b/INSTALL
= @@ -263,6 +263,16 @@

http://ww= w.whiteboard.ne.jp/~admin2/tuntap/

+* Haiku:
+
+ Haiku can't yet dynamically create TUN/TAP devices, so you need = to manually
+ creat= e one before running openvpn:
+
+ # if= config tun/0 up
+

+ A standard reference= the dev as "tun" in your config is all that's needed<= br>+ to use the tunnel device= .
+
= * Windows

OpenVPN on Windows needs a T= UN/TAP kernel driver to work. OpenVPN installers
diff --git= a/configure.ac b/configure.ac
index 0876a6a..7f6e43d 10064= 4
--- a/configure.ac
+++ b/configure.ac
@@ -368,6 +368,11 @@
have_tap_header=3D&quo= t;yes"
ac_cv_header_net_if_h=3D"no" # exi= sts, but breaks things
;;
+ *-*-haiku*)
+ AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?])=
+ AC_DEFINE_UNQUOTE= D([TARGET_PREFIX], ["H"], [Target prefix])
+ LIBS=3D"${LIBS} -lnetwork"
+ ;;
= *)
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"],= [Target prefix])
have_tap_header=3D"yes"
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 85fe01a..29d823d 100644

--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -1631,6 +1631,13 = @@
{
windows_set_mtu(tt->a= dapter_index, AF_INET, tun_mtu);
}
+#elif defined(TARGET_HAIKU)
<= span style=3D"color: hsl(120, 100%, 40%);">+ /* example: ifconfig tun/0 = inet 1.1.1.1 255.255.255.0 mtu 1450 up */

+ argv_printf(&argv, "%s %s inet %s %s mtu= %d up", IFCONFIG_PATH,
+ ifname, ifconfig_local, ifconfig_remote_netmask, t= un_mtu);
+
= + argv_msg(M_INFO, &argv= );
+ openvpn_execv= e_check(&argv, es, S_FATAL, "Haiku ifconfig failed");<= br> #else /* if defined(TARGET_LINUX) */
msg(M_= FATAL, "Sorry, but I don't know how to do 'ifconfig' comma= nds on this operating system. You should ifconfig your TUN/TAP device manu= ally or use an --up script.");
#endif /* if defined(T= ARGET_LINUX) */
@@ -1909,10 +1916,15 @@
= {
for (int i =3D 0; i < 256; ++i)
{
+ /* some platforms have a dedicated directory per dr= iver */
+ = char *sep =3D "";
+#if defined(TARGET_HAIKU)
+ sep =3D "/";
+#endif
= snprintf(tunname, sizeof(tunname),
- "/dev/%s%d", dev, i);
+ = "/dev/%s%s%d", dev, sep, i);
s= nprintf(dynamic_name, sizeof(dynamic_name),
- "%s%d", dev, i);
+ = "%s%s%d", dev, sep, i);
if (= (tt->fd =3D open(tunname, O_RDWR)) > 0)
= {
dynamic_opened =3D true;<= br>

To view, visit change 687. To unsubscribe, or for h= elp writing mail filters, visit settings.

<= /div>
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced17= 46c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 7
Gerrit-Owner: kallisti5 <alex@...2837...>= ;
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--gwbfwIlB6w8=--