blob: 89a93efbcc389bbe209cf4fbb7d032f275eac40b [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001#!/bin/sh
2#
3# script file to start WLAN
4#
5
6
7## error code
8ERROR_SUCCESS=0
9ERROR_INVALID_PARAMETERS=1
10ERROR_NO_SUCH_DEVICE=2
11ERROR_NO_CONFIG_FILE=3
12ERROR_NO_SUCH_FILE=4
13ERROR_NO_SUCH_DIRECTORY=5
14ERROR_NULL_FILE=6
15ERROR_NET_IF_UP_FAIL=7
16
17IWPRIV=iwpriv
18wifi_lte_intr=`nv get wifi_lte_intr`
19
20if [ $# -lt 1 ]; then
21 echo "Usage: $0 wlan_interface" >> $LOG
22 exit $ERROR_INVALID_PARAMETERS;
23fi
24
25ROOT=`nv get wifi_root_dir`
26
27LOG=$ROOT/wifi/realtek/slog
28CONFIG_ROOT_DIR="$ROOT/wifi/realtek/rtl8192c"
29
30CONFIG_DIR=$CONFIG_ROOT_DIR/$1
31echo "$1 config para" >> $LOG
32if [ ! -d "$CONFIG_DIR" ]; then
33 echo "$CONFIG_DIR: No such directory" >> $LOG
34 exit $ERROR_NO_CONFIG_FILE
35fi
36
37if [ -z "$SCRIPT_DIR" ]; then
38 SCRIPT_DIR=`cat $CONFIG_ROOT_DIR/wifi_script_dir`
39fi
40#echo $SCRIPT_DIR
41#START_WLAN_APP=$SCRIPT_DIR/wlanapp_8192c.sh
42
43if [ -z "$WLAN_PREFIX" ]; then
44 WLAN_PREFIX=wlan
45fi
46#WLAN_PREFIX_LEN=${#WLAN_PREFIX}
47#WLAN_NAME_LEN=$((WLAN_PREFIX_LEN + 1))
48
49if [ -z "$ROOT_WLAN" ]; then
50# ROOT_WLAN=${1:0:$WLAN_NAME_LEN}
51### delete -va0 get wlan0
52 ROOT_WLAN=${1%%-*}
53fi
54ROOT_CONFIG_DIR=$CONFIG_ROOT_DIR/$ROOT_WLAN
55
56IS_ROOT_WLAN=0
57if [ "$1" = "$ROOT_WLAN" ]; then
58 IS_ROOT_WLAN=1
59fi
60echo "IS_ROOT_WLAN is " $IS_ROOT_WLAN
61SET_WLAN="iwpriv $1"
62SET_WLAN_PARAM="$SET_WLAN set_mib"
63IFCONFIG=ifconfig
64
65## Disable WLAN MAC driver and shutdown interface first ##
66$IFCONFIG $1 down
67if [ $? != 0 ]; then
68 exit $ERROR_NO_SUCH_DEVICE
69fi
70
71GET_VALUE=
72GET_VALUE_TMP=
73GET_VALUE_WLAN_DISABLED=`cat $CONFIG_DIR/wlan_disabled`
74GET_VALUE_WLAN_MODE=`cat $CONFIG_DIR/wlan_mode`
75
76echo "$CONFIG_DIR/wlan_disabled =$GET_VALUE_WLAN_DISABLED " >> $LOG
77echo "$CONFIG_DIR/wlan_mode =$GET_VALUE_WLAN_MODE " >> $LOG
78
79
80##$SET_WLAN set_mib vap_enable=0
81$SET_WLAN set_mib wsc_enable=0
82
83## kill wlan application daemon ##
84
85##$START_WLAN_APP kill $1
86
87## Set parameters to driver ##
88
89GET_VALUE=`cat $ROOT_CONFIG_DIR/reg_domain`
90$SET_WLAN set_mib regdomain=$GET_VALUE
91
92NUM=0
93case $1 in
94$ROOT_WLAN-va*)
95 NUM=${1#$ROOT_WLAN-va}
96 #NUM=$((NUM + 1))
97 NUM=`expr $NUM + 1`
98 ;;
99esac
100
101
102GET_VALUE=`cat $ROOT_CONFIG_DIR/wlan${NUM}_addr`
103iwpriv $1 set_mib hwaddr=$GET_VALUE
104
105echo "iwpriv $1 set_mib hwaddr=$GET_VALUE" >> $LOG
106
107if [ "$GET_VALUE_WLAN_MODE" = '1' ]; then
108 ## client mode 0: infrastructure 1:Ad-hoc
109
110 hwaddr=`cat /proc/wlan0-vxd/mib_all | grep hwaddr`
111
112 echo wlan0-vxd hwaddr=$hwaddr >> $LOG
113
114 GET_VALUE=`cat $CONFIG_DIR/network_type`
115 if [ "$GET_VALUE" = '0' ]; then
116 $SET_WLAN set_mib opmode=8
117 else
118 $SET_WLAN set_mib opmode=32
119 GET_VALUE_TMP=`cat $CONFIG_DIR/default_ssid`
120 $SET_WLAN set_mib defssid="$GET_VALUE_TMP"
121 fi
122 echo "wlan0-vxd do not set para, exit directly" >> $LOG
123 exit $ERROR_SUCCESS
124else
125 ## AP mode
126 $SET_WLAN set_mib opmode=16
127fi
128##$IFCONFIG $1 hw ether $WLAN_MAC_ADDR
129
130##if [ "$GET_VALUE_WLAN_MODE" = '2' ]; then
131## $SET_WLAN set_mib wds_pure=1
132##else
133## $SET_WLAN set_mib wds_pure=0
134##fi
135
136echo "set RF parameters" >> $LOG
137# set RF parameters
138if [ $IS_ROOT_WLAN = 1 ]; then
139 GET_VALUE=`cat $CONFIG_DIR/channel`
140 $SET_WLAN set_mib channel=$GET_VALUE
141##autochannel can use wifi_lte_intr
142 if [ "$wifi_lte_intr" = "1" -a "$GET_VALUE" = "0" ];then
143 echo "wifi_lte_intr=$wifi_lte_intr $SET_WLAN set_mib ch_low=5" >> $LOG
144 $SET_WLAN set_mib ch_low=5
145# $SET_WLAN set_mib disable_acs_ch=15
146 else
147 GET_VALUE=`cat $CONFIG_DIR/ch_low`
148 $SET_WLAN set_mib ch_low=$GET_VALUE
149 fi
150
151 GET_VALUE=`cat $CONFIG_DIR/ch_hi`
152 $SET_WLAN set_mib ch_hi=$GET_VALUE
153
154 GET_VALUE=`cat $CONFIG_DIR/led_type`
155 $SET_WLAN set_mib led_type=$GET_VALUE
156
157 GET_VALUE=`cat $CONFIG_DIR/MIMO_TR_mode`
158 $SET_WLAN set_mib MIMO_TR_mode=$GET_VALUE
159
160 #GET_TX_POWER_CCK_A=`cat $CONFIG_DIR/tx_power_cck_a`
161 #GET_TX_POWER_CCK_B=`cat $CONFIG_DIR/tx_power_cck_b`
162 #GET_TX_POWER_HT40_1S_A=`cat $CONFIG_DIR/tx_power_ht40_1s_a`
163 #GET_TX_POWER_HT40_1S_B=`cat $CONFIG_DIR/tx_power_ht40_1s_b`
164
165 #GET_TX_POWER_DIFF_HT40_2S=`cat $CONFIG_DIR/tx_power_diff_ht40_2s`
166 #GET_TX_POWER_DIFF_HT20=`cat $CONFIG_DIR/tx_power_diff_ht20`
167 #GET_TX_POWER_DIFF_OFDM=`cat $CONFIG_DIR/tx_power_diff_ofdm`
168
169 #$SET_WLAN set_mib pwrlevelCCK_A=$GET_TX_POWER_CCK_A
170 #$SET_WLAN set_mib pwrlevelCCK_B=$GET_TX_POWER_CCK_B
171 #$SET_WLAN set_mib pwrlevelHT40_1S_A=$GET_TX_POWER_HT40_1S_A
172 #$SET_WLAN set_mib pwrlevelHT40_1S_B=$GET_TX_POWER_HT40_1S_B
173 #$SET_WLAN set_mib pwrdiffHT40_2S=$GET_TX_POWER_DIFF_HT40_2S
174 #$SET_WLAN set_mib pwrdiffHT20=$GET_TX_POWER_DIFF_HT20
175 #$SET_WLAN set_mib pwrdiffOFDM=$GET_TX_POWER_DIFF_OFDM
176
177 GET_TX_POWER_PERCENT=`cat $CONFIG_DIR/tx_power_percet`
178 #echo "GET_TX_POWER_PERCENT is "$GET_TX_POWER_PERCENT
179 $SET_WLAN set_mib powerpercent=$GET_TX_POWER_PERCENT
180
181 GET_11N_TSSI1=`cat $CONFIG_DIR/tssi_1`
182 $SET_WLAN set_mib tssi1=$GET_11N_TSSI1
183 GET_11N_TSSI2=`cat $CONFIG_DIR/tssi_2`
184 $SET_WLAN set_mib tssi2=$GET_11N_TSSI2
185
186 #GET_VALUE=`cat $CONFIG_DIR/11n_ther`
187 #$SET_WLAN set_mib ther=$GET_VALUE
188
189 GET_VALUE=`cat $CONFIG_DIR/trswitch`
190 $SET_WLAN set_mib trswitch=$GET_VALUE
191
192 #GET_VALUE=`cat $CONFIG_DIR/11n_xcap`
193 #$SET_WLAN set_mib xcap=$GET_VALUE
194
195 #GET_VALUE=`cat $CONFIG_DIR/rfe_type`
196 #$SET_WLAN set_mib rfe_type=$GET_VALUE
197
198 #exit $ERROR_SUCCESS
199
200# iwpriv wlan0 efuse_set SD=3
201# iwpriv wlan0 efuse_sync
202# iwpriv wlan0 set_mib func_off=1
203
204fi # [ $IS_ROOT_WLAN = 1 ]
205
206GET_VALUE=`cat $CONFIG_DIR/basic_rates`
207$SET_WLAN set_mib basicrates=$GET_VALUE
208
209GET_VALUE=`cat $CONFIG_DIR/supported_rate`
210$SET_WLAN set_mib oprates=$GET_VALUE
211
212GET_RATE_ADAPTIVE_VALUE=`cat $CONFIG_DIR/rate_adaptive_enabled`
213if [ "$GET_RATE_ADAPTIVE_VALUE" = '0' ]; then
214 $SET_WLAN set_mib autorate=0
215 GET_FIX_RATE_VALUE=`cat $CONFIG_DIR/fix_rate`
216 $SET_WLAN set_mib fixrate=$GET_FIX_RATE_VALUE
217else
218 $SET_WLAN set_mib autorate=1
219fi
220
221GET_VALUE=`cat $CONFIG_DIR/rts_threshold`
222$SET_WLAN set_mib rtsthres=$GET_VALUE
223
224GET_VALUE=`cat $CONFIG_DIR/frag_threshold`
225$SET_WLAN set_mib fragthres=$GET_VALUE
226
227GET_VALUE=`cat $CONFIG_DIR/inactivity_time`
228$SET_WLAN set_mib expired_time=$GET_VALUE
229GET_VALUE=`cat $ROOT_CONFIG_DIR/beacon_interval`
230$SET_WLAN set_mib bcnint=$GET_VALUE
231
232GET_VALUE=`cat $ROOT_CONFIG_DIR/dtim_period`
233$SET_WLAN set_mib dtimperiod=$GET_VALUE
234
235GET_VALUE=`cat $CONFIG_DIR/preamble_type`
236$SET_WLAN set_mib preamble=$GET_VALUE
237GET_VALUE=`cat $CONFIG_DIR/hidden_ssid`
238$SET_WLAN set_mib hiddenAP=$GET_VALUE
239
240GET_VALUE=`cat $CONFIG_DIR/supported_sta_num`
241$SET_WLAN set_mib stanum=$GET_VALUE
242
243GET_VALUE=`cat $CONFIG_DIR/ssid`
244$SET_WLAN set_mib ssid="$GET_VALUE"
245
246GET_VALUE=`cat $CONFIG_DIR/macac_enabled`
247$SET_WLAN set_mib aclmode=$GET_VALUE
248$SET_WLAN set_mib aclnum=0
249#ACL_NUM=`cat $CONFIG_DIR/macac_num`
250#_counter=1
251#while [ $_counter -le $ACL_NUM ]; do
252# GET_VALUE=`cat $CONFIG_DIR/macac_addr$_counter`
253 #$SET_WLAN set_mib acladdr=$GET_VALUE
254# echo "----add_acl_table is "$GET_VALUE
255 #$SET_WLAN add_acl_table $GET_VALUE
256# _counter=$((_counter + 1))
257#done
258
259GET_WLAN_AUTH_TYPE=`cat $CONFIG_DIR/auth_type`
260AUTH_TYPE=$GET_WLAN_AUTH_TYPE
261GET_WLAN_ENCRYPT=`cat $CONFIG_DIR/encrypt`
262if [ "$GET_WLAN_AUTH_TYPE" = '1' ] && [ "$GET_WLAN_ENCRYPT" != '1' ]; then
263 # shared-key and not WEP enabled, force to open-system
264 AUTH_TYPE=0
265fi
266$SET_WLAN set_mib authtype=$AUTH_TYPE
267if [ "$GET_WLAN_ENCRYPT" = '0' ]; then
268 $SET_WLAN set_mib encmode=0
269elif [ "$GET_WLAN_ENCRYPT" = '1' ]; then
270 ### WEP mode ##
271 GET_WEP=`cat $CONFIG_DIR/wep`
272 GET_WEP_KEY_TYPE=`cat $CONFIG_DIR/wep_key_type`
273 GET_WEP_KEY_ID=`cat $CONFIG_DIR/wep_default_key`
274
275 if [ "$GET_WEP" = '1' ]; then
276 if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
277 GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_asc`
278 GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_asc`
279 GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_asc`
280 GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_asc`
281 else
282 GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_64_hex`
283 GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_64_hex`
284 GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_64_hex`
285 GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_64_hex`
286 fi
287
288 $SET_WLAN set_mib encmode=1
289 $SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
290 $SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
291 $SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
292 $SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
293 $SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
294 else
295 if [ "$GET_WEP_KEY_TYPE" = '0' ]; then
296 GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_asc`
297 GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_asc`
298 GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_asc`
299 GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_asc`
300 else
301 GET_WEP_KEY_1=`cat $CONFIG_DIR/wepkey1_128_hex`
302 GET_WEP_KEY_2=`cat $CONFIG_DIR/wepkey2_128_hex`
303 GET_WEP_KEY_3=`cat $CONFIG_DIR/wepkey3_128_hex`
304 GET_WEP_KEY_4=`cat $CONFIG_DIR/wepkey4_128_hex`
305 fi
306 $SET_WLAN set_mib encmode=5
307 $SET_WLAN set_mib wepkey1=$GET_WEP_KEY_1
308 $SET_WLAN set_mib wepkey2=$GET_WEP_KEY_2
309 $SET_WLAN set_mib wepkey3=$GET_WEP_KEY_3
310 $SET_WLAN set_mib wepkey4=$GET_WEP_KEY_4
311 $SET_WLAN set_mib wepdkeyid=$GET_WEP_KEY_ID
312 fi
313else
314 ## WPA mode ##
315 $SET_WLAN set_mib encmode=2
316fi
317##$SET_WLAN set_mib wds_enable=0
318##$SET_WLAN set_mib wds_encrypt=0
319## Set 802.1x flag ##
320_ENABLE_1X=0
321if [ $GET_WLAN_ENCRYPT -lt 2 ]; then
322 GET_ENABLE_1X=`cat $CONFIG_DIR/enable_1x`
323 GET_MAC_AUTH_ENABLED=`cat $CONFIG_DIR/mac_auth_enabled`
324 if [ "$GET_ENABLE_1X" != 0 ] || [ "$GET_MAC_AUTH_ENABLED" != 0 ]; then
325 _ENABLE_1X=1
326 fi
327else
328 _ENABLE_1X=1
329fi
330$SET_WLAN set_mib 802_1x=$_ENABLE_1X
331 #set band
332GET_BAND=`cat $ROOT_CONFIG_DIR/band`
333GET_WIFI_SPECIFIC=`cat $ROOT_CONFIG_DIR/wifi_specific`
334if [ "$GET_VALUE_WLAN_MODE" != '1' ] && [ "$GET_WIFI_SPECIFIC" = 1 ] && [ "$GET_BAND" = '2' ] ; then
335 GET_BAND=3
336fi
337if [ "$GET_BAND" = '8' ]; then
338 GET_BAND=11
339 $SET_WLAN set_mib deny_legacy=3
340elif [ "$GET_BAND" = '2' ]; then
341 GET_BAND=3
342 $SET_WLAN set_mib deny_legacy=1
343elif [ "$GET_BAND" = '10' ]; then
344 GET_BAND=11
345 $SET_WLAN set_mib deny_legacy=1
346elif [ "$GET_BAND" = '64' ]; then
347 GET_BAND=76
348 $SET_WLAN set_mib deny_legacy=12
349elif [ "$GET_BAND" = '72' ]; then
350 GET_BAND=76
351 $SET_WLAN set_mib deny_legacy=4
352else
353 $SET_WLAN set_mib deny_legacy=0
354fi
355$SET_WLAN set_mib band=$GET_BAND
356
357
358echo "Set 11n parameter" >> $LOG
359###Set 11n parameter
360 if [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ] || [ $GET_BAND = 76 ]; then
361 if [ $IS_ROOT_WLAN = 1 ]; then
362 GET_CHANNEL_BONDING=`cat $CONFIG_DIR/channel_bonding`
363 $SET_WLAN set_mib use40M=$GET_CHANNEL_BONDING
364
365 GET_CONTROL_SIDEBAND=`cat $CONFIG_DIR/control_sideband`
366
367 if [ "$GET_CHANNEL_BONDING" = 0 ]; then
368 $SET_WLAN set_mib 2ndchoffset=0
369 else
370 if [ "$GET_CONTROL_SIDEBAND" = 0 ]; then
371 $SET_WLAN set_mib 2ndchoffset=1
372 fi
373 if [ "$GET_CONTROL_SIDEBAND" = 1 ]; then
374 $SET_WLAN set_mib 2ndchoffset=2
375 fi
376 fi
377 fi # [ $IS_ROOT_WLAN = 1 ]
378
379 GET_SHORT_GI=`cat $CONFIG_DIR/short_gi`
380 $SET_WLAN set_mib shortGI20M=$GET_SHORT_GI
381 $SET_WLAN set_mib shortGI40M=$GET_SHORT_GI
382
383 GET_AGGREGATION=`cat $CONFIG_DIR/aggregation`
384
385 if [ "$GET_AGGREGATION" = 0 ]; then
386 $SET_WLAN set_mib ampdu=$GET_AGGREGATION
387 $SET_WLAN set_mib amsdu=$GET_AGGREGATION
388 elif [ "$GET_AGGREGATION" = 1 ]; then
389 $SET_WLAN set_mib ampdu=1
390 $SET_WLAN set_mib amsdu=0
391 elif [ "$GET_AGGREGATION" = 2 ]; then
392 $SET_WLAN set_mib ampdu=0
393 $SET_WLAN set_mib amsdu=1
394 elif [ "$GET_AGGREGATION" = 3 ]; then
395 $SET_WLAN set_mib ampdu=1
396 $SET_WLAN set_mib amsdu=1
397 fi
398
399 GET_STBC_ENABLED=`cat $CONFIG_DIR/stbc_enabled`
400 $SET_WLAN set_mib stbc=$GET_STBC_ENABLED
401 GET_COEXIST_ENABLED=`cat $CONFIG_DIR/coexist_enabled`
402 $SET_WLAN set_mib coexist=$GET_COEXIST_ENABLED
403 fi # [ $GET_BAND = 10 ] || [ $GET_BAND = 11 ]
404##########
405
406#set nat2.5 disable when client and mac clone is set
407GET_MACCLONE_ENABLED=`cat $CONFIG_DIR/macclone_enable`
408if [ "$GET_MACCLONE_ENABLED" = '1' -a "$GET_VALUE_WLAN_MODE" = '1' ]; then
409 $SET_WLAN set_mib nat25_disable=1
410 $SET_WLAN set_mib macclone_enable=1
411else
412 $SET_WLAN set_mib nat25_disable=0
413 $SET_WLAN set_mib macclone_enable=0
414fi
415
416# set 11g protection mode
417GET_PROTECTION_DISABLED=`cat $CONFIG_DIR/protection_disabled`
418if [ "$GET_PROTECTION_DISABLED" = '1' ] ;then
419 $SET_WLAN set_mib disable_protection=1
420else
421 $SET_WLAN set_mib disable_protection=0
422fi
423
424# for ap isolation
425GET_VALUE=`cat $CONFIG_DIR/group_id`
426$SET_WLAN set_mib groupID=$GET_VALUE
427
428# set block relay
429GET_VALUE=`cat $CONFIG_DIR/block_relay`
430$SET_WLAN set_mib block_relay=$GET_VALUE
431
432
433# set WiFi specific mode
434GET_VALUE=`cat $ROOT_CONFIG_DIR/wifi_specific`
435$SET_WLAN set_mib wifi_specific=$GET_VALUE
436
437# for WMM
438GET_VALUE=`cat $CONFIG_DIR/wmm_enabled`
439$SET_WLAN set_mib qos_enable=$GET_VALUE
440
441# for guest access
442GET_VALUE=`cat $CONFIG_DIR/guest_access`
443$SET_WLAN set_mib guest_access=$GET_VALUE
444
445
446
447# for country code
448#COUNTRY_CODE_ENABLE=`$SET_WLAN get_mib countrycode 2> /dev/null`
449if [ ! -z "$COUNTRY_CODE_ENABLE" ]; then
450GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode_enable`
451# $SET_WLAN set_mib countrycode=$GET_VALUE
452
453GET_VALUE=`cat $ROOT_CONFIG_DIR/countrycode`
454# $SET_WLAN set_mib countrystr=$GET_VALUE
455
456
457fi
458
459echo "wpa relative settings" >> $LOG
460#
461# following settings is used when driver WPA module is included
462#
463
464GET_WPA_AUTH=`cat $CONFIG_DIR/wpa_auth`
465#if [ $GET_VALUE_WLAN_MODE != 1 ] && [ $GET_WLAN_ENCRYPT -ge 2 ] && [ $GET_WLAN_ENCRYPT -lt 7 ] && [ $GET_WPA_AUTH = 2 ]; then
466if [ $GET_WLAN_ENCRYPT -ge 2 ] && [ $GET_WLAN_ENCRYPT -lt 11 ]; then
467 if [ $GET_WPA_AUTH = 2 ]; then
468 if [ $GET_WLAN_ENCRYPT = 2 ]; then
469 ENABLE=1
470 elif [ $GET_WLAN_ENCRYPT = 4 ]; then
471 ENABLE=2
472 elif [ $GET_WLAN_ENCRYPT = 6 ]; then
473 ENABLE=3
474 elif [ $GET_WLAN_ENCRYPT = 8 ]; then
475 ENABLE=8
476 elif [ $GET_WLAN_ENCRYPT = 10 ]; then
477 ENABLE=10
478 else
479 echo "invalid ENCRYPT value!($GET_WLAN_ENCRYPT)" >> $LOG
480 exit $ERROR_INVALID_PARAMETERS;
481 fi
482 $SET_WLAN set_mib psk_enable=$ENABLE
483 else
484 $SET_WLAN set_mib psk_enable=0
485 fi
486
487 if [ $GET_WLAN_ENCRYPT = 2 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
488 GET_WPA_CIPHER_SUITE=`cat $CONFIG_DIR/wpa_cipher`
489 if [ $GET_WPA_CIPHER_SUITE = 1 ]; then
490 CIPHER=2
491 elif [ $GET_WPA_CIPHER_SUITE = 2 ]; then
492 CIPHER=8
493 elif [ $GET_WPA_CIPHER_SUITE = 3 ]; then
494 CIPHER=10
495 else
496 echo "invalid WPA_CIPHER_SUITE value!($GET_WPA_CIPHER_SUITE)" >> $LOG
497 exit $ERROR_INVALID_PARAMETERS;
498 fi
499 fi
500 $SET_WLAN set_mib wpa_cipher=$CIPHER
501
502 if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ] || [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
503 GET_WPA2_CIPHER_SUITE=`cat $CONFIG_DIR/wpa2_cipher`
504 if [ $GET_WPA2_CIPHER_SUITE = 1 ]; then
505 CIPHER=2
506 elif [ $GET_WPA2_CIPHER_SUITE = 2 ]; then
507 CIPHER=8
508 elif [ $GET_WPA2_CIPHER_SUITE = 3 ]; then
509 CIPHER=10
510 else
511 echo "invalid WPA2_CIPHER_SUITE value!($GET_WPA2_CIPHER_SUITE)" >> $LOG
512 exit $ERROR_INVALID_PARAMETERS;
513 fi
514 fi
515 $SET_WLAN set_mib wpa2_cipher=$CIPHER
516
517 GET_WPA_PSK=`cat $CONFIG_DIR/wpa_psk`
518 $SET_WLAN set_mib passphrase="$GET_WPA_PSK"
519
520
521 GET_WPA_GROUP_REKEY_TIME=`cat $CONFIG_DIR/gk_rekey`
522 $SET_WLAN set_mib gk_rekey=$GET_WPA_GROUP_REKEY_TIME
523fi
524# Set 11w parameter #
525#if [ $GET_WLAN_ENCRYPT = 4 ] || [ $GET_WLAN_ENCRYPT = 6 ]; then
526# GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
527# GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
528# if [ $GET_WPA2_11W = 0 ]; then
529# GET_WPA2_SHA256=0
530# elif [ $GET_WPA2_11W = 1 ]; then
531# if [ "$GET_WPA2_SHA256" != '0' ] && [ "$GET_WPA2_SHA256" != '1' ]; then
532# GET_WPA2_SHA256=0
533# fi
534# elif [ $GET_WPA2_11W = 2 ]; then
535# GET_WPA2_SHA256=1
536# else
537# echo "invalid GET_WPA2_11W value!($GET_WPA2_11W)";
538# exit $ERROR_INVALID_PARAMETERS;
539# fi
540#else
541# GET_WPA2_11W=0
542# GET_WPA2_SHA256=0
543#fi
544
545if [ $GET_WLAN_ENCRYPT = 8 ] || [ $GET_WLAN_ENCRYPT = 10 ]; then
546 GET_WPA2_11W=`cat $CONFIG_DIR/wpa11w`
547 GET_WPA2_SHA256=`cat $CONFIG_DIR/wpa2EnableSHA256`
548 $SET_WLAN set_mib dot11IEEE80211W=$GET_WPA2_11W
549 $SET_WLAN set_mib enableSHA256=$GET_WPA2_SHA256
550else
551 echo "Only WPA3 need PMF" >> $LOG
552 $SET_WLAN set_mib dot11IEEE80211W=0
553 $SET_WLAN set_mib enableSHA256=0
554fi
555
556##########