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:57:35 -0500 |
commit | 0389f03498994dbdaf47543a325b58d14b1cdbab (patch) | |
tree | 56ea609b5618ba7361b309705c9d3a53e0fbe824 | |
parent | 0d5f874d27995de822f596fea9ae5333cecadffb (diff) | |
download | pfsense-0389f03498994dbdaf47543a325b58d14b1cdbab.zip pfsense-0389f03498994dbdaf47543a325b58d14b1cdbab.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 13a8c75..3f67e5d 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2592,7 +2592,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'])); @@ -2608,7 +2613,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. |