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