From 4b2a618018d10d72bdd619b276e44bda53729ebf Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 1 Jun 2006 01:58:33 +0000 Subject: [PATCH] Do not killall all hostpad or wpa_supplicant processes. This is NOT multi interface friendly. Instead look for the process with the interface in it and kill the correct one. --- etc/inc/interfaces.inc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index fe3815fce8..26e878eb42 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -606,7 +606,7 @@ EOD; fwrite($fd, "{$wpa}"); fclose($fd); - fwrite($fd_set, "{$killall} wpa_supplicant\n"); + kill_wpasupplicant($if); } break; @@ -645,13 +645,13 @@ EOD; fwrite($fd, "{$wpa}"); fclose($fd); - fwrite($fd_set, "{$killall} hostapd\n"); + kill_hostapd($if); } break; case 'adhoc': - fwrite($fd_set, "{$killall} hostapd\n"); - fwrite($fd_set, "{$killall} wpa_supplicant\n"); + kill_hostapd($if); + kill_wpasupplicant($if); break; } @@ -709,6 +709,14 @@ EOD; } +function kill_hostapd($interface) { + mwexec("/bin/ps awwuxx | grep hostatpd | grep $interface | awk '{ print \$2 }' | xargs kill"); +} + +function kill_wpasupplicant($interface) { + mwexec("/bin/ps awwuxx | grep wpa_supplicant | grep $interface | awk '{ print \$2 }' | xargs kill"); +} + function find_dhclient_process($interface) { if(filter_translate_type_to_real_interface($interface) <> "") $realinterface = filter_translate_type_to_real_interface($interface);