From 9e7c6d4dce8b87d40cea537fd0b035a2612580e3 Mon Sep 17 00:00:00 2001
From: Guus Sliepen <guus@tinc-vpn.org>
Date: Mon, 23 Oct 2017 21:10:20 +0200
Subject: [PATCH] Disable PMTU discovery when TCPOnly is used.

---
 src/net_setup.c     | 2 +-
 src/protocol_auth.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/net_setup.c b/src/net_setup.c
index 314fd716..49ea31b6 100644
--- a/src/net_setup.c
+++ b/src/net_setup.c
@@ -583,7 +583,7 @@ bool setup_myself_reloadable(void) {
 		free(fmode);
 	}
 
-	choice = true;
+	choice = !(myself->options & OPTION_TCPONLY);
 	get_config_bool(lookup_config(config_tree, "PMTUDiscovery"), &choice);
 
 	if(choice) {
diff --git a/src/protocol_auth.c b/src/protocol_auth.c
index 68dd0717..56ff3b12 100644
--- a/src/protocol_auth.c
+++ b/src/protocol_auth.c
@@ -801,7 +801,7 @@ bool send_ack(connection_t *c) {
 		c->options |= OPTION_TCPONLY | OPTION_INDIRECT;
 	}
 
-	if(myself->options & OPTION_PMTU_DISCOVERY) {
+	if(myself->options & OPTION_PMTU_DISCOVERY && !(c->options & OPTION_TCPONLY)) {
 		c->options |= OPTION_PMTU_DISCOVERY;
 	}
 
-- 
2.39.5