DHCP: Populate nameservers D-bus property from resolv.conf
Currently when DHCP enabled, nameservers D-bus property does not have
updated DHCP provided nameservers.
This commit populates nameservers D-bus property from resolv.conf
Tested By: verify nameservers D-bus property value with DHCP
enable/disable
Change DHCP server nameservers configuration & verify name servers
D-bus property updated on the interface.
Change-Id: If1a2508927d5f4f0c9c5d8b3f533fdf384d68821
Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index 0427363..86d2585 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -525,7 +525,12 @@
return servers;
}
-ServerList EthernetInterface::getNameServerFromResolvd()
+ServerList EthernetInterface::nameservers() const
+{
+ return getNameServerFromResolvd();
+}
+
+ServerList EthernetInterface::getNameServerFromResolvd() const
{
ServerList servers;
auto OBJ_PATH = std::format("{}{}", RESOLVED_SERVICE_PATH, ifIdx);
diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp
index 0e9c536..7f3771e 100644
--- a/src/ethernet_interface.hpp
+++ b/src/ethernet_interface.hpp
@@ -170,6 +170,9 @@
*/
ServerList staticNTPServers(ServerList value) override;
+ /** @brief Get value of nameservers */
+ ServerList nameservers() const override;
+
/** @brief sets the Static DNS/nameservers.
* @param[in] value - vector of DNS servers.
*/
@@ -217,7 +220,7 @@
/** @brief get the name server details from the network conf
*
*/
- virtual ServerList getNameServerFromResolvd();
+ virtual ServerList getNameServerFromResolvd() const;
/** @brief Persistent sdbusplus DBus bus connection. */
stdplus::PinnedRef<sdbusplus::bus_t> bus;