| #!/bin/sh |
| |
| |
| |
| t_Log "Running $0 - TCPdump test to Default-GW with IPv4" |
| |
| |
| def_gw=$(ip route list default|grep "default via"|head -n 1|awk '{print $3}') |
| eth_int=$(ip addr|grep -B 1 "link/ether"|head -n 1|awk '{print $2}'|tr -d ':') |
| |
| t_Log "Found Default-GW - starting tcpdump test" |
| |
| FILE='/var/tmp/nic_test.pcap' |
| COUNT='4' |
| tcpdump -i $eth_int -q -n -p -w $FILE & |
| |
| sleep 1 |
| ping -q -c $COUNT -i 0.25 ${def_gw} > /dev/null 2>&1 |
| sleep 1 |
| killall -s SIGINT tcpdump |
| sleep 1 |
| |
| WORKING=$( tcpdump -r $FILE | grep -ci icmp ) |
| if [ $SKIP_QA_HARNESS -eq 1 ] |
| then |
| |
| |
| ret_val=0 |
| if [ $WORKING != $[COUNT*2] ] |
| then |
| t_Log "ping to Default-Gateway did not return the number of pakets we expect. "$WORKING" of "$[COUNT*2]" pakets were dumped to file" |
| else |
| t_Log "ping to Default-Gateway looks OK. "$WORKING" of "$[COUNT*2]" pakets were dumped to file" |
| fi |
| else |
| |
| if [ $WORKING == $[COUNT*2] ] || [ $WORKING -gt $[COUNT*2] ] |
| then |
| t_Log "QA-harness: ping to Default-Gateway looks OK. At least "$[COUNT*2]" pakets ("$WORKING") were dumped to file" |
| ret_val=0 |
| else |
| t_Log "QA-harness: ping to Default-Gateway droped pakets!! Only "$WORKING" of "$[COUNT*2]" entries were found!!" |
| ret_val=1 |
| fi |
| fi |
| |
| /bin/rm $FILE |
| |
| t_CheckExitStatus $ret_val |