2 append DRIVERS
"prism2"
9 config_get vifs
"$device" vifs
12 config_get mode
"$vif" mode
15 # Only one vif is allowed on AP, station, Ad-hoc or monitor mode
16 [ -z "$mainvif" ] && {
18 config_set
"$vif" ifname
"$device"
22 config_get ssid
"$vif" ssid
23 [ -z "$ssid" ] && continue
24 config_set
"$vif" ifname
"${device}wds${_c}"
27 ${addr:+append wds "$vif"}
29 *) echo "$device($vif): Invalid mode, ignored."; continue;;
32 config_set
"$device" vifs
"${mainvif:+$mainvif }${wds:+$wds}"
38 set_wifi_down
"$device"
41 while read line
< /proc
/net
/hostap
/${device}/wds
; do
43 [ -f "/var/run/wifi-${1}.pid" ] &&
44 kill "$(cat "/var
/run
/wifi-
${1}.pid
")"
47 iwpriv
"$device" wds_del
"$2"
56 config_get rxantenna
"$device" rxantenna
57 config_get txantenna
"$device" txantenna
58 config_get_bool diversity
"$device" diversity
59 [ -n "$diversity" ] && {
63 [ -n "$rxantenna" ] && iwpriv
$device antsel_rx
"$rxantenna"
64 [ -n "$txantenna" ] && iwpriv
$device antsel_tx
"$txantenna"
66 config_get channel
"$device" channel
67 [ -n "$channel" ] && iwconfig
"$device" channel
"$channel" >/dev
/null
2>/dev
/null
69 config_get txpower
"$device" txpower
70 [ -n "$txpower" ] && iwconfig
"$device" txpower
"${txpower%%.*}"
72 config_get vifs
"$device" vifs
75 config_get ifname
"$vif" ifname
76 config_get ssid
"$vif" ssid
77 config_get mode
"$vif" mode
79 [ "$mode" = "wds" ] || iwconfig
"$device" essid
-- "$ssid"
83 iwconfig
"$device" mode managed
84 config_get addr
"$device" bssid
86 iwconfig
"$device" ap
"$addr"
89 ap
) iwconfig
"$device" mode master
;;
90 wds
) iwpriv
"$device" wds_add
"$ssid";;
91 *) iwconfig
"$device" mode
"$mode";;
95 config_get rate
"$vif" rate
96 [ -n "$rate" ] && iwconfig
"$device" rate
"${rate%%.*}"
98 config_get_bool hidden
"$vif" hidden
0
99 iwpriv
"$device" enh_sec
"$hidden"
101 config_get frag
"$vif" frag
102 [ -n "$frag" ] && iwconfig
"$device" frag
"${frag%%.*}"
104 config_get rts
"$vif" rts
105 [ -n "$rts" ] && iwconfig
"$device" rts
"${rts%%.*}"
107 config_get maclist
"$vif" maclist
108 [ -n "$maclist" ] && {
110 iwpriv
"$device" maccmd
3
111 for mac
in $maclist; do
112 iwpriv
"$device" addmac
"$mac"
115 config_get macpolicy
"$vif" macpolicy
118 iwpriv
$device maccmd
2
121 iwpriv
$device maccmd
1
124 # default deny policy if mac list exists
125 [ -n "$maclist" ] && iwpriv
$device maccmd
1
128 # kick all stations if we have policy explicitly set
129 [ -n "$macpolicy" ] && iwpriv
$device maccmd
4
132 config_get enc
"$vif" encryption
135 for idx
in 1 2 3 4; do
136 config_get key
"$vif" "key${idx}"
137 iwconfig
"$ifname" enc
"[$idx]" "${key:-off}"
139 config_get key
"$vif" key
142 [1234]) iwconfig
"$ifname" enc
"[$key]";;
143 *) iwconfig
"$ifname" enc
"$key";;
148 config_get key
"$vif" key
153 net_cfg
="$(find_net_config "$vif")"
154 [ -z "$net_cfg" ] ||
{
155 bridge
="$(bridge_interface "$net_cfg")"
156 config_set
"$vif" bridge
"$bridge"
157 start_net
"$ifname" "$net_cfg"
159 set_wifi_up
"$vif" "$ifname"
163 if [ -n "$start_hostapd" ] && eval "type hostapd_setup_vif" 2>/dev
/null
>/dev
/null
; then
164 hostapd_setup_vif
"$vif" hostap ||
{
165 echo "enable_prism2($device): Failed to set up hostapd for interface $ifname" >&2
166 # make sure this wifi interface won't accidentally stay open without encryption
167 ifconfig
"$ifname" down
173 if eval "type wpa_supplicant_setup_vif" 2>/dev
/null
>/dev
/null
; then
174 wpa_supplicant_setup_vif
"$vif" hostap ||
{
175 echo "enable_prism2($device): Failed to set up wpa_supplicant for interface $ifname" >&2
176 ifconfig
"$ifname" down
189 [ -d wlan
* ] ||
return
190 for dev
in $
(ls -d wlan
* 2>&-); do
191 config_get
type "$dev" type
192 [ "$type" = prism2
] && continue
195 config wifi-device $dev
199 # REMOVE THIS LINE TO ENABLE WIFI:
207 option encryption none