5
5
// The firewall rules defined by the user are reloaded in these cases:
6
6
// - When the file system-fw.json changes.
7
7
// - When the firewall rules are not present when listing them.
8
+ //
8
9
package config
9
10
10
11
import (
@@ -19,33 +20,30 @@ import (
19
20
// ExprValues holds the statements' options:
20
21
// "Name": "ct",
21
22
// "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
+ // }]
32
31
type ExprValues struct {
33
32
Key string
34
33
Value string
35
34
}
36
35
37
36
// 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
+ //}
49
47
type ExprStatement struct {
50
48
Op string // ==, !=, ... Only one per expression set.
51
49
Name string // tcp, udp, ct, daddr, log, ...
@@ -165,11 +163,7 @@ func (c *Config) LoadDiskConfiguration(reload bool) {
165
163
c .loadConfiguration (raw )
166
164
// we need to monitor the configuration file for changes, regardless if it's
167
165
// 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 )
173
167
if err := c .watcher .Add (c .file ); err != nil {
174
168
log .Error ("Could not watch firewall configuration: %s" , err )
175
169
return
@@ -229,11 +223,6 @@ func (c *Config) StopConfigWatcher() {
229
223
230
224
if c .watcher != nil {
231
225
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
- }
237
226
c .watcher .Close ()
238
227
}
239
228
}
0 commit comments