aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJoe Holden <jwh@zorins.us>2019-05-07 17:30:31 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-12 20:18:27 +0200
commit8416093498ac2c754536dad4757c5d86c9ba8809 (patch)
treec7de2a8d6bb6579952f6eaa17fd794900bc7dcf0
parentcontrib: add windows pipe example (diff)
downloadwireguard-monolithic-historical-8416093498ac2c754536dad4757c5d86c9ba8809.tar.xz
wireguard-monolithic-historical-8416093498ac2c754536dad4757c5d86c9ba8809.zip
socket: set ignore_df=1 on xmit
This allows the kernel to generate ipv6 fragments. Apply the same to ipv4 for consistency. Signed-off-by: Joe Holden <jwh@zorins.us>
-rw-r--r--src/compat/compat.h3
-rw-r--r--src/socket.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h
index 6ee3ac8..e8fa1ab 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -778,6 +778,9 @@ struct __kernel_timespec {
#define skb_probe_transport_header(a) skb_probe_transport_header(a, 0)
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) && !defined(ISRHEL7)
+#define ignore_df local_df
+#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
/* Note that all intentional uses of the non-_bh variety need to explicitly
diff --git a/src/socket.c b/src/socket.c
index 5a77b0c..d4f65bb 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -86,6 +86,8 @@ static int send4(struct wg_device *wg, struct sk_buff *skb,
if (cache)
dst_cache_set_ip4(cache, &rt->dst, fl.saddr);
}
+
+ skb->ignore_df = 1;
udp_tunnel_xmit_skb(rt, sock, skb, fl.saddr, fl.daddr, ds,
ip4_dst_hoplimit(&rt->dst), 0, fl.fl4_sport,
fl.fl4_dport, false, false);
@@ -157,6 +159,7 @@ static int send6(struct wg_device *wg, struct sk_buff *skb,
dst_cache_set_ip6(cache, dst, &fl.saddr);
}
+ skb->ignore_df = 1;
udp_tunnel6_xmit_skb(dst, sock, skb, skb->dev, &fl.saddr, &fl.daddr, ds,
ip6_dst_hoplimit(dst), 0, fl.fl6_sport,
fl.fl6_dport, false);