summaryrefslogtreecommitdiffstats
path: root/ethernet_interface.cpp
diff options
context:
space:
mode:
authorRatan Gupta <ratagupt@in.ibm.com>2017-09-18 16:28:50 +0530
committerRatan Gupta <ratagupt@in.ibm.com>2017-10-03 10:18:25 +0530
commit677ae120d6f9ec9944c4473adf85cf0e96943019 (patch)
treedbb086a6ad15a5f19b38d72abbe6fb8bb63b8464 /ethernet_interface.cpp
parente05083ad3082e61388567c0c36c68dc08436188d (diff)
downloadphosphor-networkd-677ae120d6f9ec9944c4473adf85cf0e96943019.tar.gz
phosphor-networkd-677ae120d6f9ec9944c4473adf85cf0e96943019.zip
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>
Diffstat (limited to 'ethernet_interface.cpp')
-rw-r--r--ethernet_interface.cpp7
1 files changed, 7 insertions, 0 deletions
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 @@ std::string EthernetInterface::mACAddress(std::string value)
{
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;
}
OpenPOWER on IntegriCloud