mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-16 02:26:52 +01:00
multiport: validate the peer's port range, warn when a lane never comes up
- Ignore a lane advert with a zero base port or a range running past 65535, with a warning, instead of aiming lanes at ports that wrapped. - Warn once when a lane that has never come up misses 3 probes in a row. Until now that was silent above debug, including the common case of a firewall that only opens the base port.
This commit is contained in:
1 parent
b93c3bfed6
commit
a7e407181a
5 files changed
+100
-6
No files matched your search
@@ -732,6 +732,13 @@ func (hm *HandshakeManager) maybeAllocLanes(hostinfo *HostInfo, result *handshak
|
||||
if len(hm.f.myVpnAddrs) == 0 || len(hostinfo.vpnAddrs) == 0 {
|
||||
return
|
||||
}
|
||||
if !validLaneAdvert(result.PeerBasePort, result.PeerPortCount) {
|
||||
// Lane targets are computed in uint16, so a range like this would wrap
|
||||
// onto low ports. The tunnel itself is fine; it just gets no lanes.
|
||||
hostinfo.logger(hm.l).Warn("Ignoring multiport advert with an invalid port range",
|
||||
"peerBasePort", result.PeerBasePort, "peerPorts", result.PeerPortCount)
|
||||
return
|
||||
}
|
||||
|
||||
hostinfo.lanes = newLaneSet(result, hm.config.laneCount, hm.f.myVpnAddrs[0], hostinfo.vpnAddrs[0])
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user