summaryrefslogtreecommitdiffstatshomepage
path: root/src/compat.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-11-04 03:38:54 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-11-04 03:38:54 +0100
commitc62e2b8f94734246b5381d67186d80b1d7d82e64 (patch)
tree516cd07c35b3a278f11e6a71f22c88c03b21cf80 /src/compat.h
parentsocket: use dst_cache instead of handrolled cache (diff)
downloadwireguard-monolithic-historical-c62e2b8f94734246b5381d67186d80b1d7d82e64.tar.xz
wireguard-monolithic-historical-c62e2b8f94734246b5381d67186d80b1d7d82e64.zip
compat: stub out dst_cache for old kernels
Diffstat (limited to 'src/compat.h')
-rw-r--r--src/compat.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/compat.h b/src/compat.h
index 6663ec6..6d9c0e2 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -126,6 +126,20 @@ __attribute__((unused)) static inline int udp_sock_create_new(struct net *net, s
#define time_is_after_eq_jiffies64(a) time_before_eq64(get_jiffies_64(), a)
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+struct dst_cache { };
+static inline struct dst_entry *dst_cache_get(struct dst_cache *dst_cache) { return NULL; }
+static inline struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr) { return NULL; }
+static inline void dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst, __be32 saddr) { }
+#if IS_ENABLED(CONFIG_IPV6)
+static inline void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst, const struct in6_addr *addr) { }
+static inline struct dst_entry *dst_cache_get_ip6(struct dst_cache *dst_cache, struct in6_addr *saddr) { return NULL; }
+#endif
+static inline void dst_cache_reset(struct dst_cache *dst_cache) { }
+static inline int dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp) { return 0; }
+static inline void dst_cache_destroy(struct dst_cache *dst_cache) { }
+#endif
+
/* https://lkml.org/lkml/2015/6/12/415 */
#include <linux/netdevice.h>
static inline struct net_device *netdev_pub(void *dev)