diff --git a/src/compat/compat.h b/src/compat/compat.h index 36e902b0..6fb156ff 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -1153,6 +1153,10 @@ static inline void dst_cache_reset_now(struct dst_cache *dst_cache) } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) +#define skb_valid_dst(a, b) skb_dst(a, b) +#endif + #if defined(ISUBUNTU1604) || defined(ISRHEL7) #include #ifndef _WG_LINUX_SIPHASH_H diff --git a/src/device.c b/src/device.c index ece4ad2d..062490f1 100644 --- a/src/device.c +++ b/src/device.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -160,7 +161,7 @@ static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev) goto err_peer; } - mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; + mtu = skb_valid_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; __skb_queue_head_init(&packets); if (!skb_is_gso(skb)) {