55// The firewall rules defined by the user are reloaded in these cases:
66// - When the file system-fw.json changes.
77// - When the firewall rules are not present when listing them.
8+ //
89package config
910
1011import (
@@ -19,33 +20,30 @@ import (
1920// ExprValues holds the statements' options:
2021// "Name": "ct",
2122// "Values": [
22- //
23- // {
24- // "Key": "state",
25- // "Value": "established"
26- // },
27- //
28- // {
29- // "Key": "state",
30- // "Value": "related"
31- // }]
23+ // {
24+ // "Key": "state",
25+ // "Value": "established"
26+ // },
27+ // {
28+ // "Key": "state",
29+ // "Value": "related"
30+ // }]
3231type ExprValues struct {
3332 Key string
3433 Value string
3534}
3635
3736// ExprStatement holds the definition of matches to use against connections.
38- //
39- // {
40- // "Op": "!=",
41- // "Name": "tcp",
42- // "Values": [
43- // {
44- // "Key": "dport",
45- // "Value": "443"
46- // }
47- // ]
48- // }
37+ //{
38+ // "Op": "!=",
39+ // "Name": "tcp",
40+ // "Values": [
41+ // {
42+ // "Key": "dport",
43+ // "Value": "443"
44+ // }
45+ // ]
46+ //}
4947type ExprStatement struct {
5048 Op string // ==, !=, ... Only one per expression set.
5149 Name string // tcp, udp, ct, daddr, log, ...
@@ -165,11 +163,7 @@ func (c *Config) LoadDiskConfiguration(reload bool) {
165163 c .loadConfiguration (raw )
166164 // we need to monitor the configuration file for changes, regardless if it's
167165 // malformed or not.
168- err = c .watcher .Remove (c .file )
169- if err != nil {
170- log .Error ("Failed to stop filesystem watcher: %v" , err )
171- return
172- }
166+ c .watcher .Remove (c .file )
173167 if err := c .watcher .Add (c .file ); err != nil {
174168 log .Error ("Could not watch firewall configuration: %s" , err )
175169 return
@@ -229,11 +223,6 @@ func (c *Config) StopConfigWatcher() {
229223
230224 if c .watcher != nil {
231225 c .watcher .Remove (c .file )
232- err := c .watcher .Remove (c .file )
233- if err != nil {
234- log .Error ("Failed to stop filesystem watcher: %v" , err )
235- return
236- }
237226 c .watcher .Close ()
238227 }
239228}
0 commit comments