aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/compat/compat.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-02-17 04:55:11 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-02-17 04:58:43 +0100
commiteb433d8bfd4c329f4a0dd192eee1946f13ed91c8 (patch)
tree469d71fd0d9c940c055b3852fd41b5d1854ba87c /src/compat/compat.h
parentcompat: ipv6_stub is sometimes null (diff)
downloadwireguard-linux-compat-eb433d8bfd4c329f4a0dd192eee1946f13ed91c8.tar.xz
wireguard-linux-compat-eb433d8bfd4c329f4a0dd192eee1946f13ed91c8.zip
compat: backport ALIGN_DOWN
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/compat/compat.h')
-rw-r--r--src/compat/compat.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h
index ae3189f..e08edca 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -766,6 +766,13 @@ struct __kernel_timespec {
#endif
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
+#include <linux/kernel.h>
+#ifndef ALIGN_DOWN
+#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
+#endif
+#endif
+
/* https://github.com/ClangBuiltLinux/linux/issues/7 */
#if defined( __clang__) && (!defined(CONFIG_CLANG_VERSION) || CONFIG_CLANG_VERSION < 80000)
#include <linux/bug.h>