blob: 63e834f1267c45b22130d75593ed8b5824ecf7d8 [file] [log] [blame]
Junxiao Shi2feae5b2014-06-19 02:40:22 -06001#!/bin/bash
2DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3source ../multi-host.conf
4
5# linkfail.sh fail|recover end1 end2
6
7ACT=$1
8END1=$2
9END2=$3
10CTRLVAR1='CTRL_'${END1:0:1}
11CTRLVAR2='CTRL_'${END2:0:1}
12IP4VAR1='IP4_'$END1
13IP4VAR2='IP4_'$END2
14
15CMD='-D'
16if [[ $ACT == 'fail' ]]
17then
18 CMD='-I'
19fi
20
21ssh ${!CTRLVAR1} "sudo iptables $CMD INPUT -s ${!IP4VAR2}/32 -p udp --dport 6363 -j DROP"
22ssh ${!CTRLVAR2} "sudo iptables $CMD INPUT -s ${!IP4VAR1}/32 -p udp --dport 6363 -j DROP"
23