mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Accept exchanging an MTU of 0 to signify that TUN/TAP is disabled, don't send traffic to a node in that case
This commit is contained in:
parent
ec371af84f
commit
ca96bbf014
3 changed files with 40 additions and 1 deletions
|
@ -280,6 +280,17 @@ func (a *admin) startTunWithMTU(ifname string, iftapmode bool, ifmtu int) error
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// If we have open sessions then we need to notify them
|
||||
// that our MTU has now changed
|
||||
for _, sinfo := range a.core.sessions.sinfos {
|
||||
if ifname == "none" {
|
||||
sinfo.myMTU = 0
|
||||
} else {
|
||||
sinfo.myMTU = uint16(ifmtu)
|
||||
}
|
||||
a.core.sessions.sendPingPong(sinfo, false)
|
||||
}
|
||||
// Aaaaand... go!
|
||||
go a.core.tun.read()
|
||||
}
|
||||
go a.core.tun.write()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue