[Openvpn-devel,v1] Haiku: Fix short interface path length

Message ID 20250128124026.108992-1-frank@lichtenheld.com
State Accepted
Headers show
Series [Openvpn-devel,v1] Haiku: Fix short interface path length | expand

Commit Message

Frank Lichtenheld Jan. 28, 2025, 12:40 p.m. UTC
From: Alexander von Gluck <alex@terarocket.io>

* Haiku uses full paths for interface names, 16 characters
  isn't enough.

Change-Id: I6de60ed5c03ea45e1d7a3f7777bfc8ed5075e84d
Signed-off-by: Alexander von Gluck <alex@terarocket.io>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/689
This mail reflects revision 1 of this Change.

Signed-off-by line for the author was added as per our policy.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <frank@lichtenheld.com>

Comments

Gert Doering Jan. 28, 2025, 7:05 p.m. UTC | #1
I'm not totally happy with another #ifdef added to that already-not-so-nice
#orgy, but I see no more elegant way.  One might consider to move the
#define IFNAMSIZ further up, and use it in the "iface[16]" definition
(getting rid of one #ifdef)...  but that's somewhat outside the scope
of this patch, so maybe I'll give it a go ;-)

Your patch has been applied to the master branch.

commit 34f302247c865827b7075422e32c272a203783cb
Author: Alexander von Gluck
Date:   Tue Jan 28 13:40:26 2025 +0100

     Haiku: Fix short interface path length

     Signed-off-by: Alexander von Gluck <alex@terarocket.io>
     Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
     Message-Id: <20250128124026.108992-1-frank@lichtenheld.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30654.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/route.h b/src/openvpn/route.h
index 421e7d2..69b06b8 100644
--- a/src/openvpn/route.h
+++ b/src/openvpn/route.h
@@ -155,6 +155,8 @@ 
     /* gateway interface */
 #ifdef _WIN32
     DWORD adapter_index; /* interface or ~0 if undefined */
+#elif defined(TARGET_HAIKU)
+    char iface[PATH_MAX]; /* iface names are full /dev path with driver name */
 #else
     char iface[16]; /* interface name (null terminated), may be empty */
 #endif
@@ -186,8 +188,13 @@ 
 #else
     /* non linux platform don't have this constant defined */
 #ifndef IFNAMSIZ
+#if defined(TARGET_HAIKU)
+/* iface names are full /dev path with driver name */
+#define IFNAMSIZ PATH_MAX
+#else
 #define IFNAMSIZ 16
 #endif
+#endif
     char iface[IFNAMSIZ]; /* interface name (null terminated), may be empty */
 #endif