wpa_supplicant revision 178356
1#!/bin/sh
2#
3# $FreeBSD: head/etc/rc.d/wpa_supplicant 178356 2008-04-20 20:37:21Z sam $
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"
14rcvar=
15
16ifn="$2"
17if [ -z "$ifn" ]; then
18	return 1
19fi
20
21is_wired_interface()
22{
23	media=`ifconfig $1 2>/dev/null | while read line; do
24		case "$line" in
25		*media:?Ethernet*)
26			echo Ethernet
27			;;
28		esac
29	done`
30	test "$media" = "Ethernet"
31}
32
33is_ndis_interface()
34{
35	case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in
36		ndis*) true ;;
37		*) false ;;
38	esac
39}
40
41if is_wired_interface ${ifn} ; then
42	driver="wired"
43elif is_ndis_interface ${ifn} ; then
44	driver="ndis"
45else
46	driver="bsd"
47fi
48
49load_rc_config $name
50
51command=${wpa_supplicant_program}
52conf_file=${wpa_supplicant_conf_file}
53pidfile="/var/run/${name}/${ifn}.pid"
54command_args="-B -i $ifn -c $conf_file -D $driver -P $pidfile"
55required_files=$conf_file
56required_modules="wlan_wep wlan_tkip wlan_ccmp"
57
58run_rc_command "$1"
59