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"
27 config_get mode
"$vif" mode
28 config_get ifname
"$vif" ifname
29 config_get_bool wds
"$vif" wds
0
30 [ -z "$bridge" ] ||
[ "$mode" = ap
] ||
[ "$mode" = sta
-a $wds -eq 1 ] ||
{
31 echo "wpa_supplicant_setup_vif($ifname): Refusing to bridge $mode mode interface"
41 config_get key
"$vif" key
45 for idx
in 1 2 3 4; do
48 config_get ckey
"$vif" "key${idx}"
50 append
"wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
52 wep_tx_keyidx
="wep_tx_keyidx=$((key - 1))"
55 wep_key0
="wep_key0=$(prepare_key_wep "$key")"
56 wep_tx_keyidx
="wep_tx_keyidx=0"
62 config_get_bool usepassphrase
"$vif" passphrase
1
63 if [ "$usepassphrase" = "1" ]; then
64 passphrase
="psk=\"${key}\""
66 passphrase
="psk=${key}"
71 config_get ieee80211w
"$vif" ieee80211w
81 config_get ieee80211w
"$vif" ieee80211w
82 config_get ca_cert
"$vif" ca_cert
83 config_get eap_type
"$vif" eap_type
84 ca_cert
=${ca_cert:+"ca_cert=\"$ca_cert\""}
87 pairwise
='pairwise=CCMP'
89 config_get identity
"$vif" identity
90 config_get priv_key
"$vif" priv_key
91 config_get priv_key_pwd
"$vif" priv_key_pwd
92 identity
="identity=\"$identity\""
93 priv_key
="private_key=\"$priv_key\""
94 priv_key_pwd
="private_key_passwd=\"$priv_key_pwd\""
97 config_get auth
"$vif" auth
98 config_get identity
"$vif" identity
99 config_get password
"$vif" password
100 phase2
="phase2=\"auth=${auth:-MSCHAPV2}\""
101 identity
="identity=\"$identity\""
102 password
="password=\"$password\""
105 eap_type
="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
109 case "$ieee80211w" in
111 ieee80211w
="ieee80211w=$ieee80211w"
115 config_get ifname
"$vif" ifname
116 config_get bridge
"$vif" bridge
117 config_get ssid
"$vif" ssid
118 config_get bssid
"$vif" bssid
119 bssid
=${bssid:+"bssid=$bssid"}
120 rm -rf /var
/run
/wpa_supplicant-
$ifname
121 cat > /var
/run
/wpa_supplicant-
$ifname.conf
<<EOF
122 ctrl_interface=/var/run/wpa_supplicant-$ifname
147 [ -z "$proto" -a "$key_mgmt" != "NONE" ] || \
148 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