diff --git a/CHANGELOG.md b/CHANGELOG.md index 99c0c4b4d4c..53bda2b7882 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,11 @@ - Code reorganisation, a lot of code has moved, please review the following PRs accordingly [#1444](https://github.com/juanfont/headscale/pull/1444) -## 0.22.3-rr (2023-XX-XX) +## 0.22.4-rr (2024-XX-XX) +### Fixed +- Subnet failover handler checks for user ID when finding new primary route +## 0.22.3-rr (2023-XX-28) ### Changes - Set max open and idle connections for postgres - Allows conflicting subnet ranges across users diff --git a/hscontrol/routes.go b/hscontrol/routes.go index 84bd6a18dae..2b38140784e 100644 --- a/hscontrol/routes.go +++ b/hscontrol/routes.go @@ -5,10 +5,11 @@ import ( "fmt" "net/netip" - v1 "github.com/juanfont/headscale/gen/go/headscale/v1" "github.com/rs/zerolog/log" "google.golang.org/protobuf/types/known/timestamppb" "gorm.io/gorm" + + v1 "github.com/juanfont/headscale/gen/go/headscale/v1" ) const ( @@ -211,7 +212,7 @@ func (h *Headscale) isUniquePrefix(route Route) bool { for _, r := range routes { // Return false, if there are more than one uniquePrefix for the same // user. Else, true. This allows having the same prefix for two users. - if route.Machine.UserID == r.Machine.UserID && route.Machine.isOnline() { + if route.Machine.UserID == r.Machine.UserID && r.Machine.isOnline() { return false } } @@ -367,7 +368,7 @@ func (h *Headscale) handlePrimarySubnetFailover() error { var newPrimaryRoute *Route for pos, r := range newPrimaryRoutes { - if r.Machine.isOnline() { + if r.Machine.UserID == route.Machine.UserID && r.Machine.isOnline() { newPrimaryRoute = &newPrimaryRoutes[pos] break