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 }${monitor:+$monitor}"
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
53 config_get txpower
"$device" txpower
57 ifconfig
"$ifname" down
2>/dev
/null
58 config_get ifname
"$vif" ifname
59 config_get enc
"$vif" encryption
60 config_get eap_type
"$vif" eap_type
61 config_get mode
"$vif" mode
63 config_get ifname
"$vif" ifname
65 echo "enable_mac80211($device): Failed to set up $mode vif $ifname" >&2
68 config_set
"$vif" ifname
"$ifname"
71 # only need to change freq band and channel on the first vif
72 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
73 if [ "$mode" = adhoc
]; then
74 iwlist
"$ifname" scan
>/dev
/null
2>/dev
/null
76 iwconfig
"$ifname" mode ad-hoc
>/dev
/null
2>/dev
/null
79 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
81 if [ "$mode" = sta
]; then
82 iwconfig
"$ifname" mode managed
>/dev
/null
2>/dev
/null
84 iwconfig
"$ifname" mode
$mode >/dev
/null
2>/dev
/null
90 for idx
in 1 2 3 4; do
91 config_get key
"$vif" "key${idx}"
92 iwconfig
"$ifname" enc
"[$idx]" "${key:-off}"
94 config_get key
"$vif" key
97 [1234]) iwconfig
"$ifname" enc
"[$key]";;
98 *) iwconfig
"$ifname" enc
"$key";;
102 config_get key
"$vif" key
108 config_get addr
"$vif" bssid
110 iwconfig
"$ifname" ap
"$addr"
114 config_get ssid
"$vif" ssid
116 config_get vif_txpower
"$vif" txpower
117 # use vif_txpower (from wifi-iface) to override txpower (from
118 # wifi-device) if the latter doesn't exist
119 txpower
="${txpower:-$vif_txpower}"
120 [ -z "$txpower" ] || iwconfig
"$ifname" txpower
"${txpower%%.*}"
122 config_get frag
"$vif" frag
123 if [ -n "$frag" ]; then
124 iwconfig
"$ifname" frag
"${frag%%.*}"
127 config_get rts
"$vif" rts
128 if [ -n "$rts" ]; then
129 iwconfig
"$ifname" rts
"${rts%%.*}"
132 ifconfig
"$ifname" up
133 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
136 net_cfg
="$(find_net_config "$vif")"
137 [ -z "$net_cfg" ] ||
{
138 bridge
="$(bridge_interface "$net_cfg")"
139 config_set
"$vif" bridge
"$bridge"
140 start_net
"$ifname" "$net_cfg"
142 iwconfig
"$ifname" essid
"$ssid"
143 set_wifi_up
"$vif" "$ifname"
146 if eval "type hostapd_setup_vif" 2>/dev
/null
>/dev
/null
; then
147 hostapd_setup_vif
"$vif" nl80211 ||
{
148 echo "enable_mac80211($device): Failed to set up wpa for interface $ifname" >&2
149 # make sure this wifi interface won't accidentally stay open without encryption
150 ifconfig
"$ifname" down
156 if eval "type wpa_supplicant_setup_vif" 2>/dev
/null
>/dev
/null
; then
157 wpa_supplicant_setup_vif
"$vif" wext ||
{
158 echo "enable_mac80211($device): Failed to set up wpa_supplicant for interface $ifname" >&2
159 # make sure this wifi interface won't accidentally stay open without encryption
160 ifconfig
"$ifname" down
173 for dev
in $
(ls -d wlan
* 2>&-); do
174 config_get
type "$dev" type
175 [ "$type" = mac80211
] && return
177 config wifi-device $dev
181 # REMOVE THIS LINE TO ENABLE WIFI:
189 option encryption none
This page took 0.0554789999999999 seconds and 5 git commands to generate.