xref: /freebsd/libexec/rc/rc.d/hostapd (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1#!/bin/sh
2#
3#
4
5# PROVIDE: hostapd
6# REQUIRE: mountcritremote
7# KEYWORD: nojail shutdown
8
9. /etc/rc.subr
10
11name="hostapd"
12desc="Authenticator for IEEE 802.11 networks"
13command=${hostapd_program}
14start_postcmd="hostapd_poststart"
15
16hostapd_poststart() {
17	if [ -n "$ifn" ]; then
18		ifconfig ${ifn} down
19		sleep 2
20		ifconfig ${ifn} up
21	fi
22}
23
24ifn="$2"
25if [ -z "$ifn" ]; then
26	rcvar="hostapd_enable"
27	conf_file="/etc/${name}.conf"
28	pidfile="/var/run/${name}.pid"
29else
30	rcvar=
31	conf_file="/etc/${name}-${ifn}.conf"
32	pidfile="/var/run/${name}-${ifn}.pid"
33fi
34
35command_args="-P ${pidfile} -B ${conf_file}"
36required_files="${conf_file}"
37required_modules="wlan_xauth wlan_wep wlan_tkip wlan_ccmp"
38extra_commands="reload"
39
40load_rc_config ${name}
41run_rc_command "$1"
42