From c526907d75985d28626fc44e5d21418e98a2f898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20I=C3=B1iguez=20Goia?= Date: Tue, 17 Dec 2024 12:33:38 +0100 Subject: [PATCH] reload procmon method after fw rules There was a situation where if the ebpf modules path did not exist, the fw rules were not added, causing the daemon to crash after connecting to the GUI. --- daemon/ui/config_utils.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/daemon/ui/config_utils.go b/daemon/ui/config_utils.go index d59bc6c8..c88fee14 100644 --- a/daemon/ui/config_utils.go +++ b/daemon/ui/config_utils.go @@ -190,14 +190,6 @@ func (c *Client) reloadConfiguration(reload bool, newConfig config.Config) *moni } else { log.Debug("[config] config.Ebpf.ModulesPath not changed") } - if reloadProc { - err := monitor.ReconfigureMonitorMethod(newConfig.ProcMonitorMethod, newConfig.Ebpf) - if err != nil && err.What > monitor.NoError { - return err - } - } else { - log.Debug("[config] config.procmon not changed") - } // 3. load fw reloadFw := false @@ -220,6 +212,16 @@ func (c *Client) reloadConfiguration(reload bool, newConfig config.Config) *moni log.Debug("[config] config.firewall not changed") } + // 4. reload procmon if needed + if reloadProc { + err := monitor.ReconfigureMonitorMethod(newConfig.ProcMonitorMethod, newConfig.Ebpf) + if err != nil && err.What > monitor.NoError { + return err + } + } else { + log.Debug("[config] config.procmon not changed") + } + if (reloadProc || reloadFw) && newConfig.Internal.FlushConnsOnStart { log.Debug("[config] flushing established connections") netlink.FlushConnections()