aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/compat
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-06-21 03:55:31 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-06-26 12:35:06 +0200
commit79a7dc4da9702d05c5085acffe1c4f9cf72c26a6 (patch)
treedf8160a06c0d7ed61a71b014b970bd8f0e8add9c /src/compat
parentcurve25519: keep certain sandy2x functions in C (diff)
downloadwireguard-monolithic-historical-79a7dc4da9702d05c5085acffe1c4f9cf72c26a6.tar.xz
wireguard-monolithic-historical-79a7dc4da9702d05c5085acffe1c4f9cf72c26a6.zip
ratelimiter: rewrite from scratch
This not only removes the depenency on x_tables, but it also gives us much better performance and memory usage. Now, systems are able to have millions of WireGuard interfaces, without having to worry about a thundering herd of garbage collection.
Diffstat (limited to 'src/compat')
-rw-r--r--src/compat/compat.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h
index 6c1bfa3..feb4347 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -11,15 +11,6 @@
#error "WireGuard requires Linux >= 3.10"
#endif
-/* These conditionals can't be enforced by an out of tree module very easily,
- * so we stick them here in compat instead. */
-#if !IS_ENABLED(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT)
-#error "WireGuard requires CONFIG_NETFILTER_XT_MATCH_HASHLIMIT."
-#endif
-#if IS_ENABLED(CONFIG_IPV6) && !IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
-#error "WireGuard requires CONFIG_IP6_NF_IPTABLES when using CONFIG_IPV6."
-#endif
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) && defined(CONFIG_X86_64)
#define CONFIG_AS_SSSE3
#endif
@@ -276,6 +267,18 @@ static inline int get_random_bytes_wait(void *buf, int nbytes)
}
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)
+#define system_power_efficient_wq system_unbound_wq
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
+#include <linux/ktime.h>
+static inline u64 ktime_get_ns(void)
+{
+ return ktime_to_ns(ktime_get());
+}
+#endif
+
/* https://lkml.org/lkml/2015/6/12/415 */
#include <linux/netdevice.h>
static inline struct net_device *netdev_pub(void *dev)