/[vps]/baselayout-vserver/trunk/net-scripts/net.modules.d/wpa_supplicant
Gentoo

Diff of /baselayout-vserver/trunk/net-scripts/net.modules.d/wpa_supplicant

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 251 Revision 252
136# bool wpa_supplicant_associate(char *interface) 136# bool wpa_supplicant_associate(char *interface)
137# 137#
138# Returns 0 if wpa_supplicant associates and authenticates to an AP 138# Returns 0 if wpa_supplicant associates and authenticates to an AP
139# otherwise, 1 139# otherwise, 1
140wpa_supplicant_associate() { 140wpa_supplicant_associate() {
141 local iface="$1" ifvar="$( bash_variable "$1" )" timeout i 141 local iface="$1" ifvar="$( bash_variable "$1" )" timeout
142 timeout="associate_timeout_${ifvar}" 142 timeout="associate_timeout_${ifvar}"
143 [[ -z ${!timeout} ]] && timeout="wpa_timeout_${ifvar}" 143 [[ -z ${!timeout} ]] && timeout="wpa_timeout_${ifvar}"
144 timeout="${!timeout:--1}" 144 timeout="${!timeout:--1}"
145 145
146 if [[ ${timeout} == "0" ]]; then 146 if [[ ${timeout} == "0" ]]; then
148 elif [[ ${timeout} -lt 0 ]]; then 148 elif [[ ${timeout} -lt 0 ]]; then
149 einfo "Backgrounding ..." 149 einfo "Backgrounding ..."
150 exit 0 150 exit 0
151 fi 151 fi
152 152
153 local i=0
153 while true ; do 154 while true ; do
154 if [[ -n ${actfile} ]] ; then 155 if [[ -n ${actfile} ]] ; then
155 service_started "net.${iface}" && return 0 156 service_started "net.${iface}" && return 0
156 else 157 else
157 if ! wpa_cli -i"${iface}" status &>/dev/null ; then 158 if ! wpa_cli -i"${iface}" status &>/dev/null ; then
159 return 1 160 return 1
160 fi 161 fi
161 wpa_supplicant_associated "${iface}" && return 0 162 wpa_supplicant_associated "${iface}" && return 0
162 fi 163 fi
163 sleep 1 164 sleep 1
165 [[ ${timeout} == "0" ]] && continue
164 (( i++ )) 166 (( i++ ))
165 [[ ${i} == "${timeout}" || ${i} -gt "${timeout}" ]] && break 167 [[ ${i} == "${timeout}" || ${i} -gt "${timeout}" ]] && break
166 done 168 done
167 169
168 # Spit out an appropriate error 170 # Spit out an appropriate error

Legend:
Removed from v.251  
changed lines
  Added in v.252

  ViewVC Help
Powered by ViewVC 1.1.20