From 200f92b7550da8a86d05db94842299d77a7ea083 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 23 Apr 2018 18:14:23 +0200 Subject: [PATCH] interfaces: no spurious redirection for dhclient; #2372 --- src/etc/inc/interfaces.inc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index dea388dbe..dc700a388 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -3281,9 +3281,9 @@ function interface_dhcp_configure($interface = 'wan') global $config; $wancfg = $config['interfaces'][$interface]; - $wanif = $wancfg['if']; if (empty($wancfg)) { - $wancfg = array(); + log_error("Interface {$interface} does not have a DHCP configuration."); + return; } /* generate dhclient_wan.conf */ @@ -3361,17 +3361,13 @@ EOD; fclose($fd); /* bring wan interface up before starting dhclient */ - if ($wanif) { - interfaces_bring_up($wanif); - } else { - log_error("Could not bring up {$wanif} interface in interface_dhcp_configure()"); - } + interfaces_bring_up($wanif); /* Make sure dhclient is not running */ kill_dhclient_process($wanif); /* fire up dhclient */ - mwexec("/sbin/dhclient -c /var/etc/dhclient_{$interface}.conf {$wanif} > /tmp/{$wanif}_output 2> /tmp/{$wanif}_error_output"); + mwexecf('/sbin/dhclient -c %s %s', array("/var/etc/dhclient_{$interface}.conf", $wanif)); } function DHCP_Config_File_Advanced($interface, $wancfg, $wanif)