Remove the code which updates resolv.conf for dhcp supplied DNS
Earlier in openbmc stack we did't have the systemd-resolved
which updates the resolv.conf automatically for DHCP supplied
nameservers or static nameservers.
Now openBMC stack is having the systemd-resolved enabled
This code is not required, it is unnecessary overwriting
some entries.
Change-Id: I532a4d00d4ec6dcc32f69f7cc5be0a41378214b8
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
index 9dcba8e..f609b9d 100644
--- a/ethernet_interface.cpp
+++ b/ethernet_interface.cpp
@@ -461,15 +461,9 @@
EthernetInterfaceIntf::nameservers(value);
writeConfigurationFile();
-
- // Currently we don't have systemd-resolved enabled
- // in the openbmc. Once we update the network conf file,
- // it should be read by systemd-resolved.service.
-
- // The other reason to write the resolv conf is,
- // we don't want to restart the networkd for nameserver change.
- // as restarting of systemd-networkd takes more then 2 secs
- writeDNSEntries(value, resolvConfFile);
+ // resolved reads the DNS server configuration from the
+ // network file.
+ manager.restartSystemdUnit(networkdService);
}
catch (InternalFailure& e)
{
@@ -498,24 +492,6 @@
return servers;
}
-void EthernetInterface::writeDNSEntries(const ServerList& dnsList,
- const std::string& file)
-{
- std::fstream outStream(file, std::fstream::out);
- if (!outStream.is_open())
- {
- log<level::ERR>("Unable to open the file",
- entry("FILE=%s", file.c_str()));
- elog<InternalFailure>();
- }
-
- outStream << "### Generated manually via dbus settings ###\n";
- for (const auto& server : dnsList)
- {
- outStream << "nameserver " << server << "\n";
- }
-}
-
void EthernetInterface::loadVLAN(VlanId id)
{
std::string vlanInterfaceName = interfaceName() + "." + std::to_string(id);