xref: /freebsd/libexec/rc/rc.d/wpa_supplicant (revision 5fcdc19a81115d975e238270754e28557a2fcfc5)
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} up
33}
34
35if is_wired_interface ${ifn} ; then
36	driver="wired"
37elif is_ndis_interface ${ifn} ; then
38	driver="ndis"
39else
40	driver="bsd"
41fi
42
43load_rc_config $name
44
45command=${wpa_supplicant_program}
46conf_file=${wpa_supplicant_conf_file}
47pidfile="/var/run/${name}/${ifn}.pid"
48command_args="-B -i $ifn -c $conf_file -D $driver -P $pidfile"
49required_files=$conf_file
50required_modules="wlan_wep wlan_tkip wlan_ccmp"
51
52run_rc_command "$1"
53