Restart the systemd-networkd after setting the MAC address
In the case of DHCP enabled box,DHCP negotiation should
be initiated after change of MAC address.
Shouldn't wait for auto-renegotiation,as if different
machine gets the old mac address then we can have
duplicate IP problem.
Change-Id: Ifde1a09762c9b9a717ffe7b258d5046f92b9bf1a
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
index 7c4e8bb..a9463c9 100644
--- a/ethernet_interface.cpp
+++ b/ethernet_interface.cpp
@@ -568,6 +568,13 @@
{
intf.second->updateMacAddress();
}
+
+ // restart the systemd networkd so that dhcp client gets the
+ // ip for the changed mac address.
+ if (dHCPEnabled())
+ {
+ restartSystemdUnit("systemd-networkd.service");
+ }
return mac;
}