7 # psk-mixed/tkip => WPA1+2 PSK, TKIP
8 # wpa-psk2/tkip+aes => WPA2 PSK, CCMP+TKIP
9 # wpa2/tkip+aes => WPA2 RADIUS, CCMP+TKIP
12 # TODO: move this parsing function somewhere generic, so that
13 # later it can be reused by drivers that don't use hostapd
15 # crypto defaults: WPA2 vs WPA1
17 wpa2
*|WPA2
*|
*PSK2
*|
*psk2
*)
31 # explicit override for crypto setting
33 *tkip
+aes|
*TKIP
+AES|
*tkip
+ccmp|
*TKIP
+CCMP
) crypto
="CCMP TKIP";;
34 *tkip|
*TKIP
) crypto
="TKIP";;
35 *aes|
*AES|
*ccmp|
*CCMP
) crypto
="CCMP";;
38 # use crypto/auth settings for building the hostapd config
41 config_get psk
"$vif" key
42 if [ ${#psk} -eq 64 ]; then
43 append hostapd_cfg
"wpa_psk=$psk" "$N"
45 append hostapd_cfg
"wpa_passphrase=$psk" "$N"
49 # required fields? formats?
50 # hostapd is particular, maybe a default configuration for failures
51 config_get server
"$vif" server
52 append hostapd_cfg
"auth_server_addr=$server" "$N"
53 config_get port
"$vif" port
55 append hostapd_cfg
"auth_server_port=$port" "$N"
56 config_get secret
"$vif" key
57 append hostapd_cfg
"auth_server_shared_secret=$secret" "$N"
58 config_get nasid
"$vif" nasid
59 append hostapd_cfg
"nas_identifier=$nasid" "$N"
60 append hostapd_cfg
"eapol_key_index_workaround=1" "$N"
61 append hostapd_cfg
"radius_acct_interim_interval=300" "$N"
62 append hostapd_cfg
"ieee8021x=1" "$N"
63 append hostapd_cfg
"auth_algs=1" "$N"
64 append hostapd_cfg
"wpa_key_mgmt=WPA-EAP" "$N"
65 append hostapd_cfg
"wpa_group_rekey=300" "$N"
66 append hostapd_cfg
"wpa_gmk_rekey=640" "$N"
73 config_get ifname
"$vif" ifname
74 config_get bridge
"$vif" bridge
75 config_get ssid
"$vif" ssid
76 config_get device
"$vif" device
77 config_get channel
"$device" channel
78 config_get hwmode
"$device" hwmode
79 config_get wpa_group_rekey
"$vif" wpa_group_rekey
80 config_get ieee80211d
"$vif" ieee80211d
84 config_get country
"$device" country
85 [ "$channel" = auto
] && channel
=
86 [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode
"$device"
88 config_get hwmode_11n
"$device" hwmode_11n
89 [ -n "$hwmode_11n" ] && {
91 config_get ht_capab
"$device" ht_capab
94 cat > /var
/run
/hostapd-
$ifname.conf
<<EOF
95 ctrl_interface=/var/run/hostapd-$ifname
98 ${hwmode:+hw_mode=$hwmode}
99 ${channel:+channel=$channel}
100 ${bridge:+bridge=$bridge}
103 ${crypto:+wpa_pairwise=$crypto}
104 ${country:+country_code=$country}
105 ${hwmode_11n:+ieee80211n=1}
106 ${ht_capab:+ht_capab=$ht_capab}
107 ${wpa_group_rekey:+wpa_group_rekey=$wpa_group_rekey}
108 ${ieee80211d:+ieee80211d=$ieee80211d}
114 wme_ac_bk_txop_limit=0
119 wme_ac_be_txop_limit=0
124 wme_ac_vi_txop_limit=94
129 wme_ac_vo_txop_limit=47
131 tx_queue_data3_aifs=7
132 tx_queue_data3_cwmin=15
133 tx_queue_data3_cwmax=1023
134 tx_queue_data3_burst=0
135 tx_queue_data2_aifs=3
136 tx_queue_data2_cwmin=15
137 tx_queue_data2_cwmax=63
138 tx_queue_data2_burst=0
139 tx_queue_data1_aifs=1
140 tx_queue_data1_cwmin=7
141 tx_queue_data1_cwmax=15
142 tx_queue_data1_burst=3.0
143 tx_queue_data0_aifs=1
144 tx_queue_data0_cwmin=3
145 tx_queue_data0_cwmax=7
146 tx_queue_data0_burst=1.5
148 hostapd
-P /var
/run
/wifi-
$ifname.pid
-B /var
/run
/hostapd-
$ifname.conf