Implement ifconfig_wlanX="HOSTAP".
Not only this is a bit cleaner, it allows multiple instances of hostapd to be running on the system host, useful for simultaneous dual-band WiFi. This is similar to ifconfig_wlanX="WPA" but it uses /etc/hostapd-wlanX.conf. Compatibility with hostapd_enable=YES/NO was kept. Reviewed by: adrian
This commit is contained in:
parent
8ab18d3034
commit
6f79f29583
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252230
@ -171,6 +171,9 @@ ifconfig_up()
|
|||||||
if wpaif $1; then
|
if wpaif $1; then
|
||||||
/etc/rc.d/wpa_supplicant start $1
|
/etc/rc.d/wpa_supplicant start $1
|
||||||
_cfg=0 # XXX: not sure this should count
|
_cfg=0 # XXX: not sure this should count
|
||||||
|
elif hostapif $1; then
|
||||||
|
/etc/rc.d/hostapd start $1
|
||||||
|
_cfg=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if dhcpif $1; then
|
if dhcpif $1; then
|
||||||
@ -198,6 +201,9 @@ ifconfig_down()
|
|||||||
if wpaif $1; then
|
if wpaif $1; then
|
||||||
/etc/rc.d/wpa_supplicant stop $1
|
/etc/rc.d/wpa_supplicant stop $1
|
||||||
_cfg=0
|
_cfg=0
|
||||||
|
elif hostapif $1; then
|
||||||
|
/etc/rc.d/hostapd stop $1
|
||||||
|
_cfg=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if dhcpif $1; then
|
if dhcpif $1; then
|
||||||
@ -276,6 +282,7 @@ ifconfig_getargs()
|
|||||||
[Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;;
|
[Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;;
|
||||||
[Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;;
|
[Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;;
|
||||||
[Ww][Pp][Aa]) ;;
|
[Ww][Pp][Aa]) ;;
|
||||||
|
[Hh][Oo][Ss][Tt][Aa][Pp]) ;;
|
||||||
*)
|
*)
|
||||||
_args="$_args $_arg"
|
_args="$_args $_arg"
|
||||||
;;
|
;;
|
||||||
@ -376,6 +383,24 @@ wpaif()
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# hostapif if
|
||||||
|
# Returns 0 if the interface is a HOSTAP interface and 1 otherwise.
|
||||||
|
hostapif()
|
||||||
|
{
|
||||||
|
local _tmpargs _arg
|
||||||
|
_tmpargs=`_ifconfig_getargs $1`
|
||||||
|
|
||||||
|
for _arg in $_tmpargs; do
|
||||||
|
case $_arg in
|
||||||
|
[Hh][Oo][Ss][Tt][Aa][Pp])
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# afexists af
|
# afexists af
|
||||||
# Returns 0 if the address family is enabled in the kernel
|
# Returns 0 if the address family is enabled in the kernel
|
||||||
# 1 otherwise.
|
# 1 otherwise.
|
||||||
|
@ -10,11 +10,18 @@
|
|||||||
. /etc/rc.subr
|
. /etc/rc.subr
|
||||||
|
|
||||||
name="hostapd"
|
name="hostapd"
|
||||||
rcvar="hostapd_enable"
|
|
||||||
command="/usr/sbin/${name}"
|
command="/usr/sbin/${name}"
|
||||||
|
|
||||||
conf_file="/etc/${name}.conf"
|
ifn="$2"
|
||||||
pidfile="/var/run/${name}.pid"
|
if [ -z "$ifn" ]; then
|
||||||
|
rcvar="hostapd_enable"
|
||||||
|
conf_file="/etc/${name}.conf"
|
||||||
|
pidfile="/var/run/${name}.pid"
|
||||||
|
else
|
||||||
|
rcvar=
|
||||||
|
conf_file="/etc/${name}-${ifn}.conf"
|
||||||
|
pidfile="/var/run/${name}-${ifn}.pid"
|
||||||
|
fi
|
||||||
|
|
||||||
command_args="-P ${pidfile} -B ${conf_file}"
|
command_args="-P ${pidfile} -B ${conf_file}"
|
||||||
required_files="${conf_file}"
|
required_files="${conf_file}"
|
||||||
|
Loading…
Reference in New Issue
Block a user