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
56 ifconfig
"$ifname" down
57 config_get ifname
"$vif" ifname
58 config_get enc
"$vif" encryption
59 config_get eap_type
"$vif" eap_type
60 config_get mode
"$vif" mode
62 config_get ifname
"$vif" ifname
64 echo "enable_mac80211($device): Failed to set up $mode vif $ifname" >&2
67 config_set
"$vif" ifname
"$ifname"
70 # only need to change freq band and channel on the first vif
71 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
72 if [ "$mode" = adhoc
]; then
73 iwlist
"$ifname" scan
>/dev
/null
2>/dev
/null
75 iwconfig
"$ifname" mode ad-hoc
>/dev
/null
2>/dev
/null
78 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
80 if [ "$mode" = sta
]; then
81 iwconfig
"$ifname" mode managed
>/dev
/null
2>/dev
/null
83 iwconfig
"$ifname" mode
$mode >/dev
/null
2>/dev
/null
89 for idx
in 1 2 3 4; do
90 config_get key
"$vif" "key${idx}"
91 iwconfig
"$ifname" enc
"[$idx]" "${key:-off}"
93 config_get key
"$vif" key
96 [1234]) iwconfig
"$ifname" enc
"[$key]";;
97 *) iwconfig
"$ifname" enc
"$key";;
101 config_get key
"$vif" key
107 config_get addr
"$vif" bssid
109 iwconfig
"$ifname" ap
"$addr"
113 config_get ssid
"$vif" ssid
115 config_get txpwr
"$vif" txpower
116 if [ -n "$txpwr" ]; then
117 iwconfig
"$ifname" txpower
"${txpwr%%.*}"
120 config_get frag
"$vif" frag
121 if [ -n "$frag" ]; then
122 iwconfig
"$ifname" frag
"${frag%%.*}"
125 config_get rts
"$vif" rts
126 if [ -n "$rts" ]; then
127 iwconfig
"$ifname" rts
"${rts%%.*}"
130 ifconfig
"$ifname" up
131 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
134 net_cfg
="$(find_net_config "$vif")"
135 [ -z "$net_cfg" ] ||
{
136 bridge
="$(bridge_interface "$net_cfg")"
137 config_set
"$vif" bridge
"$bridge"
138 start_net
"$ifname" "$net_cfg"
140 iwconfig
"$ifname" essid
"$ssid"
141 set_wifi_up
"$vif" "$ifname"
144 if eval "type hostapd_setup_vif" 2>/dev
/null
>/dev
/null
; then
145 hostapd_setup_vif
"$vif" nl80211 ||
{
146 echo "enable_mac80211($device): Failed to set up wpa for interface $ifname" >&2
147 # make sure this wifi interface won't accidentally stay open without encryption
148 ifconfig
"$ifname" down
154 if eval "type wpa_supplicant_setup_vif" 2>/dev
/null
>/dev
/null
; then
155 wpa_supplicant_setup_vif
"$vif" wext ||
{
156 echo "enable_mac80211($device): Failed to set up wpa_supplicant for interface $ifname" >&2
157 # make sure this wifi interface won't accidentally stay open without encryption
158 ifconfig
"$ifname" down
171 for dev
in $
(ls -d wlan
* 2>&-); do
172 config_get
type "$dev" type
173 [ "$type" = mac80211
] && return
175 config wifi-device $dev
179 # REMOVE THIS LINE TO ENABLE WIFI:
187 option encryption none
This page took 0.063053 seconds and 5 git commands to generate.