fix(routes): ensure routes are correctly propagated
When using Tailscale v1.34.1, enabling or disabling a route does not effectively add or remove the route from the node's routing table. We must restart tailscale on the node to have a netmap update. Fix this by refreshing last state change so that a netmap diff is sent. Also do not include secondary routes in allowedIPs, otherwise secondary routes might be used by nodes instead of the primary route. Signed-off-by: Fatih Acar <facar@scaleway.com>
This commit is contained in:
parent
91900b7310
commit
2afba0233b
2 changed files with 10 additions and 7 deletions
|
@ -215,6 +215,7 @@ func (h *Headscale) handlePrimarySubnetFailover() error {
|
|||
log.Error().Err(err).Msg("error getting routes")
|
||||
}
|
||||
|
||||
routesChanged := false
|
||||
for pos, route := range routes {
|
||||
if route.isExitRoute() {
|
||||
continue
|
||||
|
@ -235,6 +236,7 @@ func (h *Headscale) handlePrimarySubnetFailover() error {
|
|||
return err
|
||||
}
|
||||
|
||||
routesChanged = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -306,9 +308,14 @@ func (h *Headscale) handlePrimarySubnetFailover() error {
|
|||
|
||||
return err
|
||||
}
|
||||
|
||||
routesChanged = true
|
||||
}
|
||||
}
|
||||
|
||||
if routesChanged {
|
||||
h.setLastStateChangeToNow()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue