From 6f136a3a85386ff0a3560d9806ba571659fb36b5 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 21 Nov 2017 16:28:44 +0100 Subject: compat: new kernels have netlink fixes --- src/compat/compat.h | 21 +++++++++------------ src/tests/qemu/Makefile | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/compat/compat.h b/src/compat/compat.h index 2218ba0..5f2a867 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -451,32 +451,29 @@ static inline struct nlattr **genl_family_attrbuf(const struct genl_family *fami #define COMPAT_CANNOT_USE_GENL_NOPS #endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 2) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 16) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 65) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 101) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 84) +#define ___COMPAT_NETLINK_DUMP_BLOCK { int ret; skb->end -= nlmsg_total_size(sizeof(int)); ret = get_device_dump_real(skb, cb); skb->end += nlmsg_total_size(sizeof(int)); return ret; } +#define ___COMPAT_NETLINK_DUMP_OVERRIDE +#else +#define ___COMPAT_NETLINK_DUMP_BLOCK return get_device_dump_real(skb, cb); +#endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 14) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 63) #define get_device_dump(a, b) get_device_dump_real(a, b); \ static int get_device_dump(a, b) { \ - int ret; \ struct wireguard_device *wg = (struct wireguard_device *)cb->args[0]; \ if (!wg) { \ int ret = get_device_start(cb); \ if (ret) \ return ret; \ } \ - /* https://patchwork.kernel.org/patch/10046511/ */ \ - skb->end -= nlmsg_total_size(sizeof(int)); \ - ret = get_device_dump_real(skb, cb); \ - skb->end += nlmsg_total_size(sizeof(int)); \ - return ret; \ + ___COMPAT_NETLINK_DUMP_BLOCK \ } \ static int get_device_dump_real(a, b) #define COMPAT_CANNOT_USE_NETLINK_START -#else /* https://patchwork.kernel.org/patch/10046511/ */ +#elif defined(___COMPAT_NETLINK_DUMP_OVERRIDE) #define get_device_dump(a, b) get_device_dump_real(a, b); \ static int get_device_dump(a, b) { \ - int ret; \ - skb->end -= nlmsg_total_size(sizeof(int)); \ - ret = get_device_dump_real(skb, cb); \ - skb->end += nlmsg_total_size(sizeof(int)); \ - return ret; \ + ___COMPAT_NETLINK_DUMP_BLOCK \ } \ static int get_device_dump_real(a, b) #endif diff --git a/src/tests/qemu/Makefile b/src/tests/qemu/Makefile index 32c0cf1..2f288a5 100644 --- a/src/tests/qemu/Makefile +++ b/src/tests/qemu/Makefile @@ -10,7 +10,7 @@ endif ARCH := $(firstword $(subst -, ,$(CBUILD))) # Set these from the environment to override -KERNEL_VERSION ?= 4.14 +KERNEL_VERSION ?= 4.14.1 BUILD_PATH ?= $(PWD)/../../../qemu-build/$(ARCH) DISTFILES_PATH ?= $(PWD)/distfiles DEBUG_KERNEL ?= no -- cgit v1.2.3-59-g8ed1b