update version/firewall in use if changed on checkin (#2335)

This commit is contained in:
Matthew R Kasun 2023-05-30 23:40:05 -04:00 committed by GitHub
parent 47edf65b1f
commit 6f11eb2bb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -428,6 +428,15 @@ func handleHostCheckin(h, currentHost *models.Host) bool {
for i := range h.Interfaces {
h.Interfaces[i].AddressString = h.Interfaces[i].Address.String()
}
/// version or firewall in use change does not require a peerUpdate
if h.Version != currentHost.Version || h.FirewallInUse != currentHost.FirewallInUse {
currentHost.FirewallInUse = h.FirewallInUse
currentHost.Version = h.Version
if err := logic.UpsertHost(currentHost); err != nil {
logger.Log(0, "failed to update host after check-in", h.Name, h.ID.String(), err.Error())
return false
}
}
ifaceDelta := len(h.Interfaces) != len(currentHost.Interfaces) ||
!h.EndpointIP.Equal(currentHost.EndpointIP) ||
(len(h.NatType) > 0 && h.NatType != currentHost.NatType) ||