File 0001-dco-linux-avoid-redefining-ovpn-enums.patch of Package openvpn

From: Ralf Lici <ralf@mandelbit.com>
Date: Mon, 23 Jun 2025 16:07:43 +0200
Subject: dco linux: avoid redefining ovpn enums
References: bsc#1239783
Git-repo: https://github.com/OpenVPN/openvpn.git
Git-commit: 1d3c2b67a73a0aa011c13e62f876d24e49d41df0
Patch-mainline: 2.7

Starting with Linux kernel version 6.16, a couple of ovpn-related enum
definitions were introduced in the `include/uapi/linux/if_link.h`
header. Redefining them in openvpn when they are already present in the
system headers can lead to conflicts or build issues.

This commit ensures that enum redefinitions are avoided by conditionally
using the existing definitions from the system header when available.

Change-Id: I4fa2d578f9c0a5a8aa24ca1d396102ef2ed9a425
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Message-Id: <20250623140748.13960-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31961.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 src/openvpn/dco_linux.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/openvpn/dco_linux.h b/src/openvpn/dco_linux.h
index 273a6ada1291..4e441ec77490 100644
--- a/src/openvpn/dco_linux.h
+++ b/src/openvpn/dco_linux.h
@@ -40,6 +40,8 @@ typedef enum ovpn_cipher_alg dco_cipher_t;
 
 /* OVPN section */
 
+#ifndef IFLA_OVPN_MAX
+
 enum ovpn_mode {
     OVPN_MODE_P2P,
     OVPN_MODE_MP,
@@ -49,10 +51,13 @@ enum ovpn_ifla_attrs {
     IFLA_OVPN_UNSPEC = 0,
     IFLA_OVPN_MODE,
 
-    __IFLA_OVPN_AFTER_LAST,
-    IFLA_OVPN_MAX = __IFLA_OVPN_AFTER_LAST - 1,
+    __IFLA_OVPN_MAX,
 };
 
+#define IFLA_OVPN_MAX (__IFLA_OVPN_MAX - 1)
+
+#endif /* ifndef IFLA_OVPN_MAX */
+
 typedef struct
 {
     struct nl_sock *nl_sock;
-- 
2.50.1

openSUSE Build Service is sponsored by