1#!/bin/sh
2
3# PROVIDE: wpa_supplicant
4# REQUIRE: mountcritremote
5# KEYWORD: nojail nostart
6
7. /etc/rc.subr
8. /etc/network.subr
9
10name="wpa_supplicant"
11desc="WPA/802.11i Supplicant for wireless network devices"
12rcvar=
13
14ifn="$2"
15if [ -z "$ifn" ]; then
16	return 1
17fi
18
19is_ndis_interface()
20{
21	case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in
22		ndis*) true ;;
23		*) false ;;
24	esac
25}
26
27if is_wired_interface ${ifn} ; then
28	driver="wired"
29elif is_ndis_interface ${ifn} ; then
30	driver="ndis"
31else
32	driver="bsd"
33fi
34
35load_rc_config $name
36
37#
38# This portion of this rc.script is different from base.
39case ${command} in
40/usr/sbin/wpa_supplicant)      # Assume user does not want base hostapd because
41                        # user specified WITHOUT_WIRELESS in make.conf
42                        # and /etc/defaults/rc.conf contains this value.
43                        unset command;;
44esac
45command=${wpa_supplicant_program:-%%PREFIX%%/sbin/wpa_supplicant}
46# End of differences from base. The rest of the file should remain the same.
47
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