1#!/bin/sh 2# 3# $FreeBSD: src/etc/rc.d/wpa_supplicant,v 1.2 2005/10/19 22:26:47 jkim Exp $ 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= 15command="/usr/sbin/wpa_supplicant" 16conf_file="/etc/wpa_supplicant.conf" 17 18start_precmd="wpa_supplicant_precmd" 19wpa_supplicant_precmd() 20{ 21 ifconfig $ifn up 22} 23start_postcmd="wpa_supplicant_postcmd" 24wpa_supplicant_postcmd() 25{ 26# don't wait for wpa_supplicant to associate 27# while ! ifconfig $ifn | grep -qw "status: associated"; do 28# sleep 1 29# done 30 if [ "${command}" = "/usr/sbin/wpa_supplicant" ]; 31 then 32 cat << EOF 33 ============================================================== 34 = WARNING * SECURITY * WARNING = 35 ============================================================== 36 37The base wpa_supplicant is running. This version is several releases behind 38and is not patched for security vulnerabilities. It is highly recommended 39that the DPorts version be run instead. Instructions to switch here: 40 41http://www.dragonflybsd.org/docs/docs/newhandbook/WirelessNetwork/#index1h2 42 43EOF 44 sleep 10 45 fi 46} 47 48ifn="$2" 49if [ -z "$ifn" ]; then 50 return 1 51fi 52 53is_ndis_interface() 54{ 55 case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in 56 ndis*) true ;; 57 *) false ;; 58 esac 59} 60 61if is_ndis_interface ${ifn}; then 62 driver="ndis" 63else 64 driver="bsd" 65fi 66 67load_rc_config $name 68 69pid_file="/var/run/${name}/${ifn}.pid" 70command_args="-B -q -i $ifn -c $conf_file -D $driver -P $pid_file" 71required_files=$conf_file 72 73run_rc_command "$1" 74