@@ -21,7 +21,7 @@ if [ $? -ne 0 ]; then
2121fi
2222
2323if [ $final_ret -eq 0 ]; then
24- # to avoid device or resource busy error
24+ # To avoid device or resource busy error
2525 sleep 0.5
2626
2727 # set transmit power (mBm)
@@ -40,23 +40,23 @@ if [ $final_ret -eq 0 ]; then
4040 vw3_phy=$( get_wiphy_name vw3)
4141 vw4_phy=$( get_wiphy_name vw4)
4242 vw5_phy=$( get_wiphy_name vw5)
43-
44- # create network namespaces for each phy (interface)
43+
44+ # create network namespaces for each phy (interface)
4545 sudo ip netns add ns0
4646 sudo ip netns add ns1
4747 sudo ip netns add ns2
4848 sudo ip netns add ns3
4949 sudo ip netns add ns4
5050 sudo ip netns add ns5
5151
52- # add each phy (interface) to separate network namesapces
52+ # add each phy (interface) to separate network namespaces
5353 sudo iw phy $vw0_phy set netns name ns0
5454 sudo iw phy $vw1_phy set netns name ns1
5555 sudo iw phy $vw2_phy set netns name ns2
5656 sudo iw phy $vw3_phy set netns name ns3
5757 sudo iw phy $vw4_phy set netns name ns4
5858 sudo iw phy $vw5_phy set netns name ns5
59-
59+
6060 # running hostapd on vw0, so vw0 becomes AP
6161 sudo ip netns exec ns0 ip link set vw0 up
6262 sudo ip netns exec ns0 ip link set lo up
@@ -77,21 +77,21 @@ if [ $final_ret -eq 0 ]; then
7777 sudo ip netns exec ns5 ip link set vw5 up
7878 sudo ip netns exec ns5 ip link set lo up
7979
80- # assing IP address to each interface
80+ # assign IP address to each interface
8181 sudo ip netns exec ns0 ip addr add 10.0.0.1/24 dev vw0
8282 sudo ip netns exec ns1 ip addr add 10.0.0.2/24 dev vw1
8383 sudo ip netns exec ns2 ip addr add 10.0.0.3/24 dev vw2
8484 sudo ip netns exec ns3 ip addr add 10.0.0.4/24 dev vw3
8585 sudo ip netns exec ns4 ip addr add 10.0.0.5/24 dev vw4
8686 sudo ip netns exec ns5 ip addr add 10.0.0.6/24 dev vw5
8787
88- # ping test: STA vw1 <--> STA vw2, should fail, because they
89- # haven't connected to AP
88+ # ping test: STA vw1 <--> STA vw2, should fail, because they
89+ # haven't connected to AP
9090 echo
9191 echo " ================================================================================"
9292 echo " Ping Test: STA vw1 (10.0.0.2) (not connected) <--> STA vw2 (10.0.0.3) (not connected)"
9393 echo
94- echo " (should fail, because they haven't connnected to AP vw0 (10.0.0.1))"
94+ echo " (should fail, because they haven't connected to AP vw0 (10.0.0.1))"
9595 echo " (be patient, it will take some time to route...)"
9696 echo " ================================================================================"
9797 sudo ip netns exec ns1 ping -c 1 10.0.0.3
@@ -107,7 +107,7 @@ if [ $final_ret -eq 0 ]; then
107107 final_ret=4
108108 fi
109109
110- echo
110+ echo
111111 echo " =================================="
112112 echo " vw1 connected to AP TestAP (vw0)"
113113 echo " =================================="
@@ -123,18 +123,18 @@ if [ $final_ret -eq 0 ]; then
123123 final_ret=5
124124 fi
125125
126- echo
126+ echo
127127 echo " =================================="
128128 echo " vw2 connected to AP TestAP (vw0)"
129129 echo " =================================="
130130
131131 # ping test: STA vw1 (10.0.0.2) <--> STA vw2 (10.0.0.3),
132- # should success , packet will be relayed by AP vw0 (10.0.0.1)
132+ # should succeed , packet will be relayed by AP vw0 (10.0.0.1)
133133 echo
134134 echo " ================================================================================"
135135 echo " Ping Test: STA vw1 (10.0.0.2) (connected) <--> STA vw2 (10.0.0.3) (connected)"
136136 echo
137- echo " (should success , packet will be relay by AP vw0 (10.0.0.1))"
137+ echo " (should succeed , packet will be relayed by AP vw0 (10.0.0.1))"
138138 echo " ================================================================================"
139139 sudo ip netns exec ns1 ping -c 4 10.0.0.3
140140
@@ -145,42 +145,42 @@ if [ $final_ret -eq 0 ]; then
145145 fi
146146
147147 # ping test: STA vw2 (10.0.0.3) <--> AP vw0 (10.0.0.1),
148- # should success , packet will directly send/receive between STA and AP
148+ # should succeed , packet will directly send/receive between STA and AP
149149 echo
150150 echo " ================================================================================"
151- echo " Ping Test: STA vw1 (10.0.0.3) (connected) <--> AP vw0 (10.0.0.1)"
151+ echo " Ping Test: STA vw2 (10.0.0.3) (connected) <--> AP vw0 (10.0.0.1)"
152152 echo
153- echo " (should success , packet will directly send/receive between STA vw1 and AP vw0)"
153+ echo " (should succeed , packet will directly send/receive between STA vw2 and AP vw0)"
154154 echo " ================================================================================"
155155 sudo ip netns exec ns2 ping -c 4 10.0.0.1
156-
156+
157157 # sudo ip netns exec ns2 ping -c 4 10.0.0.1
158158 ping_rc=$?
159159 if [ $ping_rc -ne 0 ]; then
160160 final_ret=7
161161 fi
162162
163163 # vw3 becomes an IBSS and then joins the "ibss1" network.
164- echo
164+ echo
165165 echo " =============="
166166 echo " vw3 join ibss1"
167167 echo " =============="
168168 sudo ip netns exec ns3 wpa_supplicant -i vw3 -B -c scripts/wpa_supplicant_ibss.conf
169169
170170 # vw4 becomes an IBSS and then joins the "ibss1" network.
171- echo
171+ echo
172172 echo " =============="
173173 echo " vw4 join ibss1"
174174 echo " =============="
175175 sudo ip netns exec ns4 wpa_supplicant -i vw4 -B -c scripts/wpa_supplicant_ibss.conf
176176
177177 # vw5 becomes an IBSS and then joins the "ibss2" network (BSSID: 00:76:77:35:00:00).
178- echo
178+ echo
179179 echo " =================================="
180180 echo " vw5 join ibss2 (00:76:77:35:00:00)"
181181 echo " =================================="
182182 sudo ip netns exec ns5 iw dev vw5 set type ibss
183- sudo ip netns exec ns5 iw dev vw5 ibss join ibss2 2412 NOHT fixed-freq 00:76:77:35:00:00 beacon-interval 300
183+ sudo ip netns exec ns5 iw dev vw5 ibss join ibss2 2412 NOHT fixed-freq 00:76:77:35:00:00 beacon-interval 300
184184
185185 # ping test: IBSS vw3 <--> STA vw2, should fail
186186 echo
@@ -192,7 +192,7 @@ if [ $final_ret -eq 0 ]; then
192192 echo " ================================================================================"
193193 sudo ip netns exec ns3 ping -c 1 10.0.0.3
194194
195- # ping test: IBSS vw3 <--> IBSS vw5, should fail
195+ # ping test: IBSS vw3 <--> IBSS vw5, should fail
196196 echo
197197 echo " ================================================================================"
198198 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
202202 echo " ================================================================================"
203203 sudo ip netns exec ns3 ping -c 1 10.0.0.6
204204
205- # ping test: IBSS vw3 <--> IBSS vw4, should success
205+ # ping test: IBSS vw3 <--> IBSS vw4, should succeed
206206 echo
207207 echo " ================================================================================"
208208 echo " Ping Test: IBSS vw3 (10.0.0.4) (in ibss1) <--> IBSS vw4 (10.0.0.5) (in ibss1)"
209209 echo
210- echo " (should success )"
210+ echo " (should succeed )"
211211 echo " (be patient, it will take some time to route...)"
212212 echo " ================================================================================"
213213 sudo ip netns exec ns3 ping -c 1 10.0.0.5
@@ -225,7 +225,7 @@ if [ $final_ret -eq 0 ]; then
225225 uptime=$( echo " $uptime *1000000" | bc | awk -F " ." ' {print $1}' )
226226 diff=$(( tsf - uptime))
227227
228- # difference between tsf and uptime should less than 0.5 sec.
228+ # difference between tsf and uptime should be less than or equal to 0.5 sec.
229229 if [ " ${diff# -} " -gt 500000 ]; then
230230 final_ret=9
231231 fi
@@ -249,7 +249,7 @@ if [ $final_ret -eq 0 ]; then
249249
250250 # TestAP performs station dump
251251 sudo ip netns exec ns0 iw dev vw0 station dump > station_dump_result.log
252- for num in {1..2}; do
252+ for num in {1..2}; do
253253 cat station_dump_result.log | grep -o -E ' ([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | sed -n " ${num} p" > dump_ssid.log
254254 sudo ip netns exec " ns${num} " iw dev | grep -o -E ' ([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' > station_ssid.log
255255 DIFF=$( diff dump_ssid.log station_ssid.log)
0 commit comments