Skip to content

Commit a42d165

Browse files
committed
ipn/proxies: force refresh protos conditionally
1 parent afdb151 commit a42d165

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

intra/ipn/proxies.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ type Proxies interface {
215215
ProxyProvider
216216
Rpn
217217
// RefreshProto broadcasts proto change to all active proxies.
218-
RefreshProto(l3 string, mtu int)
218+
RefreshProto(l3 string, mtu int, force bool)
219219
// LiveProxies returns a csv of active proxies.
220220
LiveProxies() string
221221
// Reverser sets the reverse proxy for all proxies.
@@ -989,13 +989,13 @@ func (px *proxifier) LiveProxies() string {
989989
}
990990

991991
// RefreshProto implements x.Proxies.
992-
func (px *proxifier) RefreshProto(l3 string, mtu int) {
992+
func (px *proxifier) RefreshProto(l3 string, mtu int, force bool) {
993993
defer core.Recover(core.Exit11, "pxr.RefreshProto")
994994
// must unlock from deferred since panics are recovered above
995995
px.Lock()
996996
defer px.Unlock()
997997

998-
if px.lp.l3 == l3 && px.lp.mtu == mtu {
998+
if !force && px.lp.l3 == l3 && px.lp.mtu == mtu {
999999
log.D("proxy: refreshProto (%s == %s & %d == %d) unchanged",
10001000
px.lp.l3, l3, px.lp.mtu, mtu)
10011001
return

intra/tunnel.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,10 @@ func (t *rtunnel) SetLinkAndRoutes(fd, mtu, engine int) error {
239239
if l3diff || mtudiff {
240240
// dialers.IPProtos must always preced calls to other refreshes
241241
// as it carries the global state for dialers and ipn/multihost
242-
go t.proxies.RefreshProto(l3, mtu)
242+
go t.proxies.RefreshProto(l3, mtu, false /*force*/)
243+
}
244+
if l3diff {
245+
t.resolver.Add(newMDNSTransport(t.ctx, l3, t.proxies))
243246
}
244247
if l3diff {
245248
t.resolver.Add(newMDNSTransport(t.ctx, l3, t.proxies))

0 commit comments

Comments
 (0)