From: "kallisti5 (Code Review)" Date: Tue, 26 Nov 2024 15:38:37 +0000 In-Reply-To: References: Reply-To: alex@...2837..., arne-openvpn@...1227..., 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="yrO5tIe0XlI="; 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: plaisthos , flichtenheld Cc: openvpn-devel --yrO5tIe0XlI= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello flichtenheld, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=3Demail to look at the new patch set (#2). 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 :-) Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9 --- M configure.ac M src/openvpn/tun.c 2 files changed, 22 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/687/2 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..e428fb9 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -1631,6 +1631,16 @@ { 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 = */ + /* XXX: 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 o= r use an --up script."); #endif /* if defined(TARGET_LINUX) */ @@ -1909,10 +1919,17 @@ { for (int i =3D 0; i < 256; ++i) { +#if defined(TARGET_HAIKU) + snprintf(tunname, sizeof(tunname), + "/dev/%s/%d", dev, i); + snprintf(dynamic_name, sizeof(dynamic_name), + "%s/%d", dev, i); +#else snprintf(tunname, sizeof(tunname), "/dev/%s%d", dev, i); snprintf(dynamic_name, sizeof(dynamic_name), "%s%d", dev, i); +#endif 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: 2 Gerrit-Owner: kallisti5 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newpatchset --yrO5tIe0XlI= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

kallisti5 uploaded patch set #2 to this change.

<= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/687?usp=3Demail">View Chang= e

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 funct= ional :-)

Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
--= -
M configure.ac
M src/openvpn/tun.c
2 files changed, 22 insertion= s(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/open=
vpn refs/changes/87/687/2
diff --git a/configure.ac b/configure.ac<=
/span>
index 0876a6a..7f6e43d 100644
--- a/configu= re.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 ;;
+ *-*-h= aiku*)
+ AC_DEFINE([= TARGET_HAIKU], [1], [Are we running Haiku?])
+ AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H&quo= t;], [Target prefix])
+ LIBS=3D"${LIBS} -lnetwork"
+ ;;
*)
AC_DEFINE= _UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
have_tap_header=3D"yes"

diff --git a/src/ope= nvpn/tun.c b/src/openvpn/tun.c
index 85fe01a..e428fb9 10064= 4
--- a/src/openvpn/tun.c
+++ b/src/openvpn= /tun.c
@@ -1631,6 +1631,16 @@
{=
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 */<= /span>
+ /* XXX: Need= to add ifconfig_remote_netmask since right now it is just NULL */+ argv_printf(&arg= v, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH,
+ ifname, ifconfig_local, i= fconfig_remote_netmask, tun_mtu);
+
+ = argv_msg(M_INFO, &argv);
+ openvpn_execve_check(&argv, es, S_FATAL, "Haik= u 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.");
#en= dif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1919,17 @@<= /span>
{
for (int i =3D 0; i= < 256; ++i)
{
+#if defined(TARGET_HAIKU)
+ snprintf(tunname, sizeof(= tunname),
+ = "/dev/%s/%d", dev, i);
+ snprintf(dynamic_name, sizeof(d= ynamic_name),
+ = "%s/%d", dev, i);
+#else
snprintf(= tunname, sizeof(tunname),
"/= dev/%s%d", dev, i);
snprintf(dynamic_= name, sizeof(dynamic_name),
"= ;%s%d", dev, i);
+#endif
if ((tt->fd =3D open(tunname, = O_RDWR)) > 0)
{
= dynamic_opened =3D true;

= To view, visit change 687. To unsubscribe, or for help writing mail filters, vis= it settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced17= 46c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 2
Gerrit-Owner: kallisti5 <alex@...2837...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newpatchset
--yrO5tIe0XlI=--