Skip to content

Instantly share code, notes, and snippets.

@fasaxc
Created February 3, 2017 20:06
Show Gist options
  • Save fasaxc/ee443a9ef82ce2e4dab059161f095ec2 to your computer and use it in GitHub Desktop.
Save fasaxc/ee443a9ef82ce2e4dab059161f095ec2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
failed=false
function felix () {
while true; do
echo -n a
iptables-restore --noflush --verbose <<EOF
*filter
:felix -
--append felix -m comment --comment "FELIX-A"
COMMIT
EOF
echo -n A
echo -n b
iptables-restore --noflush --verbose <<EOF
*filter
:felix -
--append felix -m comment --comment "FELIX-B"
COMMIT
EOF
echo -n B
if iptables-save | grep -q FELIX-A; then
echo
echo "FELIX-B update was clobbered"
failed=true
return 1
fi
echo -n C
done
}
function kube () {
while ! ${failed}; do
echo -n k
iptables-restore --noflush --verbose <<EOF
*filter
:kube -
COMMIT
EOF
echo -n K
done
}
kube &
kube_pid=$!
felix; kill $kube_pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment