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 client_cert
"$vif" client_cert
91 config_get priv_key
"$vif" priv_key
92 config_get priv_key_pwd
"$vif" priv_key_pwd
93 identity
="identity=\"$identity\""
94 client_cert
="client_cert=\"$client_cert\""
95 priv_key
="private_key=\"$priv_key\""
96 priv_key_pwd
="private_key_passwd=\"$priv_key_pwd\""
99 config_get auth
"$vif" auth
100 config_get identity
"$vif" identity
101 config_get password
"$vif" password
102 phase2
="phase2=\"auth=${auth:-MSCHAPV2}\""
103 identity
="identity=\"$identity\""
104 password
="password=\"$password\""
107 eap_type
="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
111 case "$ieee80211w" in
113 ieee80211w
="ieee80211w=$ieee80211w"
117 config_get ifname
"$vif" ifname
118 config_get bridge
"$vif" bridge
119 config_get ssid
"$vif" ssid
120 config_get bssid
"$vif" bssid
121 bssid
=${bssid:+"bssid=$bssid"}
122 rm -rf /var
/run
/wpa_supplicant-
$ifname
123 cat > /var
/run
/wpa_supplicant-
$ifname.conf
<<EOF
124 ctrl_interface=/var/run/wpa_supplicant-$ifname
150 [ -z "$proto" -a "$key_mgmt" != "NONE" ] || \
151 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