diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-10 17:38:27 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-11 15:50:21 +0200 |
commit | 28c2976d6effa8787bfbfc67a5ee254d59d32e70 (patch) | |
tree | b49e293317ee87daec3be33a029ee4bb2bbeda51 /src/device.c | |
parent | f28ef15b87c54bbfd54dbc9f880fa9e09cacc756 (diff) |
compat: move version logic to compat.h and out of main .c
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/device.c')
-rw-r--r-- | src/device.c | 12 |
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; |