aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/device.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-10 17:38:27 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-11 15:50:21 +0200
commit7fef9f33a57ed1cf24ebb9c5f0646e95b89aa07b (patch)
treebc89e3c9363fd42ad7c6ceeb9fd8ff753fc083f2 /src/device.c
parenttools: store tail pointer to make coalescing peers fast (diff)
downloadwireguard-monolithic-historical-7fef9f33a57ed1cf24ebb9c5f0646e95b89aa07b.tar.xz
wireguard-monolithic-historical-7fef9f33a57ed1cf24ebb9c5f0646e95b89aa07b.zip
compat: move version logic to compat.h and out of main .c
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/device.c b/src/device.c
index 0fb5dcd..6b56048 100644
--- a/src/device.c
+++ b/src/device.c
@@ -28,7 +28,7 @@ static int open(struct net_device *dev)
int ret;
struct wireguard_peer *peer, *temp;
struct wireguard_device *wg = netdev_priv(dev);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
+#ifndef COMPAT_CANNOT_USE_IN6_DEV_GET
struct inet6_dev *dev_v6 = __in6_dev_get(dev);
#endif
struct in_device *dev_v4 = __in_dev_get_rtnl(dev);
@@ -41,12 +41,12 @@ static int open(struct net_device *dev)
IN_DEV_CONF_SET(dev_v4, SEND_REDIRECTS, false);
IPV4_DEVCONF_ALL(dev_net(dev), SEND_REDIRECTS) = false;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
+#ifndef COMPAT_CANNOT_USE_IN6_DEV_GET
if (dev_v6)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
- dev_v6->addr_gen_mode = IN6_ADDR_GEN_MODE_NONE;
-#else
+#ifndef COMPAT_CANNOT_USE_DEV_CNF
dev_v6->cnf.addr_gen_mode = IN6_ADDR_GEN_MODE_NONE;
+#else
+ dev_v6->addr_gen_mode = IN6_ADDR_GEN_MODE_NONE;
#endif
#endif
@@ -238,7 +238,7 @@ static void setup(struct net_device *dev)
dev->needed_tailroom = noise_encrypted_len(MESSAGE_PADDING_MULTIPLE);
dev->type = ARPHRD_NONE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
+#ifndef COMPAT_CANNOT_USE_IFF_NO_QUEUE
dev->priv_flags |= IFF_NO_QUEUE;
#else
dev->tx_queue_len = 0;