mac80211: fix RTS threshold not being set for mac80211 devices
[openwrt.git] / package / wpa_supplicant / files / wpa_supplicant.sh
1 wpa_supplicant_setup_vif() {
2 local vif="$1"
3 local driver="$2"
4 local key="$key"
5
6 # wpa_supplicant should use wext for mac80211 cards
7 [ "$driver" = "mac80211" ] && driver='wext'
8
9 # make sure we have the psk
10 [ -n "$key" ] || {
11 config_get key "$vif" key
12 }
13
14 case "$enc" in
15 *psk*)
16 key_mgmt='WPA-PSK'
17 config_get_bool usepassphrase "$vif" passphrase 1
18 case "$enc" in
19 *psk2*)
20 proto='RSN'
21 if [ "$usepassphrase" = "1" ]; then
22 passphrase="psk=\"${key}\""
23 else
24 passphrase="psk=${key}"
25 fi
26 ;;
27 *psk*)
28 proto='WPA'
29 if [ "$usepassphrase" = "1" ]; then
30 passphrase="psk=\"${key}\""
31 else
32 passphrase="psk=${key}"
33 fi
34 ;;
35 esac
36 ;;
37 *wpa*|*8021x*)
38 proto='WPA2'
39 key_mgmt='WPA-EAP'
40 config_get ca_cert "$vif" ca_cert
41 ca_cert=${ca_cert:+"ca_cert=\"$ca_cert\""}
42 case "$eap_type" in
43 tls)
44 pairwise='pairwise=CCMP'
45 group='group=CCMP'
46 config_get priv_key "$vif" priv_key
47 config_get priv_key_pwd "$vif" priv_key_pwd
48 priv_key="private_key=\"$priv_key\""
49 priv_key_pwd="private_key_passwd=\"$priv_key_pwd\""
50 ;;
51 peap|ttls)
52 config_get auth "$vif" auth
53 config_get identity "$vif" identity
54 config_get password "$vif" password
55 phase2="phase2=\"auth=${auth:-MSCHAPV2}\""
56 identity="identity=\"$identity\""
57 password="password=\"$password\""
58 ;;
59 esac
60 eap_type="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
61 ;;
62 esac
63 config_get ifname "$vif" ifname
64 config_get bridge "$vif" bridge
65 config_get ssid "$vif" ssid
66 config_get bssid "$vif" bssid
67 bssid=${bssid:+"bssid=$bssid"}
68 cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
69 ctrl_interface=/var/run/wpa_supplicant-$ifname
70 network={
71 scan_ssid=1
72 ssid="$ssid"
73 $bssid
74 key_mgmt=$key_mgmt
75 proto=$proto
76 $passphrase
77 $pairwise
78 $group
79 $eap_type
80 $ca_cert
81 $priv_key
82 $priv_key_pwd
83 $phase2
84 $identity
85 $password
86 }
87 EOF
88 [ -z "$proto" ] || wpa_supplicant ${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf
89 }
This page took 0.052352 seconds and 5 git commands to generate.