Skip to content

Commit

Permalink
added more requirements checks, minor code refactor
Browse files Browse the repository at this point in the history
- Check kernel configs NET_DIAG_*.
- config.SaveConfiguration() -> config.Save()
  • Loading branch information
gustavo-iniguez-goya committed Jun 28, 2023
1 parent 8240b7b commit 5a0bd3b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions daemon/core/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ func CheckSysRequirements() {
],
"Reason": " * NETLINK extensions not supported by this kernel (CONFIG_NETFILTER_NETLINK, CONFIG_NETFILTER_NETLINK_QUEUE, CONFIG_NETFILTER_NETLINK_ACCT)."
}
},
{
"Item": "net diagnostics",
"Checks": {
"Regexps": [
"CONFIG_INET_DIAG=[my]",
"CONFIG_INET_TCP_DIAG=[my]",
"CONFIG_INET_UDP_DIAG=[my]",
"CONFIG_INET_DIAG_DESTROY=[my]"
],
"Reason": " * One or more socket monitoring interfaces are not enabled (CONFIG_INET_DIAG, CONFIG_INET_TCP_DIAG, CONFIG_INET_UDP_DIAG, CONFIG_DIAG_DESTROY (Reject feature))."
}
}
]
`
Expand Down
4 changes: 2 additions & 2 deletions daemon/ui/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func Parse(rawConfig interface{}) (conf Config, err error) {
return conf, err
}

// SaveConfiguration saves daemon config to disk.
func SaveConfiguration(configFile, rawConfig string) (err error) {
// Save writes daemon configuration to disk.
func Save(configFile, rawConfig string) (err error) {
if _, err = Parse(rawConfig); err != nil {
return fmt.Errorf("Error parsing configuration %s: %s", rawConfig, err)
}
Expand Down
2 changes: 1 addition & 1 deletion daemon/ui/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (c *Client) handleActionChangeConfig(stream protocol.UI_NotificationsClient
}

// this save operation triggers a re-loadConfiguration()
err = config.SaveConfiguration(configFile, notification.Data)
err = config.Save(configFile, notification.Data)
if err != nil {
log.Warning("[notification] CHANGE_CONFIG not applied %s", err)
}
Expand Down

0 comments on commit 5a0bd3b

Please sign in to comment.