diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-11-21 16:28:44 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-11-22 18:32:48 +0100 |
commit | be6c54f59adff7dabcd03ecfa9858b6de4745ca5 (patch) | |
tree | c80e3d87dd38ccede7b111a94f5c0ede16102361 | |
parent | 1e14e9ad9e68afe4dcb301d6d465c377fdc5388d (diff) |
compat: new kernels have netlink fixes
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/compat/compat.h | 21 | ||||
-rw-r--r-- | src/tests/qemu/Makefile | 2 |
2 files changed, 10 insertions, 13 deletions
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 |