inventory_mac: Fix Update MAC for eth1
Whenever the network daemon starts, and if the inventory manager has
already started, then networkd should read the MAC address from the
inventory and update the dbus object and configuration file.
Currently, this is being done for just eth0 interface and is exiting
before updating the MAC on eth1.
This commit fixes the above issue.
Tested-By:
* Restarted network manager service; checked MAC on both
inventory and network dbus & config files.
* Checked for both reboot and factory reset usecases.
Change-Id: I49d94f22d914f74c23999a5fe175bfc4d97759a9
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
diff --git a/src/inventory_mac.cpp b/src/inventory_mac.cpp
index 49beecd..31d74c8 100644
--- a/src/inventory_mac.cpp
+++ b/src/inventory_mac.cpp
@@ -268,7 +268,6 @@
else
{
registerSignals(bus);
- EthInterfaceMatch = nullptr;
if (setInventoryMACOnSystem(bus, infname))
{
@@ -311,12 +310,10 @@
// collected by the time network service has come up, better to check the
// VPD directly and set the MAC Address on the respective Interface.
- bool registeredSignals = false;
for (const auto& interfaceString : configJson.items())
{
- if ((FORCE_SYNC_MAC_FROM_INVENTORY ||
- !std::filesystem::exists(firstBootPath + interfaceString.key())) &&
- !registeredSignals)
+ if (FORCE_SYNC_MAC_FROM_INVENTORY ||
+ !std::filesystem::exists(firstBootPath + interfaceString.key()))
{
lg2::info("Check VPD for MAC: {REASON}", "REASON",
(FORCE_SYNC_MAC_FROM_INVENTORY)
@@ -327,7 +324,6 @@
"interface='org.freedesktop.DBus.ObjectManager',type='signal',"
"member='InterfacesAdded',path='/xyz/openbmc_project/network'",
mycallback);
- registeredSignals = true;
for (const auto& intf : manager->interfaces)
{