ethernet_interface: Remove DHCP from constructor
It should be set or configured just like all other parameters.
Change-Id: Ic93de4e80b4da0de2e97b9655c424fa55a6844bf
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index 3afe48c..c222af1 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -64,8 +64,7 @@
EthernetInterface::EthernetInterface(sdbusplus::bus_t& bus,
const std::string& objPath,
const config::Parser& config,
- DHCPConf dhcpEnabled, Manager& parent,
- bool emitSignal,
+ Manager& parent, bool emitSignal,
std::optional<bool> enabled) :
Ifaces(bus, objPath.c_str(),
emitSignal ? Ifaces::action::defer_emit
@@ -75,7 +74,7 @@
auto intfName = objPath.substr(objPath.rfind("/") + 1);
std::replace(intfName.begin(), intfName.end(), '_', '.');
interfaceName(intfName);
- EthernetInterfaceIntf::dhcpEnabled(dhcpEnabled);
+ EthernetInterfaceIntf::dhcpEnabled(getDHCPValue(config));
EthernetInterfaceIntf::ipv6AcceptRA(getIPv6AcceptRA(config));
EthernetInterfaceIntf::nicEnabled(enabled ? *enabled : queryNicEnabled());
const auto& gatewayList = manager.getRouteTable().getDefaultGateway();
@@ -887,8 +886,8 @@
config::pathForIntfConf(manager.getConfDir(), vlanInterfaceName));
auto vlanIntf = std::make_unique<phosphor::network::VlanInterface>(
- bus, path.c_str(), config, getDHCPValue(config),
- EthernetInterfaceIntf::nicEnabled(), id, *this, manager);
+ bus, path.c_str(), config, EthernetInterfaceIntf::nicEnabled(), id,
+ *this, manager);
// Fetch the ip address from the system
// and create the dbus object.
@@ -917,7 +916,7 @@
// Pass the parents nicEnabled property, so that the child
// VLAN interface can inherit.
auto vlanIntf = std::make_unique<phosphor::network::VlanInterface>(
- bus, path.c_str(), config::Parser(), EthernetInterface::DHCPConf::none,
+ bus, path.c_str(), config::Parser(),
EthernetInterfaceIntf::nicEnabled(), id, *this, manager);
// write the device file for the vlan interface.
diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp
index e4be9ab..e0f2987 100644
--- a/src/ethernet_interface.hpp
+++ b/src/ethernet_interface.hpp
@@ -82,15 +82,14 @@
* @param[in] bus - Bus to attach to.
* @param[in] objPath - Path to attach at.
* @param[in] config - The parsed configuation file.
- * @param[in] dhcpEnabled - is dhcp enabled(true/false).
* @param[in] parent - parent object.
* @param[in] emitSignal - true if the object added signal needs to be
* send.
* @param[in] enabled - Override the lookup of nicEnabled
*/
EthernetInterface(sdbusplus::bus_t& bus, const std::string& objPath,
- const config::Parser& config, DHCPConf dhcpEnabled,
- Manager& parent, bool emitSignal = true,
+ const config::Parser& config, Manager& parent,
+ bool emitSignal = true,
std::optional<bool> enabled = std::nullopt);
/** @brief Function used to load the nameservers.
diff --git a/src/network_manager.cpp b/src/network_manager.cpp
index 7d288be..86d892f 100644
--- a/src/network_manager.cpp
+++ b/src/network_manager.cpp
@@ -133,7 +133,7 @@
config::Parser config(config::pathForIntfConf(confDir, interface));
auto intf = std::make_shared<phosphor::network::EthernetInterface>(
- bus, objPath.string(), config, getDHCPValue(config), *this);
+ bus, objPath.string(), config, *this);
intf->createIPAddressObjects();
intf->createStaticNeighborObjects();
diff --git a/src/vlan_interface.cpp b/src/vlan_interface.cpp
index 1ea6a17..129cbf7 100644
--- a/src/vlan_interface.cpp
+++ b/src/vlan_interface.cpp
@@ -20,13 +20,12 @@
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
VlanInterface::VlanInterface(sdbusplus::bus_t& bus, const std::string& objPath,
- const config::Parser& config, DHCPConf dhcpEnabled,
- bool nicEnabled, uint32_t vlanID,
- EthernetInterface& intf, Manager& parent) :
+ const config::Parser& config, bool nicEnabled,
+ uint32_t vlanID, EthernetInterface& intf,
+ Manager& parent) :
VlanIface(bus, objPath.c_str()),
DeleteIface(bus, objPath.c_str()),
- EthernetInterface(bus, objPath, config, dhcpEnabled, parent, true,
- nicEnabled),
+ EthernetInterface(bus, objPath, config, parent, true, nicEnabled),
parentInterface(intf)
{
id(vlanID);
diff --git a/src/vlan_interface.hpp b/src/vlan_interface.hpp
index 2d8baaa..09b9bb0 100644
--- a/src/vlan_interface.hpp
+++ b/src/vlan_interface.hpp
@@ -41,7 +41,6 @@
* @param[in] bus - Bus to attach to.
* @param[in] objPath - Path to attach at.
* @param[in] config - The parsed configuation file.
- * @param[in] dhcpEnabled - DHCP enable value.
* @param[in] vlanID - vlan identifier.
* @param[in] intf - ethernet interface object.
* @param[in] manager - network manager object.
@@ -49,9 +48,8 @@
* This constructor is called during loading the VLAN Interface
*/
VlanInterface(sdbusplus::bus_t& bus, const std::string& objPath,
- const config::Parser& config, DHCPConf dhcpEnabled,
- bool nicEnabled, uint32_t vlanID, EthernetInterface& intf,
- Manager& parent);
+ const config::Parser& config, bool nicEnabled,
+ uint32_t vlanID, EthernetInterface& intf, Manager& parent);
/** @brief Delete this d-bus object.
*/