2 append DRIVERS "mac80211"
8 config_get vifs "$device" vifs
11 config_get ifname "$vif" ifname
12 config_set "$vif" ifname "${ifname:-$device}"
14 config_get mode "$vif" mode
19 *) echo "$device($vif): Invalid mode, ignored."; continue;;
23 config_set "$device" vifs "${ap:+$ap }${adhoc:+$adhoc }${ahdemo:+$ahdemo }${sta:+$sta }${wds:+$wds }"
30 set_wifi_down "$device"
31 # kill all running hostapd and wpa_supplicant processes that
32 # are running on atheros/mac80211 vifs
33 for pid in `pidof hostapd wpa_supplicant`; do
34 grep wlan /proc/$pid/cmdline >/dev/null && \
41 grep "$device" "$dev/%parent" >/dev/null 2>/dev/null && {
51 config_get channel "$device" channel
52 config_get vifs "$device" vifs
56 config_get ifname "$vif" ifname
57 config_get enc "$vif" encryption
58 config_get mode "$vif" mode
60 config_get ifname "$vif" ifname
62 echo "enable_mac80211($device): Failed to set up $mode vif $ifname" >&2
65 config_set "$vif" ifname "$ifname"
68 # only need to change freq band and channel on the first vif
69 iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null
70 if [ "$mode" = adhoc ]; then
71 iwlist "$ifname" scan >/dev/null 2>/dev/null
73 iwconfig "$ifname" mode ad-hoc >/dev/null 2>/dev/null
77 iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null
83 for idx in 1 2 3 4; do
84 config_get key "$vif" "key${idx}"
85 iwconfig "$ifname" enc "[$idx]" "${key:-off}"
87 config_get key "$vif" key
90 [1234]) iwconfig "$ifname" enc "[$key]";;
91 *) iwconfig "$ifname" enc "$key";;
95 config_get key "$vif" key
101 config_get addr "$vif" bssid
103 iwconfig "$ifname" ap "$addr"
107 config_get ssid "$vif" ssid
109 config_get txpwr "$vif" txpower
110 if [ -n "$txpwr" ]; then
111 iwconfig "$ifname" txpower "${txpwr%%.*}"
114 config_get frag "$vif" frag
115 if [ -n "$frag" ]; then
116 iwconfig "$ifname" frag "${frag%%.*}"
119 config_get rts "$vif" rts
120 if [ -n "$rts" ]; then
121 iwconfig "$ifname" rts "${rts%%.*}"
124 ifconfig "$ifname" up
125 iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null
128 net_cfg="$(find_net_config "$vif")"
129 [ -z "$net_cfg" ] || {
130 bridge="$(bridge_interface "$net_cfg")"
131 config_set "$vif" bridge "$bridge"
132 start_net "$ifname" "$net_cfg"
134 iwconfig "$ifname" essid "$ssid"
135 set_wifi_up "$vif" "$ifname"
138 if eval "type hostapd_setup_vif" 2>/dev/null >/dev/null; then
139 hostapd_setup_vif "$vif" nl80211 || {
140 echo "enable_mac80211($device): Failed to set up wpa for interface $ifname" >&2
141 # make sure this wifi interface won't accidentally stay open without encryption
142 ifconfig "$ifname" down
156 cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
157 ctrl_interface=/var/run/wpa_supplicant
168 #add wpa_supplicant calls here
171 [ -z "$proto" ] || wpa_supplicant ${bridge:+ -b $bridge} -B -D wext -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf
181 for dev in $(ls -d wlan* 2>&-); do
182 config_get type "$dev" type
183 [ "$type" = mac80211 ] && return
185 config wifi-device $dev
189 # REMOVE THIS LINE TO ENABLE WIFI:
197 option encryption none