xref: /freebsd/libexec/rc/rc.d/wpa_supplicant (revision 6ba2210ee039f2f12878c217bcf058e9c8b26b29)
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"
15start_postcmd="wpa_poststart"
16rcvar=
17
18ifn="$2"
19if [ -z "$ifn" ]; then
20	return 1
21fi
22
23is_ndis_interface()
24{
25	case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in
26		ndis*) true ;;
27		*) false ;;
28	esac
29}
30
31wpa_poststart() {
32	ifconfig ${ifn} down
33	sleep 2
34	ifconfig ${ifn} up
35}
36
37if is_wired_interface ${ifn} ; then
38	driver="wired"
39elif is_ndis_interface ${ifn} ; then
40	driver="ndis"
41else
42	driver="bsd"
43fi
44
45load_rc_config $name
46
47command=${wpa_supplicant_program}
48conf_file=${wpa_supplicant_conf_file}
49pidfile="/var/run/${name}/${ifn}.pid"
50command_args="-B -i $ifn -c $conf_file -D $driver -P $pidfile"
51required_files=$conf_file
52required_modules="wlan_wep wlan_tkip wlan_ccmp"
53
54run_rc_command "$1"
55