2 .
/lib
/netifd
/netifd-wireless.sh
3 .
/lib
/netifd
/hostapd.sh
4 .
/lib
/netifd
/mac80211.sh
6 init_wireless_driver
"$@"
8 MP_CONFIG_INT
="mesh_retry_timeout mesh_confirm_timeout mesh_holding_timeout mesh_max_peer_links
9 mesh_max_retries mesh_ttl mesh_element_ttl mesh_hwmp_max_preq_retries
10 mesh_path_refresh_time mesh_min_discovery_timeout mesh_hwmp_active_path_timeout
11 mesh_hwmp_preq_min_interval mesh_hwmp_net_diameter_traversal_time mesh_hwmp_rootmode
12 mesh_hwmp_rann_interval mesh_gate_announcements mesh_sync_offset_max_neighor
13 mesh_rssi_threshold mesh_hwmp_active_path_to_root_timeout mesh_hwmp_root_interval
14 mesh_hwmp_confirmation_interval mesh_awake_window mesh_plink_timeout"
15 MP_CONFIG_BOOL
="mesh_auto_open_plinks mesh_fwding"
16 MP_CONFIG_STRING
="mesh_power_mode"
19 command iw $@ || logger
-t mac80211
"Failed command: iw $@"
22 drv_mac80211_init_device_config
() {
23 hostapd_common_add_device_config
25 config_add_string path phy
'macaddr:macaddr'
26 config_add_string hwmode
27 config_add_string tx_burst
28 config_add_int beacon_int chanbw frag rts
29 config_add_int rxantenna txantenna antenna_gain txpower distance
30 config_add_boolean noscan ht_coex acs_exclude_dfs
31 config_add_array ht_capab
32 config_add_array channels
46 config_add_int vht_max_a_mpdu_len_exp vht_max_mpdu vht_link_adapt vht160 rx_stbc tx_stbc
56 drv_mac80211_init_iface_config
() {
57 hostapd_common_add_bss_config
59 config_add_string
'macaddr:macaddr' ifname
61 config_add_boolean wds powersave
62 config_add_int maxassoc
63 config_add_int max_listen_int
64 config_add_int dtim_period
65 config_add_int start_disabled
68 config_add_string mesh_id
69 config_add_int
$MP_CONFIG_INT
70 config_add_boolean
$MP_CONFIG_BOOL
71 config_add_string
$MP_CONFIG_STRING
74 mac80211_add_capabilities
() {
75 local __var
="$1"; shift
76 local __mask
="$1"; shift
84 [ "$(($4))" -gt 0 ] ||
continue
85 [ "$(($__mask & $2))" -eq "$((${3:-$2}))" ] ||
continue
90 export -n -- "$__var=$__out"
93 mac80211_hostapd_setup_base
() {
98 [ "$auto_channel" -gt 0 ] && channel
=acs_survey
99 [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
101 [ "$auto_channel" -gt 0 ] && json_get_vars acs_exclude_dfs
102 [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
103 append base_cfg
"acs_exclude_dfs=1" "$N"
105 json_get_vars noscan ht_coex
106 json_get_values ht_capab_list ht_capab tx_burst
108 [ -n "$noscan" -a "$noscan" -gt 0 ] && hostapd_noscan
=1
109 [ "$tx_burst" = 0 ] && tx_burst
=
115 HT40
*|VHT40|VHT80|VHT160
)
118 case "$(( ($channel / 4) % 2 ))" in
119 1) ht_capab
="[HT40+]";;
120 0) ht_capab
="[HT40-]";;
125 HT40
+) ht_capab
="[HT40+]";;
126 HT40-
) ht_capab
="[HT40-]";;
128 if [ "$channel" -lt 7 ]; then
137 [ "$auto_channel" -gt 0 ] && ht_capab
="[HT40+]"
142 [ -n "$ieee80211n" ] && {
143 append base_cfg
"ieee80211n=1" "$N"
145 set_default ht_coex
0
146 append base_cfg
"ht_coex=$ht_coex" "$N"
159 for cap
in $
(iw phy
"$phy" info |
grep 'Capabilities:' | cut
-d: -f2); do
160 ht_cap_mask
="$(($ht_cap_mask | $cap))"
163 cap_rx_stbc
=$
((($ht_cap_mask >> 8) & 3))
164 [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc
="$rx_stbc"
165 ht_cap_mask
="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))"
167 mac80211_add_capabilities ht_capab_flags
$ht_cap_mask \
169 GF
:0x10::$greenfield \
170 SHORT-GI-20
:0x20::$short_gi_20 \
171 SHORT-GI-40
:0x40::$short_gi_40 \
172 TX-STBC
:0x80::$tx_stbc \
173 RX-STBC1
:0x300:0x100:1 \
174 RX-STBC12
:0x300:0x200:1 \
175 RX-STBC123
:0x300:0x300:1 \
176 MAX-AMSDU-7935
:0x800::$max_amsdu \
177 DSSS_CCK-40
:0x1000::$dsss_cck_40
179 ht_capab
="$ht_capab$ht_capab_flags"
180 [ -n "$ht_capab" ] && append base_cfg
"ht_capab=$ht_capab" "$N"
189 case "$(( ($channel / 4) % 2 ))" in
190 1) idx
=$
(($channel + 2));;
191 0) idx
=$
(($channel - 2));;
194 append base_cfg
"vht_oper_chwidth=0" "$N"
195 append base_cfg
"vht_oper_centr_freq_seg0_idx=$idx" "$N"
198 case "$(( ($channel / 4) % 4 ))" in
199 1) idx
=$
(($channel + 6));;
200 2) idx
=$
(($channel + 2));;
201 3) idx
=$
(($channel - 2));;
202 0) idx
=$
(($channel - 6));;
205 append base_cfg
"vht_oper_chwidth=1" "$N"
206 append base_cfg
"vht_oper_centr_freq_seg0_idx=$idx" "$N"
210 36|
40|
44|
48|
52|
56|
60|
64) idx
=50;;
211 100|
104|
108|
112|
116|
120|
124|
128) idx
=114;;
214 append base_cfg
"vht_oper_chwidth=2" "$N"
215 append base_cfg
"vht_oper_centr_freq_seg0_idx=$idx" "$N"
219 if [ "$enable_ac" != "0" ]; then
231 rx_antenna_pattern
:1 \
232 tx_antenna_pattern
:1 \
233 vht_max_a_mpdu_len_exp
:7 \
239 set_default tx_burst
2.0
240 append base_cfg
"ieee80211ac=1" "$N"
242 for cap
in $
(iw phy
"$phy" info |
awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do
243 vht_cap
="$(($vht_cap | $cap))"
246 cap_rx_stbc
=$
((($vht_cap >> 8) & 7))
247 [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc
="$rx_stbc"
248 vht_cap
="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
250 mac80211_add_capabilities vht_capab
$vht_cap \
251 RXLDPC
:0x10::$rxldpc \
252 SHORT-GI-80
:0x20::$short_gi_80 \
253 SHORT-GI-160
:0x40::$short_gi_160 \
254 TX-STBC-2BY1
:0x80::$tx_stbc_2by1 \
255 SU-BEAMFORMER
:0x800::$su_beamformer \
256 SU-BEAMFORMEE
:0x1000::$su_beamformee \
257 MU-BEAMFORMER
:0x80000::$mu_beamformer \
258 MU-BEAMFORMEE
:0x100000::$mu_beamformee \
259 VHT-TXOP-PS
:0x200000::$vht_txop_ps \
260 HTC-VHT
:0x400000::$htc_vht \
261 RX-ANTENNA-PATTERN
:0x10000000::$rx_antenna_pattern \
262 TX-ANTENNA-PATTERN
:0x20000000::$tx_antenna_pattern \
263 RX-STBC-1
:0x700:0x100:1 \
264 RX-STBC-12
:0x700:0x200:1 \
265 RX-STBC-123
:0x700:0x300:1 \
266 RX-STBC-1234
:0x700:0x400:1 \
268 # supported Channel widths
270 [ "$(($vht_cap & 12))" -eq 4 -a 1 -le "$vht160" ] && \
272 [ "$(($vht_cap & 12))" -eq 8 -a 2 -le "$vht160" ] && \
274 [ "$vht160_hw" = 1 ] && vht_capab
="$vht_capab[VHT160]"
275 [ "$vht160_hw" = 2 ] && vht_capab
="$vht_capab[VHT160-80PLUS80]"
277 # maximum MPDU length
279 [ "$(($vht_cap & 3))" -ge 1 -a 7991 -le "$vht_max_mpdu" ] && \
281 [ "$(($vht_cap & 3))" -ge 2 -a 11454 -le "$vht_max_mpdu" ] && \
282 vht_max_mpdu_hw
=11454
283 [ "$vht_max_mpdu_hw" != 3895 ] && \
284 vht_capab
="$vht_capab[MAX-MPDU-$vht_max_mpdu_hw]"
286 # maximum A-MPDU length exponent
287 vht_max_a_mpdu_len_exp_hw
=0
288 [ "$(($vht_cap & 58720256))" -ge 8388608 -a 1 -le "$vht_max_a_mpdu_len_exp" ] && \
289 vht_max_a_mpdu_len_exp_hw
=1
290 [ "$(($vht_cap & 58720256))" -ge 16777216 -a 2 -le "$vht_max_a_mpdu_len_exp" ] && \
291 vht_max_a_mpdu_len_exp_hw
=2
292 [ "$(($vht_cap & 58720256))" -ge 25165824 -a 3 -le "$vht_max_a_mpdu_len_exp" ] && \
293 vht_max_a_mpdu_len_exp_hw
=3
294 [ "$(($vht_cap & 58720256))" -ge 33554432 -a 4 -le "$vht_max_a_mpdu_len_exp" ] && \
295 vht_max_a_mpdu_len_exp_hw
=4
296 [ "$(($vht_cap & 58720256))" -ge 41943040 -a 5 -le "$vht_max_a_mpdu_len_exp" ] && \
297 vht_max_a_mpdu_len_exp_hw
=5
298 [ "$(($vht_cap & 58720256))" -ge 50331648 -a 6 -le "$vht_max_a_mpdu_len_exp" ] && \
299 vht_max_a_mpdu_len_exp_hw
=6
300 [ "$(($vht_cap & 58720256))" -ge 58720256 -a 7 -le "$vht_max_a_mpdu_len_exp" ] && \
301 vht_max_a_mpdu_len_exp_hw
=7
302 vht_capab
="$vht_capab[MAX-A-MPDU-LEN-EXP$vht_max_a_mpdu_len_exp_hw]"
304 # whether or not the STA supports link adaptation using VHT variant
306 [ "$(($vht_cap & 201326592))" -ge 134217728 -a 2 -le "$vht_link_adapt" ] && \
308 [ "$(($vht_cap & 201326592))" -ge 201326592 -a 3 -le "$vht_link_adapt" ] && \
310 [ "$vht_link_adapt_hw" != 0 ] && \
311 vht_capab
="$vht_capab[VHT-LINK-ADAPT-$vht_link_adapt_hw]"
313 [ -n "$vht_capab" ] && append base_cfg
"vht_capab=$vht_capab" "$N"
316 hostapd_prepare_device_config
"$hostapd_conf_file" nl80211
317 cat >> "$hostapd_conf_file" <<EOF
318 ${channel:+channel=$channel}
319 ${channel_list:+chanlist=$channel_list}
320 ${hostapd_noscan:+noscan=1}
321 ${tx_burst:+tx_queue_data2_burst=$tx_burst}
328 mac80211_hostapd_setup_bss
() {
335 append hostapd_cfg
"$type=$ifname" "$N"
337 hostapd_set_bss_options hostapd_cfg
"$vif" ||
return 1
338 json_get_vars wds dtim_period max_listen_int start_disabled
341 set_default start_disabled
0
343 [ "$wds" -gt 0 ] && append hostapd_cfg
"wds_sta=1" "$N"
344 [ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg
"start_disabled=1" "$N"
346 cat >> /var
/run
/hostapd-
$phy.conf
<<EOF
349 ${dtim_period:+dtim_period=$dtim_period}
350 ${max_listen_int:+max_listen_interval=$max_listen_int}
354 mac80211_get_addr
() {
356 local idx
="$(($2 + 1))"
358 head -n $
(($macidx + 1)) /sys
/class
/ieee80211
/${phy}/addresses |
tail -n1
361 mac80211_generate_mac
() {
363 local id
="${macidx:-0}"
365 local ref
="$(cat /sys/class/ieee80211/${phy}/macaddress)"
366 local mask
="$(cat /sys/class/ieee80211/${phy}/address_mask)"
368 [ "$mask" = "00:00:00:00:00:00" ] && {
369 mask
="ff:ff:ff:ff:ff:ff";
371 [ "$(wc -l < /sys/class/ieee80211/${phy}/addresses)" -gt 1 ] && {
372 addr
="$(mac80211_get_addr "$phy" "$id")"
380 local oIFS
="$IFS"; IFS
=":"; set -- $mask; IFS
="$oIFS"
385 local oIFS
="$IFS"; IFS
=":"; set -- $ref; IFS
="$oIFS"
388 [ "$((0x$mask1))" -gt 0 ] && {
391 b1
=$
(($b1 ^
((($id - 1) << 2) | 0x2)))
392 printf "%02x:%s:%s:%s:%s:%s" $b1 $2 $3 $4 $5 $6
396 [ "$((0x$mask6))" -lt 255 ] && {
397 printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $(( 0x$6 ^ $id ))
401 off2=$(( (0x$6 + $id) / 0x100 ))
402 printf "%s:%s:%s:%s:%02x:%02x" \
404 $(( (0x$5 + $off2) % 0x100 )) \
405 $(( (0x$6 + $id) % 0x100 ))
409 [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
411 phy="$(mac80211_path_to_phy "$path")"
412 [ -n "$phy" ] && return 0
414 [ -n "$macaddr" ] && {
415 for phy in $(ls /sys/class/ieee80211 2>/dev
/null
); do
416 grep -i -q "$macaddr" "/sys/class/ieee80211/${phy}/macaddress" && return 0
422 mac80211_check_ap
() {
426 mac80211_iw_interface_add
() {
433 iw phy
"$phy" interface add
"$ifname" type "$type" $wdsflag
437 # Device might have just been deleted, give the kernel some time to finish cleaning it up
440 iw phy
"$phy" interface add
"$ifname" type "$type" $wdsflag
445 # Device might not support virtual interfaces, so the interface never got deleted in the first place.
446 # Check if the interface already exists, and avoid failing in this case.
447 ip link show dev
"$ifname" >/dev
/null
2>/dev
/null
&& rc
=0
450 [ "$rc" != 0 ] && wireless_setup_failed INTERFACE_CREATION_FAILED
454 mac80211_prepare_vif
() {
457 json_get_vars ifname mode ssid wds powersave macaddr
459 [ -n "$ifname" ] || ifname
="wlan${phy#phy}${if_idx:+-$if_idx}"
460 if_idx
=$
((${if_idx:-0} + 1))
463 set_default powersave
0
467 [ -n "$macaddr" ] ||
{
468 macaddr
="$(mac80211_generate_mac $phy)"
469 macidx
="$(($macidx + 1))"
473 json_add_string ifname
"$ifname"
477 # It is far easier to delete and create the desired interface
480 mac80211_iw_interface_add
"$phy" "$ifname" adhoc ||
return
483 # Hostapd will handle recreating the interface and
484 # subsequent virtual APs belonging to the same PHY
485 if [ -n "$hostapd_ctrl" ]; then
491 mac80211_hostapd_setup_bss
"$phy" "$ifname" "$macaddr" "$type" ||
return
493 [ -n "$hostapd_ctrl" ] ||
{
494 mac80211_iw_interface_add
"$phy" "$ifname" __ap ||
return
495 hostapd_ctrl
="${hostapd_ctrl:-/var/run/hostapd/$ifname}"
499 mac80211_iw_interface_add
"$phy" "$ifname" mp ||
return
502 mac80211_iw_interface_add
"$phy" "$ifname" monitor ||
return
506 staidx
="$(($staidx + 1))"
507 [ "$wds" -gt 0 ] && wdsflag
="4addr on"
508 mac80211_iw_interface_add
"$phy" "$ifname" managed
"$wdsflag" ||
return
509 [ "$powersave" -gt 0 ] && powersave
="on" || powersave
="off"
510 iw
"$ifname" set power_save
"$powersave"
516 [ "$auto_channel" -gt 0 ] || iw dev
"$ifname" set channel
"$channel" $htmode
520 if [ "$mode" != "ap" ]; then
521 # ALL ap functionality will be passed to hostapd
522 # All interfaces must have unique mac addresses
523 # which can either be explicitly set in the device
524 # section, or automatically generated
525 ip link
set dev
"$ifname" address
"$macaddr"
531 mac80211_setup_supplicant
() {
532 wpa_supplicant_prepare_interface
"$ifname" nl80211 ||
return 1
533 if [ "$mode" = "sta" ]; then
534 wpa_supplicant_add_network
"$ifname"
536 wpa_supplicant_add_network
"$ifname" "$freq" "$htmode" "$noscan"
538 wpa_supplicant_run
"$ifname" ${hostapd_ctrl:+-H $hostapd_ctrl}
541 mac80211_setup_supplicant_noctl
() {
542 wpa_supplicant_prepare_interface
"$ifname" nl80211 ||
return 1
543 wpa_supplicant_add_network
"$ifname" "$freq" "$htmode" "$noscan"
544 wpa_supplicant_run
"$ifname"
547 mac80211_setup_adhoc_htmode
() {
549 VHT20|HT20
) ibss_htmode
=HT20
;;
553 case "$(( ($channel / 4) % 2 ))" in
554 1) ibss_htmode
="HT40+" ;;
555 0) ibss_htmode
="HT40-";;
560 HT40
+) ibss_htmode
="HT40+";;
561 HT40-
) ibss_htmode
="HT40-";;
563 if [ "$channel" -lt 7 ]; then
572 [ "$auto_channel" -gt 0 ] && ibss_htmode
="HT40+"
585 mac80211_setup_adhoc
() {
586 json_get_vars bssid ssid key mcast_rate
589 [ "$auth_type" = "wep" ] && {
594 for idx
in 1 2 3 4; do
595 json_get_var ikey
"key$idx"
598 ikey
="$(($idx - 1)):$(prepare_key_wep "$ikey")"
599 [ $idx -eq $key ] && ikey
="d:$ikey"
600 append keyspec
"$ikey"
605 append keyspec
"d:0:$(prepare_key_wep "$key")"
611 for br
in $basic_rate_list; do
612 wpa_supplicant_add_rate brstr
"$br"
616 [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval
"$mcast_rate"
618 iw dev
"$ifname" ibss
join "$ssid" $freq $ibss_htmode fixed-freq
$bssid \
619 beacon-interval
$beacon_int \
620 ${brstr:+basic-rates $brstr} \
621 ${mcval:+mcast-rate $mcval} \
622 ${keyspec:+keys $keyspec}
625 mac80211_setup_mesh
() {
626 json_get_vars ssid mesh_id mcast_rate
629 [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval
"$mcast_rate"
630 [ -n "$mesh_id" ] && ssid
="$mesh_id"
633 VHT20|HT20
) mesh_htmode
=HT20
;;
637 case "$(( ($channel / 4) % 2 ))" in
638 1) mesh_htmode
="HT40+" ;;
639 0) mesh_htmode
="HT40-";;
644 HT40
+) mesh_htmode
="HT40+";;
645 HT40-
) mesh_htmode
="HT40-";;
647 if [ "$channel" -lt 7 ]; then
663 *) mesh_htmode
="NOHT" ;;
665 iw dev
"$ifname" mesh
join "$ssid" freq
$freq $mesh_htmode \
666 ${mcval:+mcast-rate $mcval} \
667 beacon-interval
$beacon_int
670 mac80211_setup_vif
() {
680 json_get_var vif_txpower txpower
682 ip link
set dev
"$ifname" up ||
{
683 wireless_setup_vif_failed IFUP_ERROR
688 set_default vif_txpower
"$txpower"
689 [ -z "$vif_txpower" ] || iw dev
"$ifname" set txpower fixed
"${vif_txpower%%.*}00"
693 wireless_vif_parse_encryption
694 freq
="$(get_freq "$phy" "$channel")"
695 if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs
"$phy" "$channel"; then
696 mac80211_setup_supplicant || failed
=1
700 for var
in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do
701 json_get_var mp_val
"$var"
702 [ -n "$mp_val" ] && iw dev
"$ifname" set mesh_param
"$var" "$mp_val"
706 wireless_vif_parse_encryption
707 mac80211_setup_adhoc_htmode
708 if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then
709 freq
="$(get_freq "$phy" "$channel")"
710 mac80211_setup_supplicant_noctl || failed
=1
716 mac80211_setup_supplicant || failed
=1
721 [ -n "$failed" ] || wireless_add_vif
"$name" "$ifname"
727 iw
"$phy" info |
grep -E -m1 "(\* ${chan:-....} MHz${chan:+|\\[$chan\\]})" | grep MHz | awk '{print $2}'
733 iw "$phy" info | grep -E -m1 "(\
* ${chan:-....} MHz
${chan:+|\\[$chan\\]})" | grep -q "MHz.
*radar detection
"
737 mac80211_interface_cleanup() {
740 for wdev in $(list_phy_interfaces "$phy"); do
741 local wdev_phy="$
(readlink
/sys
/class
/net
/${wdev}/phy80211
)"
742 wdev_phy="$
(basename "$wdev_phy")"
743 [ -n "$wdev_phy" -a "$wdev_phy" != "$phy" ] && continue
744 ip link set dev "$wdev" down 2>/dev/null
749 mac80211_set_noscan() {
753 drv_mac80211_cleanup() {
754 hostapd_common_cleanup
757 drv_mac80211_setup() {
761 country chanbw distance \
762 txpower antenna_gain \
763 rxantenna txantenna \
764 frag rts beacon_int:100 htmode
765 json_get_values basic_rate_list basic_rate
769 echo "Could not
find PHY
for device
'$1'"
774 wireless_set_data phy="$phy"
775 mac80211_interface_cleanup "$phy"
777 # convert channel to frequency
778 [ "$auto_channel" -gt 0 ] || freq="$
(get_freq
"$phy" "$channel")"
780 [ -n "$country" ] && {
781 iw reg get | grep -q "^country
$country:" || {
782 iw reg set "$country"
787 hostapd_conf_file="/var
/run
/hostapd-
$phy.conf
"
793 [ -n "$chanbw" ] && {
794 for file in /sys/kernel/debug/ieee80211/$phy/ath9k/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do
795 [ -f "$file" ] && echo "$chanbw" > "$file"
799 set_default rxantenna 0xffffffff
800 set_default txantenna 0xffffffff
801 set_default distance 0
802 set_default antenna_gain 0
804 [ "$txantenna" = "all
" ] && txantenna=0xffffffff
805 [ "$rxantenna" = "all
" ] && rxantenna=0xffffffff
807 iw phy "$phy" set antenna $txantenna $rxantenna >/dev/null 2>&1
808 iw phy "$phy" set antenna_gain $antenna_gain
809 iw phy "$phy" set distance "$distance"
811 [ -n "$frag" ] && iw phy "$phy" set frag "${frag%%.*}"
812 [ -n "$rts" ] && iw phy "$phy" set rts "${rts%%.*}"
817 for_each_interface "ap
" mac80211_check_ap
819 rm -f "$hostapd_conf_file"
821 for_each_interface "sta adhoc mesh
" mac80211_set_noscan
822 [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy"
824 for_each_interface "sta adhoc mesh monitor
" mac80211_prepare_vif
825 for_each_interface "ap
" mac80211_prepare_vif
827 [ -n "$hostapd_ctrl" ] && {
828 /usr/sbin/hostapd -s -P /var/run/wifi-$phy.pid -B "$hostapd_conf_file"
830 wireless_add_process "$
(cat /var
/run
/wifi-
$phy.pid
)" "/usr
/sbin
/hostapd
" 1
832 wireless_setup_failed HOSTAPD_START_FAILED
837 for_each_interface "ap sta adhoc mesh monitor
" mac80211_setup_vif
842 list_phy_interfaces() {
844 if [ -d "/sys
/class
/ieee80211
/${phy}/device
/net
" ]; then
845 ls "/sys
/class
/ieee80211
/${phy}/device
/net
" 2>/dev/null;
847 ls "/sys
/class
/ieee80211
/${phy}/device
" 2>/dev/null | grep net: | sed -e 's,net:,,g'
851 drv_mac80211_teardown() {
852 wireless_process_kill_all
858 mac80211_interface_cleanup "$phy"