Skip to content

Commit 1fbbe91

Browse files
flichtenheldcron2
authored andcommitted
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 1d3c2b6. Change-Id: I41c5dfc7489352a9534ff6b1585a5a81e0623ab1 Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Antonio Quartulli <[email protected]> Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg32470.html Signed-off-by: Gert Doering <[email protected]>
1 parent abd2e52 commit 1fbbe91

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/openvpn/dco_linux.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626

2727
#include "event.h"
2828

29-
#include "ovpn_dco_linux.h"
30-
3129
#include <netlink/socket.h>
3230
#include <netlink/netlink.h>
3331

32+
/* include last since we need to behave differently if the kernel headers
33+
* are from 6.16+ */
34+
#include "ovpn_dco_linux.h"
35+
3436
typedef enum ovpn_key_slot dco_key_slot_t;
3537
typedef enum ovpn_cipher_alg dco_cipher_t;
3638

src/openvpn/ovpn_dco_linux.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,17 @@ enum ovpn_netlink_packet_attrs {
237237
OVPN_PACKET_ATTR_MAX = __OVPN_PACKET_ATTR_AFTER_LAST - 1,
238238
};
239239

240+
#ifndef IFLA_OVPN_MAX
241+
240242
enum ovpn_ifla_attrs {
241243
IFLA_OVPN_UNSPEC = 0,
242244
IFLA_OVPN_MODE,
243245

244-
__IFLA_OVPN_AFTER_LAST,
245-
IFLA_OVPN_MAX = __IFLA_OVPN_AFTER_LAST - 1,
246+
__IFLA_OVPN_MAX,
246247
};
247248

249+
#define IFLA_OVPN_MAX (__IFLA_OVPN_MAX - 1)
250+
248251
enum ovpn_mode {
249252
__OVPN_MODE_FIRST = 0,
250253
OVPN_MODE_P2P = __OVPN_MODE_FIRST,
@@ -253,4 +256,6 @@ enum ovpn_mode {
253256
__OVPN_MODE_AFTER_LAST,
254257
};
255258

259+
#endif /* ifndef IFLA_OVPN_MAX */
260+
256261
#endif /* _UAPI_LINUX_OVPN_DCO_H_ */

0 commit comments

Comments
 (0)