From f2168aa1713c8fae8f407cae838bab42adb07ed3 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 21 Dec 2017 00:42:30 +0100 Subject: compat: kernels < 3.13 modified genl_ops --- src/compat/compat.h | 3 ++- src/netlink.c | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/compat/compat.h b/src/compat/compat.h index 859d417..7bd3e50 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -468,7 +468,8 @@ static inline struct nlattr **genl_family_attrbuf(const struct genl_family *fami #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) #include #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) && !defined(ISRHEL7) -#define genl_register_family(a) genl_register_family_with_ops(a, (struct genl_ops *)genl_ops, ARRAY_SIZE(genl_ops)) +#define genl_register_family(a) genl_register_family_with_ops(a, genl_ops, ARRAY_SIZE(genl_ops)) +#define COMPAT_CANNOT_USE_CONST_GENL_OPS #else #define genl_register_family(a) genl_register_family_with_ops(a, genl_ops) #endif diff --git a/src/netlink.c b/src/netlink.c index 6abdab0..b703b17 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -468,7 +468,12 @@ out_nodev: return ret; } -static const struct genl_ops genl_ops[] = { +#ifndef COMPAT_CANNOT_USE_CONST_GENL_OPS +static const +#else +static +#endif +struct genl_ops genl_ops[] = { { .cmd = WG_CMD_GET_DEVICE, #ifndef COMPAT_CANNOT_USE_NETLINK_START -- cgit v1.2.3-59-g8ed1b