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.
This commit is contained in:
Gustavo Iñiguez Goia 2024-12-17 12:33:38 +01:00
parent 7d2ca8d039
commit c526907d75
Failed to generate hash of commit

View file

@ -190,14 +190,6 @@ func (c *Client) reloadConfiguration(reload bool, newConfig config.Config) *moni
} else { } else {
log.Debug("[config] config.Ebpf.ModulesPath not changed") 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 // 3. load fw
reloadFw := false reloadFw := false
@ -220,6 +212,16 @@ func (c *Client) reloadConfiguration(reload bool, newConfig config.Config) *moni
log.Debug("[config] config.firewall not changed") 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 { if (reloadProc || reloadFw) && newConfig.Internal.FlushConnsOnStart {
log.Debug("[config] flushing established connections") log.Debug("[config] flushing established connections")
netlink.FlushConnections() netlink.FlushConnections()