From 12516aad9a5f0d9f074b9a9fc6f817990b7abe0b Mon Sep 17 00:00:00 2001 From: NOYB Date: Sun, 5 Feb 2017 02:01:29 -0800 Subject: Vendor MAC Retention File Consolidate Use a single file for vendor MAC retention (vendor_mac). a) Writes only one file during boot up rather than a file for each interface. b) More efficient than numerous tiny files. c) Friendlier to write cycle sensitive media in a RAM disk disabled system. --- src/etc/inc/interfaces.inc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/etc/inc') diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 9b29bd0..90a5749 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -6005,12 +6005,10 @@ function get_interface_vendor_mac($interface) { global $g; $mac = ""; - $mac_file = "{$g['vardb_path']}/vendor_mac_($interface)"; + $mac_file = "{$g['vardb_path']}/vendor_mac"; if (file_exists($mac_file)) { - $mac = file_get_contents($mac_file); - if (!is_macaddr($mac)) { - $mac = ""; - } + $vendor_mac_arr = json_decode(file_get_contents($mac_file), true); + $mac = (is_macaddr($vendor_mac_arr[$interface])) ? $vendor_mac_arr[$interface] : ''; } return $mac; -- cgit v1.1