| #!/bin/sh |
| |
| |
| |
| t_Log "Running $0 - TCPdump test to Default-GW with IPv4" |
| |
| |
| IP=$(ip route list default | grep 'default via ') |
| regex='.*via\ (.*)\ dev.*' |
| if [[ $IP =~ $regex ]] |
| then |
| t_Log "Found Default-GW - starting tcpdump test" |
| |
| FILE='/var/tmp/eth0_test.pcap' |
| COUNT='4' |
| tcpdump -q -n -p -i eth0 -w $FILE & |
| |
| sleep 1 |
| ping -q -c $COUNT -i 0.25 ${BASH_REMATCH[1]} > /dev/null 2>&1 |
| sleep 1 |
| killall -s SIGINT tcpdump |
| sleep 1 |
| |
| WORKING=$( tcpdump -r $FILE | grep -ci icmp ) |
| |
| |
| if [ $WORKING == $[COUNT*2] ] |
| then |
| ret_val=0 |
| else |
| t_Log "ping to Default-Gateway droped pakets!! Only "$WORKING" of "$[COUNT*2]" entries were found!!" |
| ret_val=1 |
| fi |
| else |
| t_Log "No Default-GW found - skiping test" |
| ret_val=0 |
| fi |
| |
| /bin/rm $FILE |
| |
| t_CheckExitStatus $ret_val |