From: Jason A. Donenfeld Date: Wed, 5 May 2021 09:42:45 +0000 (+0200) Subject: tun: windows: send MTU update when forced MTU changes X-Git-Tag: 0.0.20211016~42 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=69a42a4eefc78c2a2e36842fcb26d906101cdae0;p=thirdparty%2Fwireguard-go.git tun: windows: send MTU update when forced MTU changes Otherwise the padding doesn't get updated. Signed-off-by: Jason A. Donenfeld --- 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.