From 77890d7d47e6d759a4b614a5564dbe6aeb7df91c Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 3 Feb 2017 08:35:13 -0200 Subject: Simplify logic --- src/etc/inc/interfaces.inc | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'src/etc/inc/interfaces.inc') diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index c5bed0d..7310e13 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -3282,20 +3282,17 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven if ($wancfg['spoofmac'] && ($wancfg['spoofmac'] != $mac)) { mwexec("/sbin/ifconfig " . escapeshellarg($realhwif) . " link " . escapeshellarg($wancfg['spoofmac'])); - } else { - - if ($mac == "ff:ff:ff:ff:ff:ff") { - /* this is not a valid mac address. generate a - * temporary mac address so the machine can get online. - */ - echo gettext("Generating new MAC address."); - $random_mac = generate_random_mac_address(); - mwexec("/sbin/ifconfig " . escapeshellarg($realhwif) . - " link " . escapeshellarg($random_mac)); - $wancfg['spoofmac'] = $random_mac; - write_config(); - file_notice("MAC Address altered", sprintf(gettext('The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface %1$s has been automatically replaced with %2$s'), $realif, $random_mac), "Interfaces"); - } + } elseif ($mac == "ff:ff:ff:ff:ff:ff") { + /* this is not a valid mac address. generate a + * temporary mac address so the machine can get online. + */ + echo gettext("Generating new MAC address."); + $random_mac = generate_random_mac_address(); + mwexec("/sbin/ifconfig " . escapeshellarg($realhwif) . + " link " . escapeshellarg($random_mac)); + $wancfg['spoofmac'] = $random_mac; + write_config(); + file_notice("MAC Address altered", sprintf(gettext('The INVALID MAC address (ff:ff:ff:ff:ff:ff) on interface %1$s has been automatically replaced with %2$s'), $realif, $random_mac), "Interfaces"); } /* media */ -- cgit v1.1