summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-02-26 17:07:41 -0800
committerPatrick Venture <venture@google.com>2018-02-28 15:41:55 +0000
commitd475cd63286ec7b3f74c3959cabaa292b6648265 (patch)
treeedaa7e68b43a4a24d5169461aa4a13c555d28d43
parentced3592a78a74b94039871e27b8433b4342bd734 (diff)
downloadphosphor-networkd-d475cd63286ec7b3f74c3959cabaa292b6648265.tar.gz
phosphor-networkd-d475cd63286ec7b3f74c3959cabaa292b6648265.zip
Set MAC address only when it changes
If the MAC address hasn't been set or has changed, set it. Otherwise, don't set it because it will cause the link to reset. Change-Id: I9018df6a3fa4743894bc0f3cd47bdf1be71632e4 Signed-off-by: Patrick Venture <venture@google.com>
-rw-r--r--ethernet_interface.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
index 6b6948a..15f40fb 100644
--- a/ethernet_interface.cpp
+++ b/ethernet_interface.cpp
@@ -675,6 +675,13 @@ std::string EthernetInterface::mACAddress(std::string value)
return MacAddressIntf::mACAddress();
}
+ // Check if the MAC changed.
+ auto pmac = MacAddressIntf::mACAddress();
+ if (strcasecmp(pmac.c_str(), value.c_str()) == 0)
+ {
+ return MacAddressIntf::mACAddress();
+ }
+
// Allow the mac to be set if one of the condition is true.
// 1) Incoming Mac is of local admin type.
// or
OpenPOWER on IntegriCloud