summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-01-28 22:21:12 +0000
committerErmal <eri@pfsense.org>2013-01-28 22:21:12 +0000
commitb73a96b68d1d4e919a268d2e8e3a6ec902709e6d (patch)
treefdea67982d18094011cb70cde99a93f6c40df97e /etc
parente017a46a994c693f9c05c8936c1a5585d7b3ae7c (diff)
downloadpfsense-b73a96b68d1d4e919a268d2e8e3a6ec902709e6d.zip
pfsense-b73a96b68d1d4e919a268d2e8e3a6ec902709e6d.tar.gz
Use pid even for hostapd rather then trying to guess with regex
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/interfaces.inc11
1 files changed, 7 insertions, 4 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 4a4be2b..8d40c1c 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -1201,7 +1201,7 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg =
/* hostapd and wpa_supplicant do not need to be running when the interface is down.
* They will also use 100% CPU if running after the wireless clone gets deleted. */
if (is_array($ifcfg['wireless'])) {
- mwexec(kill_hostapd($realif));
+ kill_hostapd($realif);
mwexec(kill_wpasupplicant($realif));
}
@@ -2371,7 +2371,7 @@ function interface_wireless_configure($if, &$wl, &$wlcfg) {
$wlcmd[] = "authmode open wepmode off ";
}
- mwexec(kill_hostapd("{$if}"));
+ kill_hostapd($if);
mwexec(kill_wpasupplicant("{$if}"));
/* generate wpa_supplicant/hostap config if wpa is enabled */
@@ -2507,7 +2507,7 @@ EOD;
" link " . escapeshellarg($if_oldmac) . "\n");
}
- fwrite($fd_set, "{$hostapd} -B {$g['varetc_path']}/hostapd_{$if}.conf\n");
+ fwrite($fd_set, "{$hostapd} -B {$g['varetc_path']}/hostapd_{$if}.conf -P {$g['varrun_path']}/hostapd_{$if}.pid\n");
/* add line to script to restore spoofed mac after running hostapd */
if (file_exists("{$g['tmp_path']}/{$if}_oldmac")) {
@@ -2622,7 +2622,10 @@ EOD;
}
function kill_hostapd($interface) {
- return "/bin/pkill -f \"hostapd .*{$interface}\"\n";
+ global $g;
+
+ if (isvalidpid("{$g['varrun_path']}/hostapd_{$interface}.pid"))
+ return killbypid("{$g['varrun_path']}/hostapd_{$interface}.pid");
}
function kill_wpasupplicant($interface) {
OpenPOWER on IntegriCloud