summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandr Ilenko <AIlenko@IBS.RU>2022-08-01 17:30:24 +0300
committerAlexandr Ilenko <AIlenko@IBS.RU>2022-08-01 17:41:52 +0300
commitf70fba603337386e48fcd6a68c84ea077e580d66 (patch)
tree61d0cd0ae519c457c21a37aacfee301598743522
parente6a964cf49500a33762f8f2ece3a56c5eed14d4c (diff)
downloadopenbmc-sila_ui/fix-SILABMC-172.tar.xz
SILABMC-172: Fix: enable DHCP back, and WebUIsila_ui/fix-SILABMC-172
-rw-r--r--meta-ibs/meta-cp2-5422/recipes-phosphor/network/phosphor-network/0001-Fix-enable-DHCP-back.patch87
-rw-r--r--meta-ibs/meta-cp2-5422/recipes-phosphor/network/phosphor-network_%.bbappend5
2 files changed, 92 insertions, 0 deletions
diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/network/phosphor-network/0001-Fix-enable-DHCP-back.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/network/phosphor-network/0001-Fix-enable-DHCP-back.patch
new file mode 100644
index 0000000000..c8a364a42f
--- /dev/null
+++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/network/phosphor-network/0001-Fix-enable-DHCP-back.patch
@@ -0,0 +1,87 @@
+From 73592ccbe666a53b748017b8e65ed158fb6ef296 Mon Sep 17 00:00:00 2001
+From: Alexandr Ilenko <AIlenko@IBS.RU>
+Date: Fri, 29 Jul 2022 09:01:38 +0300
+Subject: [PATCH] Fix: enable DHCP back
+
+---
+ src/ethernet_interface.cpp | 37 +++++++++++++++++++++++++++++++++++++
+ src/ethernet_interface.hpp | 6 ++++++
+ 2 files changed, 43 insertions(+)
+
+diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
+index 1e63a48..d082153 100644
+--- a/src/ethernet_interface.cpp
++++ b/src/ethernet_interface.cpp
+@@ -164,6 +164,32 @@ void EthernetInterface::disableDHCP(IP::Protocol protocol)
+ }
+ }
+
++void EthernetInterface::enableDHCP(IP::Protocol protocol)
++{
++ DHCPConf dhcpState = EthernetInterfaceIntf::dhcpEnabled();
++ if (dhcpState == EthernetInterface::DHCPConf::none)
++ {
++ if (protocol == IP::Protocol::IPv4)
++ {
++ dhcpEnabled(EthernetInterface::DHCPConf::v4);
++ }
++ else if (protocol == IP::Protocol::IPv6)
++ {
++ dhcpEnabled(EthernetInterface::DHCPConf::v6);
++ }
++ }
++ else if ((dhcpState == EthernetInterface::DHCPConf::v4) &&
++ (protocol == IP::Protocol::IPv6))
++ {
++ dhcpEnabled(EthernetInterface::DHCPConf::both);
++ }
++ else if ((dhcpState == EthernetInterface::DHCPConf::v6) &&
++ (protocol == IP::Protocol::IPv4))
++ {
++ dhcpEnabled(EthernetInterface::DHCPConf::both);
++ }
++}
++
+ bool EthernetInterface::dhcpIsEnabled(IP::Protocol family)
+ {
+ const auto cur = EthernetInterfaceIntf::dhcpEnabled();
+@@ -436,8 +462,19 @@ void EthernetInterface::deleteObject(const std::string& ipaddress)
+ log<level::ERR>("DeleteObject:Unable to find the object.");
+ return;
+ }
++ auto protocol = it->second->type();
+ this->addrs.erase(it);
+
++ if (std::none_of(
++ addrs.cbegin(), addrs.cend(),
++ [&](const auto& elem_pair) {
++ return originIsManuallyAssigned(elem_pair.second->origin());
++ }
++ ))
++ {
++ enableDHCP(protocol);
++ }
++
+ writeConfigurationFile();
+ manager.reloadConfigs();
+ }
+diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp
+index 8928455..e0e3390 100644
+--- a/src/ethernet_interface.hpp
++++ b/src/ethernet_interface.hpp
+@@ -166,6 +166,12 @@ class EthernetInterface : public Ifaces
+ */
+ void disableDHCP(IP::Protocol protocol);
+
++ /** @brief Selectively enables DHCP
++ * @param[in] protocol - The IPv4 or IPv6 protocol to return from static
++ * addressing mode
++ */
++ void enableDHCP(IP::Protocol protocol);
++
+ /** Retrieve Link State */
+ bool linkUp() const override;
+
+--
+2.35.1
+
diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/network/phosphor-network_%.bbappend b/meta-ibs/meta-cp2-5422/recipes-phosphor/network/phosphor-network_%.bbappend
new file mode 100644
index 0000000000..4283da0ff6
--- /dev/null
+++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/network/phosphor-network_%.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += " \
+ file://0001-Fix-enable-DHCP-back.patch \
+ "