Skip to content

Commit

Permalink
tunnel: reset tun (fd & mtu) before calling observers
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Feb 7, 2025
1 parent ae58d24 commit 8629d40
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions intra/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,14 @@ func (t *rtunnel) SetLinkAndRoutes(fd, mtu, engine int) error {
return errClosed
}

t.onLinkChange(mtu, engine) // before making any changes
mtudiff := t.Tunnel.Mtu() != int32(mtu)
l3 := settings.L3(engine)
l3diff := dialers.IPProtos(l3)

t.Tunnel.SetMTU(int32(mtu))
return t.Tunnel.SetLink(fd) // route is always dual-stack
}
err := t.Tunnel.SetLink(fd) // route is always dual-stack

func (t *rtunnel) onLinkChange(mtu, engine int) {
core.Gx("i.setLinkAndRoutes", func() {
l3 := settings.L3(engine)
mtudiff := t.Tunnel.Mtu() != int32(mtu)
l3diff := dialers.IPProtos(l3)
core.Gx("i.setLinkAndRoutesRefresh", func() {
if l3diff || mtudiff {
// dialers.IPProtos must always preced calls to other refreshes
// as it carries the global state for dialers and ipn/multihost
Expand All @@ -219,6 +217,8 @@ func (t *rtunnel) onLinkChange(mtu, engine int) {
t.resolver.Add(newMDNSTransport(t.ctx, l3, t.proxies))
}
})

return err
}

func (t *rtunnel) internalCtx() context.Context {
Expand Down

0 comments on commit 8629d40

Please sign in to comment.