Removes disabling iptable canary

- Should always be on. Simpler.
This commit is contained in:
Simon Howe committed 2020-07-15 11:37:53 +02:00
1 parent 709b434f55
commit 899490c3f9
1 file changed
+9 -17
+9 -17
View File
@@ -168,7 +168,6 @@ func main() {
procPath string procPath string
discoveryEndpoint string discoveryEndpoint string
token string token string
iptablesRefresh time.Duration
advertiseAddress string advertiseAddress string
pluginConfig plugin.Config pluginConfig plugin.Config
defaultDockerHost = getenvOrDefault("DOCKER_HOST", "unix:///var/run/docker.sock") defaultDockerHost = getenvOrDefault("DOCKER_HOST", "unix:///var/run/docker.sock")
@@ -217,7 +216,6 @@ func main() {
mflag.StringVar(&discoveryEndpoint, []string{"-peer-discovery-url"}, "https://cloud.weave.works/api/net", "url for peer discovery") mflag.StringVar(&discoveryEndpoint, []string{"-peer-discovery-url"}, "https://cloud.weave.works/api/net", "url for peer discovery")
mflag.StringVar(&token, []string{"-token"}, "", "token for peer discovery") mflag.StringVar(&token, []string{"-token"}, "", "token for peer discovery")
mflag.StringVar(&advertiseAddress, []string{"-advertise-address"}, "", "address to advertise for peer discovery") mflag.StringVar(&advertiseAddress, []string{"-advertise-address"}, "", "address to advertise for peer discovery")
mflag.DurationVar(&iptablesRefresh, []string{"-iptables-refresh-interval"}, 10*time.Second, "Interval to reapply iptables. 0 to only apply on launch.")
mflag.BoolVar(&pluginConfig.Enable, []string{"-plugin"}, false, "enable Docker plugin (v1)") mflag.BoolVar(&pluginConfig.Enable, []string{"-plugin"}, false, "enable Docker plugin (v1)")
mflag.BoolVar(&pluginConfig.EnableV2, []string{"-plugin-v2"}, false, "enable Docker plugin (v2)") mflag.BoolVar(&pluginConfig.EnableV2, []string{"-plugin-v2"}, false, "enable Docker plugin (v2)")
@@ -517,23 +515,17 @@ func main() {
go exposeForAWSVPC(allocator, defaultSubnet, bridgeConfig.WeaveBridgeName, waitReady.Add()) go exposeForAWSVPC(allocator, defaultSubnet, bridgeConfig.WeaveBridgeName, waitReady.Add())
} }
if iptablesRefresh > 0 { applyIPTables := func() {
Log.Printf("Entering iptable refresh loop (interval %v)", iptablesRefresh) Log.Info("Re-configuring iptables")
applyIPTables := func() { err := weavenet.ConfigureIPTables(&bridgeConfig, ips)
Log.Info("Re-configuring iptables") if err != nil {
err := weavenet.ConfigureIPTables(&bridgeConfig, ips) Log.Errorf("Error configuring iptables: %s", err)
if err != nil {
Log.Errorf("Error configuring iptables: %s", err)
}
weavenet.Reexpose(&bridgeConfig, Log)
} }
stopChan := make(chan struct{}) weavenet.Reexpose(&bridgeConfig, Log)
go weavenet.Monitor(Log, "WEAVE-CANARY", []string{"mangle", "nat", "filter"}, applyIPTables, iptablesRefresh, stopChan)
defer close(stopChan)
} else {
Log.Printf("Not refreshing iptables (interval: %v)", iptablesRefresh)
} }
stopChan := make(chan struct{})
go weavenet.Monitor(Log, "WEAVE-CANARY", []string{"mangle", "nat", "filter"}, applyIPTables, 10*time.Second, stopChan)
defer close(stopChan)
signals.SignalHandlerLoop(common.Log, router) signals.SignalHandlerLoop(common.Log, router)
} }