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