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