xref: /freebsd/libexec/rc/rc.d/wpa_supplicant (revision 0696600c41600d80bcd993bfd8e675d0ae6951fe)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# PROVIDE: wpa_supplicant
7# REQUIRE: mountcritremote
8# KEYWORD: nojail nostart
9
10. /etc/rc.subr
11. /etc/network.subr
12
13name="wpa_supplicant"
14desc="WPA/802.11i Supplicant for wireless network devices"
15rcvar=
16
17ifn="$2"
18if [ -z "$ifn" ]; then
19	return 1
20fi
21
22is_ndis_interface()
23{
24	case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in
25		ndis*) true ;;
26		*) false ;;
27	esac
28}
29
30if is_wired_interface ${ifn} ; then
31	driver="wired"
32elif is_ndis_interface ${ifn} ; then
33	driver="ndis"
34else
35	driver="bsd"
36fi
37
38load_rc_config $name
39
40command=${wpa_supplicant_program}
41conf_file=${wpa_supplicant_conf_file}
42pidfile="/var/run/${name}/${ifn}.pid"
43command_args="-B -i $ifn -c $conf_file -D $driver -P $pidfile"
44required_files=$conf_file
45required_modules="wlan_wep wlan_tkip wlan_ccmp"
46
47run_rc_command "$1"
48