summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-05-19 12:13:52 -0300
committerRenato Botelho <renato@netgate.com>2017-05-19 12:13:52 -0300
commit8ce9725941732f11822121cfb4b51d19ed064533 (patch)
tree150ace45f89ed18f5fef4fd14c8fe73f7b02d966 /src
parentee8f5c6a4719aac90b9cd58371ceb7370fb50131 (diff)
downloadpfsense-8ce9725941732f11822121cfb4b51d19ed064533.zip
pfsense-8ce9725941732f11822121cfb4b51d19ed064533.tar.gz
Use recently added hwaddr field to restore original MAC address
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/interfaces.inc12
-rwxr-xr-xsrc/etc/rc.bootup27
2 files changed, 3 insertions, 36 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index 248a9bb..5b375ec 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -6138,16 +6138,8 @@ function get_interface_mac($interface) {
}
function get_interface_vendor_mac($interface) {
- global $g;
-
- $mac = "";
- $mac_file = "{$g['vardb_path']}/vendor_mac";
- if (file_exists($mac_file)) {
- $vendor_mac_arr = json_decode(file_get_contents($mac_file), true);
- $mac = (is_macaddr($vendor_mac_arr[$interface])) ? $vendor_mac_arr[$interface] : '';
- }
-
- return $mac;
+ $macinfo = pfSense_get_interface_addresses($interface);
+ return $macinfo["hwaddr"] ?: '';
}
/****f* pfsense-utils/generate_random_mac_address
diff --git a/src/etc/rc.bootup b/src/etc/rc.bootup
index bfc555e..8924efe 100755
--- a/src/etc/rc.bootup
+++ b/src/etc/rc.bootup
@@ -109,32 +109,7 @@ echo "Loading configuration...";
parse_config_bootup();
echo "done.\n";
-/* If pfSense.boot kenv is set, it's a reroot */
-if (mwexec("/bin/kenv -q pfSense.boot 2>/dev/null") != 0) {
- /* Collect vendor MAC address for all interfaces */
- $ifs = pfSense_interface_listget();
- foreach ($ifs as $if) {
- $if_details = pfSense_get_interface_addresses($if);
- if (isset($if_details['iftype']) &&
- $if_details['iftype'] == 'virtual') {
- continue;
- }
-
- if (empty($if_details['macaddr']) ||
- $if_details['macaddr'] == "00:00:00:00:00:00") {
- continue;
- }
-
- $vendor_mac_arr[$if] = $if_details['macaddr'];
- }
- $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("/usr/sbin/gnid > {$g['vardb_path']}/uniqueid 2>/dev/null");
- mwexec("/bin/kenv pfSense.boot=1");
-}
+mwexec("/usr/sbin/gnid > {$g['vardb_path']}/uniqueid 2>/dev/null");
/* run any early shell commands specified in config.xml */
system_do_shell_commands(1);
OpenPOWER on IntegriCloud