]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
tun: windows: send MTU update when forced MTU changes
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 5 May 2021 09:42:45 +0000 (11:42 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 5 May 2021 09:42:45 +0000 (11:42 +0200)
Otherwise the padding doesn't get updated.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
tun/tun_windows.go

index c8b8d39cb2445d78658ea7993b10e6910872701e..70f0aa3ab86dc7bea0ae402747e5842e587300f8 100644 (file)
@@ -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.