Report how a config reload went: failures, restarts required, and the keys that need one (#1935)

This commit is contained in:
Nate Brown authored and GitHub committed 2026-10-15 15:36:39 -05:00
1 parent 42597dda7d
commit 1a0ac25db0
57 files changed
+941 -193

No files matched your search

+5 -4
View File
@@ -38,16 +38,17 @@ func newTunFromFd(c *config.C, l *slog.Logger, deviceFd int, vpnNetworks []netip
l: l,
}
err := t.reload(c, true)
err := t.reload(c, true, nil)
if err != nil {
_ = file.Close()
return nil, err
}
c.RegisterReloadCallback(func(c *config.C) {
err := t.reload(c, false)
c.RegisterReloadCallback(func(c *config.C, r *config.Reload) {
err := t.reload(c, false, r)
if err != nil {
util.LogWithContextIfNeeded("failed to reload tun device", err, t.l)
r.Failed()
}
})
@@ -67,7 +68,7 @@ func (t *tun) Activate() error {
return nil
}
func (t *tun) reload(c *config.C, initial bool) error {
func (t *tun) reload(c *config.C, initial bool, r *config.Reload) error {
change, routes, err := getAllRoutesFromConfig(t.l, c, t.vpnNetworks, initial)
if err != nil {
return err