]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/blob - etc/rc.d/wpa_supplicant
Copy head to stable/8 as part of 8.0 Release cycle.
[FreeBSD/stable/8.git] / etc / rc.d / wpa_supplicant
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
13 name="wpa_supplicant"
14 rcvar=
15
16 ifn="$2"
17 if [ -z "$ifn" ]; then
18         return 1
19 fi
20
21 is_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
33 is_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
41 if is_wired_interface ${ifn} ; then
42         driver="wired"
43 elif is_ndis_interface ${ifn} ; then
44         driver="ndis"
45 else
46         driver="bsd"
47 fi
48
49 load_rc_config $name
50
51 command=${wpa_supplicant_program}
52 conf_file=${wpa_supplicant_conf_file}
53 pidfile="/var/run/${name}/${ifn}.pid"
54 command_args="-B -i $ifn -c $conf_file -D $driver -P $pidfile"
55 required_files=$conf_file
56 required_modules="wlan_wep wlan_tkip wlan_ccmp"
57
58 run_rc_command "$1"