1 wpa_supplicant_setup_vif
() {
7 # wpa_supplicant should use wext for mac80211 cards
8 [ "$driver" = "mac80211" ] && driver
='wext'
10 # make sure we have the encryption type and the psk
12 config_get enc
"$vif" encryption
15 config_get key
"$vif" key
19 config_get bridge
"$vif" bridge
21 net_cfg
="$(find_net_config "$vif")"
22 [ -z "$net_cfg" ] || bridge
="$(bridge_interface "$net_cfg")"
23 config_set
"$vif" bridge
"$bridge"
32 config_get key
"$vif" key
36 for idx
in 1 2 3 4; do
39 config_get ckey
"$vif" "key${idx}"
41 append
"wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
43 wep_tx_keyidx
="wep_tx_keyidx=$((key - 1))"
46 wep_key0
="wep_key0=$(prepare_key_wep "$key")"
47 wep_tx_keyidx
="wep_tx_keyidx=0"
53 config_get_bool usepassphrase
"$vif" passphrase
1
54 if [ "$usepassphrase" = "1" ]; then
55 passphrase
="psk=\"${key}\""
57 passphrase
="psk=${key}"
62 config_get ieee80211w
"$vif" ieee80211w
72 config_get ieee80211w
"$vif" ieee80211w
73 config_get ca_cert
"$vif" ca_cert
74 config_get eap_type
"$vif" eap_type
75 ca_cert
=${ca_cert:+"ca_cert=\"$ca_cert\""}
78 pairwise
='pairwise=CCMP'
80 config_get identity
"$vif" identity
81 config_get priv_key
"$vif" priv_key
82 config_get priv_key_pwd
"$vif" priv_key_pwd
83 identity
="identity=\"$identity\""
84 priv_key
="private_key=\"$priv_key\""
85 priv_key_pwd
="private_key_passwd=\"$priv_key_pwd\""
88 config_get auth
"$vif" auth
89 config_get identity
"$vif" identity
90 config_get password
"$vif" password
91 phase2
="phase2=\"auth=${auth:-MSCHAPV2}\""
92 identity
="identity=\"$identity\""
93 password
="password=\"$password\""
96 eap_type
="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
100 case "$ieee80211w" in
102 ieee80211w
="ieee80211w=$ieee80211w"
106 config_get ifname
"$vif" ifname
107 config_get bridge
"$vif" bridge
108 config_get ssid
"$vif" ssid
109 config_get bssid
"$vif" bssid
110 bssid
=${bssid:+"bssid=$bssid"}
111 rm -rf /var
/run
/wpa_supplicant-
$ifname
112 cat > /var
/run
/wpa_supplicant-
$ifname.conf
<<EOF
113 ctrl_interface=/var/run/wpa_supplicant-$ifname
138 [ -z "$proto" -a "$key_mgmt" != "NONE" ] || \
139 wpa_supplicant
${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var
/run
/wpa_supplicant-
$ifname.conf
$options