DHCP Config: Add DomainEnabled D-bus property
This commit implements DomainEnabled D-bus property for DHCP
configuration.
When DomainEnabled is set to true then the domain names received from
the DHCP server
Tested by:
Set DomainEnabled D-bus property to true or false
Check domain name configured on BMC
Change-Id: Ia3db5f5054d4c758be336851175b05ddc05d2eda
Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
diff --git a/src/dhcp_configuration.cpp b/src/dhcp_configuration.cpp
index 04a56a0..4acfa3d 100644
--- a/src/dhcp_configuration.cpp
+++ b/src/dhcp_configuration.cpp
@@ -49,6 +49,7 @@
conf.setFile(newest_file.path());
}
+ ConfigIntf::domainEnabled(getDHCPProp(conf, type, "UseDomains"), true);
ConfigIntf::dnsEnabled(getDHCPProp(conf, type, "UseDNS"), true);
ConfigIntf::ntpEnabled(getDHCPProp(conf, type, "UseNTP"), true);
ConfigIntf::hostNameEnabled(getDHCPProp(conf, type, "UseHostname"), true);
@@ -116,6 +117,20 @@
return dns;
}
+bool Configuration::domainEnabled(bool value)
+{
+ if (value == domainEnabled())
+ {
+ return value;
+ }
+
+ auto domain = ConfigIntf::domainEnabled(value);
+ parent.get().writeConfigurationFile();
+ parent.get().reloadConfigs();
+
+ return domain;
+}
+
} // namespace dhcp
} // namespace network
} // namespace phosphor