diff --git a/scripts/verify.sh b/scripts/verify.sh index baaa815..24cd692 100755 --- a/scripts/verify.sh +++ b/scripts/verify.sh @@ -21,7 +21,7 @@ if [ $? -ne 0 ]; then fi if [ $final_ret -eq 0 ]; then - # to avoid device or resource busy error + # To avoid device or resource busy error sleep 0.5 # set transmit power (mBm) @@ -40,8 +40,8 @@ if [ $final_ret -eq 0 ]; then vw3_phy=$(get_wiphy_name vw3) vw4_phy=$(get_wiphy_name vw4) vw5_phy=$(get_wiphy_name vw5) - - # create network namespaces for each phy (interface) + + # create network namespaces for each phy (interface) sudo ip netns add ns0 sudo ip netns add ns1 sudo ip netns add ns2 @@ -49,14 +49,14 @@ if [ $final_ret -eq 0 ]; then sudo ip netns add ns4 sudo ip netns add ns5 - # add each phy (interface) to separate network namesapces + # add each phy (interface) to separate network namespaces sudo iw phy $vw0_phy set netns name ns0 sudo iw phy $vw1_phy set netns name ns1 sudo iw phy $vw2_phy set netns name ns2 sudo iw phy $vw3_phy set netns name ns3 sudo iw phy $vw4_phy set netns name ns4 sudo iw phy $vw5_phy set netns name ns5 - + # running hostapd on vw0, so vw0 becomes AP sudo ip netns exec ns0 ip link set vw0 up sudo ip netns exec ns0 ip link set lo up @@ -77,7 +77,7 @@ if [ $final_ret -eq 0 ]; then sudo ip netns exec ns5 ip link set vw5 up sudo ip netns exec ns5 ip link set lo up - # assing IP address to each interface + # assign IP address to each interface sudo ip netns exec ns0 ip addr add 10.0.0.1/24 dev vw0 sudo ip netns exec ns1 ip addr add 10.0.0.2/24 dev vw1 sudo ip netns exec ns2 ip addr add 10.0.0.3/24 dev vw2 @@ -85,13 +85,13 @@ if [ $final_ret -eq 0 ]; then sudo ip netns exec ns4 ip addr add 10.0.0.5/24 dev vw4 sudo ip netns exec ns5 ip addr add 10.0.0.6/24 dev vw5 - # ping test: STA vw1 <--> STA vw2, should fail, because they - # haven't connected to AP + # ping test: STA vw1 <--> STA vw2, should fail, because they + # haven't connected to AP echo echo "================================================================================" echo "Ping Test: STA vw1 (10.0.0.2) (not connected) <--> STA vw2 (10.0.0.3) (not connected)" echo - echo "(should fail, because they haven't connnected to AP vw0 (10.0.0.1))" + echo "(should fail, because they haven't connected to AP vw0 (10.0.0.1))" echo "(be patient, it will take some time to route...)" echo "================================================================================" sudo ip netns exec ns1 ping -c 1 10.0.0.3 @@ -107,7 +107,7 @@ if [ $final_ret -eq 0 ]; then final_ret=4 fi - echo + echo echo "==================================" echo "vw1 connected to AP TestAP (vw0)" echo "==================================" @@ -123,18 +123,18 @@ if [ $final_ret -eq 0 ]; then final_ret=5 fi - echo + echo echo "==================================" echo "vw2 connected to AP TestAP (vw0)" echo "==================================" # ping test: STA vw1 (10.0.0.2) <--> STA vw2 (10.0.0.3), - # should success, packet will be relayed by AP vw0 (10.0.0.1) + # should succeed, packet will be relayed by AP vw0 (10.0.0.1) echo echo "================================================================================" echo "Ping Test: STA vw1 (10.0.0.2) (connected) <--> STA vw2 (10.0.0.3) (connected)" echo - echo "(should success, packet will be relay by AP vw0 (10.0.0.1))" + echo "(should succeed, packet will be relayed by AP vw0 (10.0.0.1))" echo "================================================================================" sudo ip netns exec ns1 ping -c 4 10.0.0.3 @@ -145,15 +145,15 @@ if [ $final_ret -eq 0 ]; then fi # ping test: STA vw2 (10.0.0.3) <--> AP vw0 (10.0.0.1), - # should success, packet will directly send/receive between STA and AP + # should succeed, packet will directly send/receive between STA and AP echo echo "================================================================================" - echo "Ping Test: STA vw1 (10.0.0.3) (connected) <--> AP vw0 (10.0.0.1)" + echo "Ping Test: STA vw2 (10.0.0.3) (connected) <--> AP vw0 (10.0.0.1)" echo - echo "(should success, packet will directly send/receive between STA vw1 and AP vw0)" + echo "(should succeed, packet will directly send/receive between STA vw2 and AP vw0)" echo "================================================================================" sudo ip netns exec ns2 ping -c 4 10.0.0.1 - + # sudo ip netns exec ns2 ping -c 4 10.0.0.1 ping_rc=$? if [ $ping_rc -ne 0 ]; then @@ -161,26 +161,26 @@ if [ $final_ret -eq 0 ]; then fi # vw3 becomes an IBSS and then joins the "ibss1" network. - echo + echo echo "==============" echo "vw3 join ibss1" echo "==============" sudo ip netns exec ns3 wpa_supplicant -i vw3 -B -c scripts/wpa_supplicant_ibss.conf # vw4 becomes an IBSS and then joins the "ibss1" network. - echo + echo echo "==============" echo "vw4 join ibss1" echo "==============" sudo ip netns exec ns4 wpa_supplicant -i vw4 -B -c scripts/wpa_supplicant_ibss.conf # vw5 becomes an IBSS and then joins the "ibss2" network (BSSID: 00:76:77:35:00:00). - echo + echo echo "==================================" echo "vw5 join ibss2 (00:76:77:35:00:00)" echo "==================================" sudo ip netns exec ns5 iw dev vw5 set type ibss - sudo ip netns exec ns5 iw dev vw5 ibss join ibss2 2412 NOHT fixed-freq 00:76:77:35:00:00 beacon-interval 300 + sudo ip netns exec ns5 iw dev vw5 ibss join ibss2 2412 NOHT fixed-freq 00:76:77:35:00:00 beacon-interval 300 # ping test: IBSS vw3 <--> STA vw2, should fail echo @@ -192,7 +192,7 @@ if [ $final_ret -eq 0 ]; then echo "================================================================================" sudo ip netns exec ns3 ping -c 1 10.0.0.3 - # ping test: IBSS vw3 <--> IBSS vw5, should fail + # ping test: IBSS vw3 <--> IBSS vw5, should fail echo echo "================================================================================" echo "Ping Test: IBSS vw3 (10.0.0.4) (in ibss1) <--> IBSS vw5 (10.0.0.6) (in ibss2)" @@ -202,12 +202,12 @@ if [ $final_ret -eq 0 ]; then echo "================================================================================" sudo ip netns exec ns3 ping -c 1 10.0.0.6 - # ping test: IBSS vw3 <--> IBSS vw4, should success + # ping test: IBSS vw3 <--> IBSS vw4, should succeed echo echo "================================================================================" echo "Ping Test: IBSS vw3 (10.0.0.4) (in ibss1) <--> IBSS vw4 (10.0.0.5) (in ibss1)" echo - echo "(should success)" + echo "(should succeed)" echo "(be patient, it will take some time to route...)" echo "================================================================================" sudo ip netns exec ns3 ping -c 1 10.0.0.5 @@ -225,7 +225,7 @@ if [ $final_ret -eq 0 ]; then uptime=$(echo "$uptime*1000000" | bc | awk -F "." '{print $1}') diff=$((tsf - uptime)) - # difference between tsf and uptime should less than 0.5 sec. + # difference between tsf and uptime should be less than or equal to 0.5 sec. if [ "${diff#-}" -gt 500000 ]; then final_ret=9 fi @@ -249,7 +249,7 @@ if [ $final_ret -eq 0 ]; then # TestAP performs station dump sudo ip netns exec ns0 iw dev vw0 station dump > station_dump_result.log - for num in {1..2}; do + for num in {1..2}; do cat station_dump_result.log | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'| sed -n "${num}p" > dump_ssid.log sudo ip netns exec "ns${num}" iw dev | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' > station_ssid.log DIFF=$(diff dump_ssid.log station_ssid.log)