xref: /dragonfly/etc/rc.d/wpa_supplicant (revision 7485684f)
1#!/bin/sh
2#
3# $FreeBSD: src/etc/rc.d/wpa_supplicant,v 1.2 2005/10/19 22:26:47 jkim Exp $
4#
5
6# PROVIDE: wpa_supplicant
7# REQUIRE: SERVERS
8# KEYWORD: nojail
9
10. /etc/rc.subr
11. /etc/network.subr
12
13name="wpa_supplicant"
14rcvar=`set_rcvar`
15
16load_rc_config $name
17
18ifn="$2"
19
20if [ -z "${ifn}" ]; then
21	# got no interface, run single daemon for multiple matching interfaces
22	# but ensure the feature is supported first
23	case `${wpa_supplicant_program} -h 2>/dev/null` in
24		*-M*) match_iface=1 ;;
25		*) return 1 ;;
26	esac
27	flags="-M -i wlan* -D bsd -P /var/run/${name}.pid ${wpa_supplicant_flags}"
28else
29	# got particular interface, possibly called from ifconfig_up() in network.subr
30	# force "enable" to ensure run_rc_command below runs daemon for the interface
31	wpa_supplicant_enable="YES"
32	if is_wired_interface ${ifn} ; then
33		driver="wired"
34	else
35		driver="bsd"
36	fi
37	flags="-i ${ifn} -D ${driver} -P /var/run/${name}/${ifn}.pid ${wpa_supplicant_flags}"
38fi
39
40flags="-B -s ${flags}"
41run_rc_command "$1"
42