Skip to content

Commit

Permalink
display an error if a monitor method has not been applied
Browse files Browse the repository at this point in the history
Sometimes ftrace monitor method fails to apply, but we displayed on the
GUI that it had been applied.
  • Loading branch information
gustavo-iniguez-goya committed Mar 29, 2021
1 parent 7934dfa commit 4b0b8cc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
9 changes: 5 additions & 4 deletions daemon/procmon/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,18 @@ func End() {
}

// Init starts parsing connections using the method specified.
func Init() {
func Init() (err error) {
if cacheMonitorsRunning == false {
go monitorActivePids()
go cacheCleanerTask()
cacheMonitorsRunning = true
}

if methodIsFtrace() {
err := Start()
err = Start()
if err == nil {
log.Info("Process monitor method ftrace")
return
return nil
}
log.Warning("error starting ftrace monitor method: %v", err)

Expand All @@ -127,12 +127,13 @@ func Init() {
if err == nil {
log.Info("Process monitor method audit")
go audit.Reader(auditConn, (chan<- audit.Event)(audit.EventChan))
return
return nil
}
log.Warning("error starting audit monitor method: %v", err)
}

// if any of the above methods have failed, fallback to proc
log.Info("Process monitor method /proc")
SetMonitorMethod(MethodProc)
return err
}
4 changes: 3 additions & 1 deletion daemon/ui/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ func (c *Client) handleActionChangeConfig(stream protocol.UI_NotificationsClient
if err != nil {
log.Warning("[notification] CHANGE_CONFIG not applied %s", err)
} else if err == nil && procMonitorEqual == false {
procmon.Init()
if err := procmon.Init(); err != nil {
c.sendNotificationReply(stream, notification.Id, "", err)
}
}

c.sendNotificationReply(stream, notification.Id, "", err)
Expand Down
3 changes: 3 additions & 0 deletions ui/opensnitch/res/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,9 @@
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 4b0b8cc

Please sign in to comment.