mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-22 16:34:25 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
249ae41fec | ||
|
|
d9cae9e062 | ||
|
|
a92056a7db | ||
|
|
4eb1da0958 |
16
CHANGELOG.md
16
CHANGELOG.md
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [1.9.2] - 2024-06-03
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Ensure messageCounter is set before handshake is complete. (#1154)
|
||||||
|
|
||||||
|
## [1.9.1] - 2024-05-29
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed a potential deadlock in GetOrHandshake. (#1151)
|
||||||
|
|
||||||
## [1.9.0] - 2024-05-07
|
## [1.9.0] - 2024-05-07
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
@@ -626,7 +638,9 @@ created.)
|
|||||||
|
|
||||||
- Initial public release.
|
- Initial public release.
|
||||||
|
|
||||||
[Unreleased]: https://github.com/slackhq/nebula/compare/v1.9.0...HEAD
|
[Unreleased]: https://github.com/slackhq/nebula/compare/v1.9.2...HEAD
|
||||||
|
[1.9.2]: https://github.com/slackhq/nebula/releases/tag/v1.9.2
|
||||||
|
[1.9.1]: https://github.com/slackhq/nebula/releases/tag/v1.9.1
|
||||||
[1.9.0]: https://github.com/slackhq/nebula/releases/tag/v1.9.0
|
[1.9.0]: https://github.com/slackhq/nebula/releases/tag/v1.9.0
|
||||||
[1.8.2]: https://github.com/slackhq/nebula/releases/tag/v1.8.2
|
[1.8.2]: https://github.com/slackhq/nebula/releases/tag/v1.8.2
|
||||||
[1.8.1]: https://github.com/slackhq/nebula/releases/tag/v1.8.1
|
[1.8.1]: https://github.com/slackhq/nebula/releases/tag/v1.8.1
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package nebula
|
package nebula
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/flynn/noise"
|
"github.com/flynn/noise"
|
||||||
@@ -321,7 +322,11 @@ func ixHandshakeStage1(f *Interface, addr *udp.Addr, via *ViaSender, packet []by
|
|||||||
}
|
}
|
||||||
|
|
||||||
f.connectionManager.AddTrafficWatch(hostinfo.localIndexId)
|
f.connectionManager.AddTrafficWatch(hostinfo.localIndexId)
|
||||||
hostinfo.ConnectionState.messageCounter.Store(2)
|
prev := hostinfo.ConnectionState.messageCounter.Swap(2)
|
||||||
|
if prev > 2 {
|
||||||
|
panic(fmt.Errorf("invalid state: messageCounter > 2 before handshake complete: %v", prev))
|
||||||
|
}
|
||||||
|
|
||||||
hostinfo.remotes.ResetBlockedRemotes()
|
hostinfo.remotes.ResetBlockedRemotes()
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -463,12 +468,15 @@ func ixHandshakeStage2(f *Interface, addr *udp.Addr, via *ViaSender, hh *Handsha
|
|||||||
// Build up the radix for the firewall if we have subnets in the cert
|
// Build up the radix for the firewall if we have subnets in the cert
|
||||||
hostinfo.CreateRemoteCIDR(remoteCert)
|
hostinfo.CreateRemoteCIDR(remoteCert)
|
||||||
|
|
||||||
|
prev := hostinfo.ConnectionState.messageCounter.Swap(2)
|
||||||
|
if prev > 2 {
|
||||||
|
panic(fmt.Errorf("invalid state: messageCounter > 2 before handshake complete: %v", prev))
|
||||||
|
}
|
||||||
|
|
||||||
// Complete our handshake and update metrics, this will replace any existing tunnels for this vpnIp
|
// Complete our handshake and update metrics, this will replace any existing tunnels for this vpnIp
|
||||||
f.handshakeManager.Complete(hostinfo, f)
|
f.handshakeManager.Complete(hostinfo, f)
|
||||||
f.connectionManager.AddTrafficWatch(hostinfo.localIndexId)
|
f.connectionManager.AddTrafficWatch(hostinfo.localIndexId)
|
||||||
|
|
||||||
hostinfo.ConnectionState.messageCounter.Store(2)
|
|
||||||
|
|
||||||
if f.l.Level >= logrus.DebugLevel {
|
if f.l.Level >= logrus.DebugLevel {
|
||||||
hostinfo.logger(f.l).Debugf("Sending %d stored packets", len(hh.packetStore))
|
hostinfo.logger(f.l).Debugf("Sending %d stored packets", len(hh.packetStore))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,10 +356,11 @@ func (hm *HandshakeManager) handleOutbound(vpnIp iputil.VpnIp, lighthouseTrigger
|
|||||||
// GetOrHandshake will try to find a hostinfo with a fully formed tunnel or start a new handshake if one is not present
|
// GetOrHandshake will try to find a hostinfo with a fully formed tunnel or start a new handshake if one is not present
|
||||||
// The 2nd argument will be true if the hostinfo is ready to transmit traffic
|
// The 2nd argument will be true if the hostinfo is ready to transmit traffic
|
||||||
func (hm *HandshakeManager) GetOrHandshake(vpnIp iputil.VpnIp, cacheCb func(*HandshakeHostInfo)) (*HostInfo, bool) {
|
func (hm *HandshakeManager) GetOrHandshake(vpnIp iputil.VpnIp, cacheCb func(*HandshakeHostInfo)) (*HostInfo, bool) {
|
||||||
// Check the main hostmap and maintain a read lock if our host is not there
|
|
||||||
hm.mainHostMap.RLock()
|
hm.mainHostMap.RLock()
|
||||||
if h, ok := hm.mainHostMap.Hosts[vpnIp]; ok {
|
h, ok := hm.mainHostMap.Hosts[vpnIp]
|
||||||
hm.mainHostMap.RUnlock()
|
hm.mainHostMap.RUnlock()
|
||||||
|
|
||||||
|
if ok {
|
||||||
// Do not attempt promotion if you are a lighthouse
|
// Do not attempt promotion if you are a lighthouse
|
||||||
if !hm.lightHouse.amLighthouse {
|
if !hm.lightHouse.amLighthouse {
|
||||||
h.TryPromoteBest(hm.mainHostMap.GetPreferredRanges(), hm.f)
|
h.TryPromoteBest(hm.mainHostMap.GetPreferredRanges(), hm.f)
|
||||||
@@ -367,7 +368,6 @@ func (hm *HandshakeManager) GetOrHandshake(vpnIp iputil.VpnIp, cacheCb func(*Han
|
|||||||
return h, true
|
return h, true
|
||||||
}
|
}
|
||||||
|
|
||||||
defer hm.mainHostMap.RUnlock()
|
|
||||||
return hm.StartHandshake(vpnIp, cacheCb), false
|
return hm.StartHandshake(vpnIp, cacheCb), false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user