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
|
@ -65,7 +65,7 @@ func (s *sessionInfo) update(p *sessionPing) bool {
|
|||
s.theirNonce = boxNonce{}
|
||||
s.nonceMask = 0
|
||||
}
|
||||
if p.mtu >= 1280 {
|
||||
if p.mtu >= 1280 || p.mtu == 0 {
|
||||
s.theirMTU = p.mtu
|
||||
}
|
||||
s.coords = append([]byte{}, p.coords...)
|
||||
|
@ -313,6 +313,9 @@ func (n *boxNonce) minus(m *boxNonce) int64 {
|
|||
}
|
||||
|
||||
func (sinfo *sessionInfo) getMTU() uint16 {
|
||||
if sinfo.theirMTU == 0 || sinfo.myMTU == 0 {
|
||||
return 0
|
||||
}
|
||||
if sinfo.theirMTU < sinfo.myMTU {
|
||||
return sinfo.theirMTU
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue