mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-07 16:17:41 +00:00
ipn/ipnlocal: update routes on link change with ExitNodeAllowLANAccess
On a major link change the LAN routes may change, so on linkChange where ChangeDelta.Major, we need to call authReconfig to ensure that new routes are observed and applied. Updates tailscale/corp#22574 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
b78df4d48a
commit
8af50fa97c
@ -712,14 +712,26 @@ func (b *LocalBackend) linkChange(delta *netmon.ChangeDelta) {
|
|||||||
if delta.Major && shouldAutoExitNode() {
|
if delta.Major && shouldAutoExitNode() {
|
||||||
b.refreshAutoExitNode = true
|
b.refreshAutoExitNode = true
|
||||||
}
|
}
|
||||||
// If the PAC-ness of the network changed, reconfig wireguard+route to
|
|
||||||
// add/remove subnets.
|
var needReconfig bool
|
||||||
|
// If the network changed and we're using an exit node and allowing LAN access, we may need to reconfigure.
|
||||||
|
if delta.Major && b.pm.CurrentPrefs().ExitNodeID() != "" && b.pm.CurrentPrefs().ExitNodeAllowLANAccess() {
|
||||||
|
b.logf("linkChange: in state %v; updating LAN routes", b.state)
|
||||||
|
needReconfig = true
|
||||||
|
}
|
||||||
|
// If the PAC-ness of the network changed, reconfig wireguard+route to add/remove subnets.
|
||||||
if hadPAC != ifst.HasPAC() {
|
if hadPAC != ifst.HasPAC() {
|
||||||
b.logf("linkChange: in state %v; PAC changed from %v->%v", b.state, hadPAC, ifst.HasPAC())
|
b.logf("linkChange: in state %v; PAC changed from %v->%v", b.state, hadPAC, ifst.HasPAC())
|
||||||
|
needReconfig = true
|
||||||
|
}
|
||||||
|
if needReconfig {
|
||||||
switch b.state {
|
switch b.state {
|
||||||
case ipn.NoState, ipn.Stopped:
|
case ipn.NoState, ipn.Stopped:
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
default:
|
default:
|
||||||
|
// TODO(raggi,tailscale/corp#22574): authReconfig should be refactored such that we can call the
|
||||||
|
// necessary operations here and avoid the need for asynchronous behavior that is racy and hard
|
||||||
|
// to test here, and do less extra work in these conditions.
|
||||||
go b.authReconfig()
|
go b.authReconfig()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user