xref: /freebsd/libexec/rc/rc.d/hostapd (revision 00698711dee1d990d3db9c41bf58394e589eecfe)
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	ifconfig ${ifn} down
19	sleep 2
20	ifconfig ${ifn} up
21}
22
23ifn="$2"
24if [ -z "$ifn" ]; then
25	rcvar="hostapd_enable"
26	conf_file="/etc/${name}.conf"
27	pidfile="/var/run/${name}.pid"
28else
29	rcvar=
30	conf_file="/etc/${name}-${ifn}.conf"
31	pidfile="/var/run/${name}-${ifn}.pid"
32fi
33
34command_args="-P ${pidfile} -B ${conf_file}"
35required_files="${conf_file}"
36required_modules="wlan_xauth wlan_wep wlan_tkip wlan_ccmp"
37extra_commands="reload"
38
39load_rc_config ${name}
40run_rc_command "$1"
41