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 ca_cert
=${ca_cert:+"ca_cert=\"$ca_cert\""}
76 pairwise
='pairwise=CCMP'
78 config_get priv_key
"$vif" priv_key
79 config_get priv_key_pwd
"$vif" priv_key_pwd
80 priv_key
="private_key=\"$priv_key\""
81 priv_key_pwd
="private_key_passwd=\"$priv_key_pwd\""
84 config_get auth
"$vif" auth
85 config_get identity
"$vif" identity
86 config_get password
"$vif" password
87 phase2
="phase2=\"auth=${auth:-MSCHAPV2}\""
88 identity
="identity=\"$identity\""
89 password
="password=\"$password\""
92 eap_type
="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
98 ieee80211w
="ieee80211w=$ieee80211w"
102 config_get ifname
"$vif" ifname
103 config_get bridge
"$vif" bridge
104 config_get ssid
"$vif" ssid
105 config_get bssid
"$vif" bssid
106 bssid
=${bssid:+"bssid=$bssid"}
107 rm -rf /var
/run
/wpa_supplicant-
$ifname
108 cat > /var
/run
/wpa_supplicant-
$ifname.conf
<<EOF
109 ctrl_interface=/var/run/wpa_supplicant-$ifname
134 [ -z "$proto" -a "$key_mgmt" != "NONE" ] || \
135 wpa_supplicant
${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var
/run
/wpa_supplicant-
$ifname.conf