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 eap_type
"$vif" eap_type
59 config_get mode
"$vif" mode
61 config_get ifname
"$vif" ifname
63 echo "enable_mac80211($device): Failed to set up $mode vif $ifname" >&2
66 config_set
"$vif" ifname
"$ifname"
69 # only need to change freq band and channel on the first vif
70 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
71 if [ "$mode" = adhoc
]; then
72 iwlist
"$ifname" scan
>/dev
/null
2>/dev
/null
74 iwconfig
"$ifname" mode ad-hoc
>/dev
/null
2>/dev
/null
78 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
84 for idx
in 1 2 3 4; do
85 config_get key
"$vif" "key${idx}"
86 iwconfig
"$ifname" enc
"[$idx]" "${key:-off}"
88 config_get key
"$vif" key
91 [1234]) iwconfig
"$ifname" enc
"[$key]";;
92 *) iwconfig
"$ifname" enc
"$key";;
96 config_get key
"$vif" key
102 config_get addr
"$vif" bssid
104 iwconfig
"$ifname" ap
"$addr"
108 config_get ssid
"$vif" ssid
110 config_get txpwr
"$vif" txpower
111 if [ -n "$txpwr" ]; then
112 iwconfig
"$ifname" txpower
"${txpwr%%.*}"
115 config_get frag
"$vif" frag
116 if [ -n "$frag" ]; then
117 iwconfig
"$ifname" frag
"${frag%%.*}"
120 config_get rts
"$vif" rts
121 if [ -n "$rts" ]; then
122 iwconfig
"$ifname" rts
"${rts%%.*}"
125 ifconfig
"$ifname" up
126 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
129 net_cfg
="$(find_net_config "$vif")"
130 [ -z "$net_cfg" ] ||
{
131 bridge
="$(bridge_interface "$net_cfg")"
132 config_set
"$vif" bridge
"$bridge"
133 start_net
"$ifname" "$net_cfg"
135 iwconfig
"$ifname" essid
"$ssid"
136 set_wifi_up
"$vif" "$ifname"
139 if eval "type hostapd_setup_vif" 2>/dev
/null
>/dev
/null
; then
140 hostapd_setup_vif
"$vif" nl80211 ||
{
141 echo "enable_mac80211($device): Failed to set up wpa for interface $ifname" >&2
142 # make sure this wifi interface won't accidentally stay open without encryption
143 ifconfig
"$ifname" down
149 if eval "type wpa_supplicant_setup_vif" 2>/dev
/null
>/dev
/null
; then
150 wpa_supplicant_setup_vif
"$vif" wext ||
{
151 echo "enable_mac80211($device): Failed to set up wpa_supplicant for interface $ifname" >&2
152 # make sure this wifi interface won't accidentally stay open without encryption
153 ifconfig
"$ifname" down
166 for dev
in $
(ls -d wlan
* 2>&-); do
167 config_get
type "$dev" type
168 [ "$type" = mac80211
] && return
170 config wifi-device $dev
174 # REMOVE THIS LINE TO ENABLE WIFI:
182 option encryption none