Browse code

Reload DOCKER-USER chain on frewalld reload.

Relates to moby/moby#35043

Signed-off-by: Brian Goff <cpuguy83@gmail.com>

Brian Goff authored on 2018/01/13 00:29:09
Showing 3 changed files
... ...
@@ -882,9 +882,7 @@ addToStore:
882 882
 		c.Unlock()
883 883
 	}
884 884
 
885
-	c.Lock()
886
-	arrangeUserFilterRule()
887
-	c.Unlock()
885
+	c.arrangeUserFilterRule()
888 886
 
889 887
 	return network, nil
890 888
 }
... ...
@@ -7,6 +7,17 @@ import (
7 7
 
8 8
 const userChain = "DOCKER-USER"
9 9
 
10
+func (c *controller) arrangeUserFilterRule() {
11
+	c.Lock()
12
+	arrangeUserFilterRule()
13
+	c.Unlock()
14
+	iptables.OnReloaded(func() {
15
+		c.Lock()
16
+		arrangeUserFilterRule()
17
+		c.Unlock()
18
+	})
19
+}
20
+
10 21
 // This chain allow users to configure firewall policies in a way that persists
11 22
 // docker operations/restarts. Docker will not delete or modify any pre-existing
12 23
 // rules from the DOCKER-USER filter chain.
... ...
@@ -2,5 +2,5 @@
2 2
 
3 3
 package libnetwork
4 4
 
5
-func arrangeUserFilterRule() {
5
+func (c *controller) arrangeUserFilterRule() {
6 6
 }