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:
Neil Alexander 2018-05-18 18:56:33 +01:00
parent ec371af84f
commit ca96bbf014
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 40 additions and 1 deletions

View file

@ -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()