From 9419ad16bf91ff0c835839710086e3b07b12f4fe Mon Sep 17 00:00:00 2001 From: Mike Bryant Date: Mon, 8 May 2017 11:30:28 +0100 Subject: [PATCH] Clean up xt_set_exists components in advance If this function dies in the middle, the leftover weave-kube-test set causes this function and weave-npc to break. In particular this means we can never restart weave with the launch script. Here we clean up in advance, in case there's leftovers from a previous run Fixes #2934 --- prog/weave-kube/launch.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/prog/weave-kube/launch.sh b/prog/weave-kube/launch.sh index 1b851d49..7be0d66d 100755 --- a/prog/weave-kube/launch.sh +++ b/prog/weave-kube/launch.sh @@ -8,6 +8,11 @@ modprobe_safe() { # Check whether xt_set actually exists xt_set_exists() { + # Clean everything up in advance, in case there's leftovers + iptables -F WEAVE-KUBE-TEST 2>/dev/null || true + iptables -X WEAVE-KUBE-TEST 2>/dev/null || true + ipset destroy weave-kube-test 2>/dev/null || true + ipset create weave-kube-test hash:ip iptables -t filter -N WEAVE-KUBE-TEST if ! iptables -A WEAVE-KUBE-TEST -m set --match-set weave-kube-test src -j DROP; then