mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
Merge pull request #239 from Northern-Lights/runrule-err-check
Fix ignored err check in RunRule
This commit is contained in:
commit
9ba074e24e
1 changed files with 16 additions and 0 deletions
|
@ -27,7 +27,13 @@ func RunRule(enable bool, rule []string) (err error) {
|
||||||
// fmt.Printf("iptables %s\n", rule)
|
// fmt.Printf("iptables %s\n", rule)
|
||||||
|
|
||||||
_, err = core.Exec("iptables", rule)
|
_, err = core.Exec("iptables", rule)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
_, err = core.Exec("ip6tables", rule)
|
_, err = core.Exec("ip6tables", rule)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -48,9 +54,19 @@ func QueueDNSResponses(enable bool, queueNum int) (err error) {
|
||||||
"--queue-num", fmt.Sprintf("%d", queueNum),
|
"--queue-num", fmt.Sprintf("%d", queueNum),
|
||||||
"--queue-bypass",
|
"--queue-bypass",
|
||||||
}
|
}
|
||||||
|
|
||||||
lock.Lock()
|
lock.Lock()
|
||||||
defer lock.Unlock()
|
defer lock.Unlock()
|
||||||
|
|
||||||
_, err := core.Exec("iptables", rule)
|
_, err := core.Exec("iptables", rule)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = core.Exec("ip6tables", rule)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue