summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNOYB <Al_Stu@Frontier.com>2017-02-23 13:36:24 -0800
committerRenato Botelho <renato@netgate.com>2017-04-26 18:06:45 -0300
commit3b010c68339f4c902c5ce7591cfd651022d07e04 (patch)
tree96f7102654b2e38a853d1cad99bd38b749768902
parenta822576e9b3d563eff0791c9d43350e0feef9442 (diff)
downloadpfsense-3b010c68339f4c902c5ce7591cfd651022d07e04.zip
pfsense-3b010c68339f4c902c5ce7591cfd651022d07e04.tar.gz
Vendor MAC Retention - Update
Only write if changed or missing. Vast majority of reboots will not have a change so don't hit the file system with a needless write. RAM disk enabled systems will always write due to missing the file on boot up.
-rwxr-xr-xsrc/etc/rc.bootup8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/etc/rc.bootup b/src/etc/rc.bootup
index c175214..eb40118 100755
--- a/src/etc/rc.bootup
+++ b/src/etc/rc.bootup
@@ -190,7 +190,6 @@ echo "done.\n";
if (mwexec("/bin/kenv -q pfSense.boot 2>/dev/null") != 0) {
/* Collect vendor MAC address for all interfaces */
$ifs = pfSense_interface_listget();
- unlink_if_exists("{$g['vardb_path']}/vendor_mac");
foreach ($ifs as $if) {
$if_details = pfSense_get_interface_addresses($if);
if (isset($if_details['iftype']) &&
@@ -205,8 +204,11 @@ if (mwexec("/bin/kenv -q pfSense.boot 2>/dev/null") != 0) {
$vendor_mac_arr[$if] = $if_details['macaddr'];
}
- @file_put_contents("{$g['vardb_path']}/vendor_mac", json_encode($vendor_mac_arr));
- unset($ifs, $if, $vendor_mac_arr);
+ $vendor_mac_arr_json = json_encode($vendor_mac_arr);
+ if (@file_get_contents("{$g['vardb_path']}/vendor_mac") !== $vendor_mac_arr_json) {
+ @file_put_contents("{$g['vardb_path']}/vendor_mac", $vendor_mac_arr_json);
+ }
+ unset($ifs, $if, $vendor_mac_arr, $vendor_mac_arr_json);
mwexec("/bin/kenv pfSense.boot=1");
}
OpenPOWER on IntegriCloud