Skip to content

Commit 30869ea

Browse files
authored
Merge pull request #3537 from gravitl/v1.0.0_fixes
set location if empty on checkin
2 parents 070eed8 + e65f672 commit 30869ea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mq/handlers.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func HandleHostCheckin(h, currentHost *models.Host) bool {
281281
(h.ListenPort != 0 && h.ListenPort != currentHost.ListenPort) ||
282282
(h.WgPublicListenPort != 0 && h.WgPublicListenPort != currentHost.WgPublicListenPort) || (!h.EndpointIPv6.Equal(currentHost.EndpointIPv6))
283283
if ifaceDelta { // only save if something changes
284-
if !h.EndpointIP.Equal(currentHost.EndpointIP) || !h.EndpointIPv6.Equal(currentHost.EndpointIPv6) {
284+
if !h.EndpointIP.Equal(currentHost.EndpointIP) || !h.EndpointIPv6.Equal(currentHost.EndpointIPv6) || currentHost.Location == "" {
285285
if h.EndpointIP != nil {
286286
h.Location = logic.GetHostLocInfo(h.EndpointIP.String(), os.Getenv("IP_INFO_TOKEN"))
287287
} else if h.EndpointIPv6 != nil {
@@ -293,6 +293,9 @@ func HandleHostCheckin(h, currentHost *models.Host) bool {
293293
currentHost.Interfaces = h.Interfaces
294294
currentHost.DefaultInterface = h.DefaultInterface
295295
currentHost.NatType = h.NatType
296+
if h.Location != "" {
297+
currentHost.Location = h.Location
298+
}
296299
if h.ListenPort != 0 {
297300
currentHost.ListenPort = h.ListenPort
298301
}

0 commit comments

Comments
 (0)