diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2013-06-26 04:00:52 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2013-06-26 04:00:52 +0000 |
commit | 5d588b2eef337c7d94616bb7f500e5b563f70733 (patch) | |
tree | 7ab112f8fb75b8facd61167713cf1d4cf58bcd06 /etc/network.subr | |
parent | 3572acf51251da8e1bbed46ebcead07acbc8c900 (diff) | |
download | FreeBSD-src-5d588b2eef337c7d94616bb7f500e5b563f70733.zip FreeBSD-src-5d588b2eef337c7d94616bb7f500e5b563f70733.tar.gz |
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
Diffstat (limited to 'etc/network.subr')
-rw-r--r-- | etc/network.subr | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/etc/network.subr b/etc/network.subr index 04b31c7..63c3db3 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -171,6 +171,9 @@ ifconfig_up() if wpaif $1; then /etc/rc.d/wpa_supplicant start $1 _cfg=0 # XXX: not sure this should count + elif hostapif $1; then + /etc/rc.d/hostapd start $1 + _cfg=0 fi if dhcpif $1; then @@ -198,6 +201,9 @@ ifconfig_down() if wpaif $1; then /etc/rc.d/wpa_supplicant stop $1 _cfg=0 + elif hostapif $1; then + /etc/rc.d/hostapd stop $1 + _cfg=0 fi if dhcpif $1; then @@ -276,6 +282,7 @@ ifconfig_getargs() [Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;; [Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;; [Ww][Pp][Aa]) ;; + [Hh][Oo][Ss][Tt][Aa][Pp]) ;; *) _args="$_args $_arg" ;; @@ -376,6 +383,24 @@ wpaif() 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 # Returns 0 if the address family is enabled in the kernel # 1 otherwise. |