@@ -368,6 +368,11 @@
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])
+ LIBS="${LIBS} -lnetwork"
+ ;;
*)
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
have_tap_header="yes"
@@ -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 or use an --up script.");
#endif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1919,17 @@
{
for (int i = 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 = open(tunname, O_RDWR)) > 0)
{
dynamic_opened = true;