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