1 wpa_supplicant_setup_vif
() {
6 # wpa_supplicant should use wext for mac80211 cards
7 [ "$driver" = "mac80211" ] && driver
='wext'
9 # make sure we have the encryption type and the psk
11 config_get enc
"$vif" encryption
14 config_get key
"$vif" key
18 config_get bridge
"$vif" bridge
20 net_cfg
="$(find_net_config "$vif")"
21 [ -z "$net_cfg" ] || bridge
="$(bridge_interface "$net_cfg")"
22 config_set
"$vif" bridge
"$bridge"
31 config_get key
"$vif" key
35 for idx
in 1 2 3 4; do
38 config_get ckey
"$vif" "key${idx}"
40 append
"wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
42 wep_tx_keyidx
="wep_tx_keyidx=$((key - 1))"
45 wep_key0
="wep_key0=$(prepare_key_wep "$key")"
46 wep_tx_keyidx
="wep_tx_keyidx=0"
52 config_get_bool usepassphrase
"$vif" passphrase
1
53 if [ "$usepassphrase" = "1" ]; then
54 passphrase
="psk=\"${key}\""
56 passphrase
="psk=${key}"
61 config_get ieee80211w
"$vif" ieee80211w
71 config_get ieee80211w
"$vif" ieee80211w
72 config_get ca_cert
"$vif" ca_cert
73 config_get eap_type
"$vif" eap_type
74 ca_cert
=${ca_cert:+"ca_cert=\"$ca_cert\""}
77 pairwise
='pairwise=CCMP'
79 config_get priv_key
"$vif" priv_key
80 config_get priv_key_pwd
"$vif" priv_key_pwd
81 priv_key
="private_key=\"$priv_key\""
82 priv_key_pwd
="private_key_passwd=\"$priv_key_pwd\""
85 config_get auth
"$vif" auth
86 config_get identity
"$vif" identity
87 config_get password
"$vif" password
88 phase2
="phase2=\"auth=${auth:-MSCHAPV2}\""
89 identity
="identity=\"$identity\""
90 password
="password=\"$password\""
93 eap_type
="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
99 ieee80211w
="ieee80211w=$ieee80211w"
103 config_get ifname
"$vif" ifname
104 config_get bridge
"$vif" bridge
105 config_get ssid
"$vif" ssid
106 config_get bssid
"$vif" bssid
107 bssid
=${bssid:+"bssid=$bssid"}
108 rm -rf /var
/run
/wpa_supplicant-
$ifname
109 cat > /var
/run
/wpa_supplicant-
$ifname.conf
<<EOF
110 ctrl_interface=/var/run/wpa_supplicant-$ifname
135 [ -z "$proto" -a "$key_mgmt" != "NONE" ] || \
136 wpa_supplicant
${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var
/run
/wpa_supplicant-
$ifname.conf