diff options
author | jim-p <jimp@pfsense.org> | 2011-11-08 12:56:43 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-11-08 12:56:43 -0500 |
commit | 49db607f186c37ad48b25640184051a6ae205ff4 (patch) | |
tree | b9548921990832db2e1362b1a6496fd5a3da7d8e | |
parent | 64d8482511ab09de66c67b19318de68e83433411 (diff) | |
download | pfsense-49db607f186c37ad48b25640184051a6ae205ff4.zip pfsense-49db607f186c37ad48b25640184051a6ae205ff4.tar.gz |
Prevent link cycling when spoofing mac + DHCP. Fixes #1572
-rw-r--r-- | etc/inc/interfaces.inc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index e70164d..e630c01 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2687,7 +2687,12 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven if (is_array($wancfg['wireless'])) interface_wireless_configure($realif, $wancfg, $wancfg['wireless']); - if ($wancfg['spoofmac']) { + $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... */ + if ($wancfg['spoofmac'] && ($wancfg['spoofmac'] != $mac)) { mwexec("/sbin/ifconfig " . escapeshellarg($realhwif) . " link " . escapeshellarg($wancfg['spoofmac'])); @@ -2703,7 +2708,6 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven } } } else { - $mac = get_interface_mac($realhwif); 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. |