mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2025-04-14 04:56:55 +02:00
tun: fix crash when ForceMTU is called after close
Close closes the events channel, resulting in a panic from send on closed channel. Reported-By: Brad Fitzpatrick <brad@tailscale.com> Signed-off-by: James Tucker <james@tailscale.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
1ec454f253
commit
ec8f6f82c2
1 changed files with 3 additions and 0 deletions
|
@ -127,6 +127,9 @@ 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) {
|
||||
if tun.close.Load() {
|
||||
return
|
||||
}
|
||||
update := tun.forcedMTU != mtu
|
||||
tun.forcedMTU = mtu
|
||||
if update {
|
||||
|
|
Loading…
Add table
Reference in a new issue