Add DNS support
This commit adds support for enabling user to specify the
DNS entries and then updating the resolver file with the same
Change-Id: Ib78b822592ea8bdd1f821ccbf1362d96a5021b90
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp
index 8ef1795..5c088bd 100644
--- a/ethernet_interface.hpp
+++ b/ethernet_interface.hpp
@@ -130,6 +130,11 @@
*/
ServerList nTPServers(ServerList value) override;
+ /** @brief sets the DNS/nameservers.
+ * @param[in] value - vector of DNS servers.
+ */
+ ServerList nameservers(ServerList value) override;
+
/** @brief create Vlan interface.
* @param[in] id- VLAN identifier.
*/
@@ -153,6 +158,9 @@
using EthernetInterfaceIntf::interfaceName;
using MacAddressIntf::mACAddress;
+ /** @brief Absolute path of the resolv conf file */
+ static constexpr auto resolvConfFile = "/etc/resolv.conf";
+
protected:
/** @brief get the info of the ethernet interface.
* @return tuple having the link speed,autonegotiation,duplexmode .
@@ -205,6 +213,18 @@
*/
ServerList getNTPServersFromConf();
+ /** @brief write the DNS entries to resolver file.
+ * @param[in] dnsList - DNS server list which needs to be written.
+ * @param[in] file - File to write the name server entries to.
+ */
+ void writeDNSEntries(const ServerList& dnsList,
+ const std::string& file);
+
+ /** @brief get the name server details from the network conf
+ *
+ */
+ ServerList getNameServerFromConf();
+
/** @brief Persistent sdbusplus DBus bus connection. */
sdbusplus::bus::bus& bus;