aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-05-05 11:42:45 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2021-05-05 11:42:45 +0200
commit69a42a4eefc78c2a2e36842fcb26d906101cdae0 (patch)
tree87de90db7478260e5ba56365118ab986785a210d
parenttun: windows: protect reads from closing (diff)
downloadwireguard-go-69a42a4eefc78c2a2e36842fcb26d906101cdae0.tar.xz
wireguard-go-69a42a4eefc78c2a2e36842fcb26d906101cdae0.zip
tun: windows: send MTU update when forced MTU changes
Otherwise the padding doesn't get updated. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--tun/tun_windows.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go
index c8b8d39..70f0aa3 100644
--- a/tun/tun_windows.go
+++ b/tun/tun_windows.go
@@ -148,7 +148,11 @@ func (tun *NativeTun) MTU() (int, error) {
// TODO: This is a temporary hack. We really need to be monitoring the interface in real time and adapting to MTU changes.
func (tun *NativeTun) ForceMTU(mtu int) {
+ update := tun.forcedMTU != mtu
tun.forcedMTU = mtu
+ if update {
+ tun.events <- EventMTUUpdate
+ }
}
// Note: Read() and Write() assume the caller comes only from a single thread; there's no locking.