Blame tests/p_arpwatch/arpwatch_test.sh
|
Christoph Galuschka |
7bc035 |
#!/bin/sh
|
|
Christoph Galuschka |
ca9eca |
# Christoph Galuschka <christoph.galuschka@chello.at>
|
|
Christoph Galuschka |
7bc035 |
|
|
Christoph Galuschka |
7bc035 |
t_Log "Running $0 - arpwatch on eth0"
|
|
Christoph Galuschka |
7bc035 |
|
|
Athmane Madjoudj |
820d69 |
# Kill arpwatch instance from previous test
|
|
Athmane Madjoudj |
820d69 |
killall arpwatch
|
|
Athmane Madjoudj |
820d69 |
|
|
Christoph Galuschka |
7bc035 |
# getting IP-address of default gateway
|
|
Christoph Galuschka |
7bc035 |
defgw=$(ip route list | grep default | cut -d' ' -f3)
|
|
Christoph Galuschka |
7bc035 |
|
|
Christoph Galuschka |
7bc035 |
# setting path to arp.dat
|
|
Christoph Galuschka |
7bc035 |
if (t_GetPkgRel basesystem | grep -q el5)
|
|
Christoph Galuschka |
7bc035 |
then
|
|
Christoph Galuschka |
7bc035 |
arpdat='/var/arpwatch/arp.dat'
|
|
Christoph Galuschka |
7bc035 |
else
|
|
Christoph Galuschka |
7bc035 |
arpdat='/var/lib/arpwatch/arp.dat'
|
|
Christoph Galuschka |
7bc035 |
fi
|
|
Christoph Galuschka |
7bc035 |
|
|
Christoph Galuschka |
7bc035 |
# beginning and running test
|
|
Christoph Galuschka |
7bc035 |
arpwatch
|
|
Athmane Madjoudj |
93d0b1 |
sleep 4
|
|
Christoph Galuschka |
c4178a |
arp -d $defgw
|
|
Christoph Galuschka |
38d483 |
sleep 2
|
|
Christoph Galuschka |
38d483 |
ping -q -i 0.5 -c 5 $defgw
|
|
Christoph Galuschka |
7bc035 |
killall arpwatch
|
|
Christoph Galuschka |
38d483 |
sleep 2
|
|
Christoph Galuschka |
7bc035 |
grep -q $defgw $arpdat
|
|
Christoph Galuschka |
7bc035 |
ret_val=$?
|
|
Christoph Galuschka |
7bc035 |
|
|
Christoph Galuschka |
7bc035 |
# cleaning up
|
|
Christoph Galuschka |
7bc035 |
cat /dev/null > $arpdat
|
|
Christoph Galuschka |
7bc035 |
|
|
Christoph Galuschka |
7bc035 |
t_CheckExitStatus $ret_val
|