diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2006-12-21 22:15:04 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2006-12-21 22:15:04 +0000 |
commit | bb7d60f91eb62e94878749b42caf20033aa0cfae (patch) | |
tree | da5d75fd08b81d84e2e9e423bb5c704d5a1591be /etc/inc | |
parent | 770b4b9cf8862278052346ec913f83ed09dc8c35 (diff) | |
download | pfsense-bb7d60f91eb62e94878749b42caf20033aa0cfae.zip pfsense-bb7d60f91eb62e94878749b42caf20033aa0cfae.tar.gz |
MFC find_dhclient_process() fixes.
* Fix pgrep regexp for new dhclient version
* Kill process by number instead of (non-existant) pid file.
* Return PID number instead of executing the file $pid
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/interfaces.inc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 3b7e2f3..08dab4d 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -744,7 +744,7 @@ function kill_wpasupplicant($interface) { function find_dhclient_process($interface) { if(filter_translate_type_to_real_interface($interface) <> "") $realinterface = filter_translate_type_to_real_interface($interface); - $pid = `/usr/bin/pgrep -f "dhclient: {$realinterface}(\$| .*)"`; + $pid = exec("/usr/bin/pgrep -f \"dhclient (.*){$realinterface}\""); return $pid; } @@ -757,7 +757,9 @@ function interfaces_wan_configure() { mute_kernel_msgs(); /* find dhclient process for wan and kill it */ - killbypid(find_dhclient_process("wan")); + $dhclient_pid = find_dhclient_process("wan"); + if($dhclient_pid) + mwexec("kill {$dhclient_pid}"); /* remove wanup file if it exists */ unlink_if_exists("{$g['tmp_path']}/wanup"); @@ -1065,9 +1067,9 @@ function interfaces_dhcp_down($interface) { $realinterface = filter_translate_type_to_real_interface($interface); mwexec("/sbin/ifconfig {$realinterface} down"); sleep(1); - $pid = find_dhclient_process($interface); - if($pid) - mwexec("kill {$pid}"); + $dhclient_pid = find_dhclient_process($interface); + if($dhclient_pid) + mwexec("kill {$dhclient_pid}"); } function interfaces_dhcp_up($interface) { @@ -1581,4 +1583,4 @@ function get_interface_mac($interface) { return $mac; } -?>
\ No newline at end of file +?> |