diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index b6854f20f..769a93f8f 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -2387,24 +2387,20 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal interface_wireless_configure($realif, $wancfg, $wancfg['wireless']); } - $mac = get_interface_mac($realhwif); - /* * Don't try to reapply the spoofed MAC if it's already applied. - * When ifconfig link is used, it cycles the interface down/up, which triggers - * the interface config again, which attempts to spoof the MAC again, - * which cycles the link again... + * When ifconfig link is used, it cycles the interface down/up, + * which triggers the interface config again, which attempts to + * spoof the MAC again which cycles the link again... */ - if (!empty($wancfg['spoofmac']) && strcasecmp($wancfg['spoofmac'], $mac)) { - mwexec("/sbin/ifconfig " . escapeshellarg($realhwif) . - " link " . escapeshellarg($wancfg['spoofmac'])); + if (!empty($wancfg['spoofmac']) && strcasecmp($wancfg['spoofmac'], get_interface_mac($realhwif))) { + mwexecf('/sbin/ifconfig %s link %s', array($realhwif, $wancfg['spoofmac'])); /* All vlans need to spoof their parent mac address, too. */ if (isset($config['vlans']['vlan'])) { foreach ($config['vlans']['vlan'] as $vlan) { if ($vlan['if'] == $realhwif) { - mwexec("/sbin/ifconfig " . escapeshellarg($vlan['vlanif']) . - " link " . escapeshellarg($wancfg['spoofmac'])); + mwexecf('/sbin/ifconfig %s link %s', array($vlan['vlanif'], $wancfg['spoofmac'])); } } }