From: "cron2 (Code Review)" Date: Fri, 1 Aug 2025 13:31:07 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., ralf@...2726..., antonio@...2726... Message-ID: <76af512af16c2d598ecb84d4bb69017443e87db9-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="rzQwfuXpzpU="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[release/2.6]: dco linux: avoid redefining ovpn enums (2.6) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: ralf_lici , plaisthos , openvpn-devel --rzQwfuXpzpU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/11= 22?usp=3Demail ) Change subject: dco linux: avoid redefining ovpn enums (2.6) ...................................................................... dco linux: avoid redefining ovpn enums (2.6) 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. This is the port to release/2.6 based on commit 1d3c2b67a73a0aa011c13e62f876d24e49d41df0. Change-Id: I41c5dfc7489352a9534ff6b1585a5a81e0623ab1 Signed-off-by: Frank Lichtenheld Acked-by: Antonio Quartulli Message-Id: <20250801130302.372311-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 470.html Signed-off-by: Gert Doering --- M src/openvpn/dco_linux.h M src/openvpn/ovpn_dco_linux.h 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/openvpn/dco_linux.h b/src/openvpn/dco_linux.h index 511519a..5179912 100644 --- a/src/openvpn/dco_linux.h +++ b/src/openvpn/dco_linux.h @@ -26,11 +26,13 @@ #include "event.h" -#include "ovpn_dco_linux.h" - #include #include +/* include last since we need to behave differently if the kernel headers + * are from 6.16+ */ +#include "ovpn_dco_linux.h" + typedef enum ovpn_key_slot dco_key_slot_t; typedef enum ovpn_cipher_alg dco_cipher_t; diff --git a/src/openvpn/ovpn_dco_linux.h b/src/openvpn/ovpn_dco_linux.h index 73e19b5..34abc6a 100644 --- a/src/openvpn/ovpn_dco_linux.h +++ b/src/openvpn/ovpn_dco_linux.h @@ -237,14 +237,17 @@ OVPN_PACKET_ATTR_MAX =3D __OVPN_PACKET_ATTR_AFTER_LAST - 1, }; +#ifndef IFLA_OVPN_MAX + enum ovpn_ifla_attrs { IFLA_OVPN_UNSPEC =3D 0, IFLA_OVPN_MODE, - __IFLA_OVPN_AFTER_LAST, - IFLA_OVPN_MAX =3D __IFLA_OVPN_AFTER_LAST - 1, + __IFLA_OVPN_MAX, }; +#define IFLA_OVPN_MAX (__IFLA_OVPN_MAX - 1) + enum ovpn_mode { __OVPN_MODE_FIRST =3D 0, OVPN_MODE_P2P =3D __OVPN_MODE_FIRST, @@ -253,4 +256,6 @@ __OVPN_MODE_AFTER_LAST, }; +#endif /* ifndef IFLA_OVPN_MAX */ + #endif /* _UAPI_LINUX_OVPN_DCO_H_ */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1122?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: I41c5dfc7489352a9534ff6b1585a5a81e0623ab1 Gerrit-Change-Number: 1122 Gerrit-PatchSet: 3 Gerrit-Owner: flichtenheld Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-Reviewer: ralf_lici Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --rzQwfuXpzpU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

dco linux: avoid redefining ovpn enums (2.6)<=
br>
Starting with Linux kernel version 6.16, a couple of ovpn-related en= um
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 en= sures that enum redefinitions are avoided by conditionally
using the exi= sting definitions from the system header when available.

This is the= port to release/2.6 based on commit
1d3c2b67a73a0aa011c13e62f876d24e49d= 41df0.

Change-Id: I41c5dfc7489352a9534ff6b1585a5a81e0623ab1
Signe= d-off-by: Frank Lichtenheld <frank@...2641...>
Acked-by: Antonio Q= uartulli <antonio@...2726...>
Message-Id: <20250801130302.37231= 1-1-frank@...2641...>
URL: https://www.mail-archive.com/openvpn-devel= @lists.sourceforge.net/msg32470.html
Signed-off-by: Gert Doering <ger= t@...1296...>
---
M src/openvpn/dco_linux.h
M src/openvpn/ovpn_= dco_linux.h
2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/openvpn/dco_linux.h b/src/openvpn/dco_linux.hindex 511519a..5179912 100644
--- a/src/openvpn/dco_= linux.h
+++ b/src/openvpn/dco_linux.h
@@ -2= 6,11 +26,13 @@

#include "event.h&qu= ot;

-= #include "ovpn_dco_linux.h"
-
#include <netlink/socket.h><= br> #include <netlink/netlink.h>

+/* include last since we need to= behave differently if the kernel headers
+ * are from 6.16+ */
+#include "ovpn_dco_linux.h"
+
typedef enum ovp= n_key_slot dco_key_slot_t;
typedef enum ovpn_cipher_alg dc= o_cipher_t;

diff --git a/src/openvpn/ovpn= _dco_linux.h b/src/openvpn/ovpn_dco_linux.h
index 73e19b5..= 34abc6a 100644
--- a/src/openvpn/ovpn_dco_linux.h+++ b/src/openvpn/ovpn_dco_linux.h
@@ -237,14 +237,1= 7 @@
OVPN_PACKET_ATTR_MAX =3D __OVPN_PACKET_ATTR_AFTER_LA= ST - 1,
};

+#ifndef IFLA_OVPN_MAX
+
enum ovpn_ifla_attrs {=
IFLA_OVPN_UNSPEC =3D 0,
IFLA_OVPN_MODE,

- __IFLA_O= VPN_AFTER_LAST,
- IFLA_= OVPN_MAX =3D __IFLA_OVPN_AFTER_LAST - 1,
+ __IFLA_OVPN_MAX,
};
=
+#define IFLA_OVPN_= MAX (__IFLA_OVPN_MAX - 1)
+
enum ovpn_mode {
__OVPN_MODE_FIRS= T =3D 0,
OVPN_MODE_P2P =3D __OVPN_MODE_FIRST,
<= span>@@ -253,4 +256,6 @@

__OVPN_MODE_AFTER_LAST, };

+#endif /* ifndef IFLA_OVPN_MAX */
+
#endif /* _UAPI_LINUX_OVPN_DCO_H_= */

To view, visit change 1122. To unsubscr= ibe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I41c5dfc7489352a9534ff6b1585= a5a81e0623ab1
Gerrit-Change-Number: 1122
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-Reviewer: ralf_lici <ralf@...2726...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--rzQwfuXpzpU=--