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
|
|
Christoph Galuschka |
c4178a |
sleep 1
|
|
Christoph Galuschka |
c4178a |
arp -d $defgw
|
|
Christoph Galuschka |
c4178a |
sleep 1
|
|
Christoph Galuschka |
7bc035 |
ping -q -i 0.25 -c 5 $defgw
|
|
Christoph Galuschka |
7bc035 |
killall arpwatch
|
|
Christoph Galuschka |
c4178a |
sleep 1
|
|
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
|