summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-network
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2020-12-08 00:45:20 +0300
committerJason M. Bills <jason.m.bills@linux.intel.com>2020-12-10 01:15:05 +0300
commit82dbc15a05125a812c140a3c8cff81c366482229 (patch)
tree9c8f1ad262a2e281f20340cf8646aca6f8596044 /meta-openbmc-mods/meta-common/recipes-network
parent8d6ae7f2a817751fad151168fa10ce28ee0869d8 (diff)
downloadopenbmc-82dbc15a05125a812c140a3c8cff81c366482229.tar.xz
Update to internal 0.26
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-network')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb25
-rwxr-xr-xmeta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/check-for-host-in-reset65
-rw-r--r--meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/ncsi-monitor.service11
-rw-r--r--meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch75
-rw-r--r--meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch506
-rw-r--r--meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend8
6 files changed, 144 insertions, 546 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb
new file mode 100644
index 000000000..98d053219
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb
@@ -0,0 +1,25 @@
+SUMMARY = "Check for host in reset to disable the NCSI iface"
+DESCRIPTION = "If the host is in reset, the NCSI NIC will not be \
+ available, so this will manually disable the NIC"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
+
+PV = "1.0"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
+
+SRC_URI = "\
+ file://check-for-host-in-reset \
+ file://${BPN}.service \
+ "
+
+inherit obmc-phosphor-systemd
+
+SYSTEMD_SERVICE_${PN} += "${BPN}.service"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/check-for-host-in-reset ${D}/${bindir}/check-for-host-in-reset
+
+}
diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/check-for-host-in-reset b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/check-for-host-in-reset
new file mode 100755
index 000000000..aa17aebf2
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/check-for-host-in-reset
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# PFR Boot Time Detection
+#
+# The Platform Firmware Recovery system is designed to confirm the server is
+# running valid images. The server boot process is controlled with a
+# programmable device. The programmable device prevents the system, and the
+# BMC from booting until after it has confirmed the firmware images match a
+# known checksum. Two reset controls are asserted while the checksum
+# calculation is being performed. One prevents the BMC from booting, the other
+# (RSMRST_N) prevents the main processors from leaving reset.
+#
+# If the BMC FW checksum is correct the BMC is allowed to boot.
+# If the BIOS checksum fails the BIOS is not allowed to boot.
+# In this condition the BMC will boot believing the NCSI NIC is functional.
+# This will not be the case when RMSRST_N is asserted. The BIOS will not
+# configure the shared NIC. The BMC will not be able to send or receive
+# network traffic via the shared NIC. This becomes a problem depending on how
+# the NCSI channel is configured.
+#
+# When the NCSI channel is configured using DHCP the BMC is unable to
+# communicate to a DHCP server. Unable to acquire a valid IP state, the NCSI
+# NIC is left DOWN.
+# The problem that occurs is when the NIC is configured with a static
+# address. The BMC is unable to determine the configuration state of the NCSI
+# NIC, and behaves as if everything is working. The problem is the network
+# routing table will, in most cases, be left in a state that prevents traffic
+# from being sent/received from the dedicated NIC. This prevents network
+# access to the BMC, which in turn leaves the system unrecoverable.
+#
+# The purpose of this script is to check for the assertion of the RSMRST_N
+# control at BMC boot time. It will perform this test once. In the event the
+# RSMRST_N is found to be asserted, the BMC will take the NCSI NIC down. No
+# logic for detecting the deassertion will be performed. Once the new image
+# for the BIOS has been transferred, and the checksum confirmed, the BMC will
+# be reset by the programmable device. The programmable device will confirm
+# the checksums, and release both the BMC and the BIOS to boot normally.
+#
+# Flow:
+# The service will be a one-shot that waits for the network.target, as is done
+# by BMCWeb.
+# During a normal boot the RSMRST_N will not be asserted, and this script will
+# not perform an action.
+# When RSMRST_N is asserted the NCSI channel will be given a link down
+# command. This regardless of static or DHCP configuration mode.
+
+GPIOFIND=/usr/bin/gpiofind
+GPIOGET=/usr/bin/gpioget
+RSMRST="RSMRST_N"
+
+# Read the assertion state from the RSMRST_N input
+function get_rsmrst_state {
+ local __resultVal=$1
+ local gpio_state=$($GPIOGET $($GPIOFIND "$RSMRST"))
+ eval $__resultVal="'$gpio_state'"
+ return 0
+}
+
+get_rsmrst_state rsmrst_val
+
+if [ "$rsmrst_val" -eq 0 ]
+then
+ echo "RSMRST_N is asserted, take eth1 down"
+ ip link set down dev eth1
+fi
diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/ncsi-monitor.service b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/ncsi-monitor.service
new file mode 100644
index 000000000..19554c94d
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/ncsi-monitor.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Check for host in reset
+After=multi-user.target
+
+[Service]
+Type=oneshot
+Restart=no
+ExecStart=/usr/bin/check-for-host-in-reset
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch
index f361c3d07..bcdad9c21 100644
--- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch
+++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch
@@ -1,4 +1,4 @@
-From 5dfcd6c81a9f26c6c9c867a7a49f5259c3512be2 Mon Sep 17 00:00:00 2001
+From 9b0fcfc02c9ba33c02e210b8d253fa64eeb69060 Mon Sep 17 00:00:00 2001
From: AppaRao Puli <apparao.puli@linux.intel.com>
Date: Thu, 2 Apr 2020 17:06:07 +0530
Subject: [PATCH 1/2] Adding channel specific privilege to network
@@ -17,20 +17,22 @@ access command
Change-Id: I3b592a19363eef684e31d5f7c34dad8f2f9211df
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
+
+%% original patch: 0003-Adding-channel-specific-privilege-to-network.patch
---
- ethernet_interface.cpp | 123 +++++++++++++++++++++++++++++++++++++++++++++++++
- ethernet_interface.hpp | 39 +++++++++++++++-
- network_manager.cpp | 104 +++++++++++++++++++++++++++++++++++++++++
- network_manager.hpp | 9 ++++
- 4 files changed, 274 insertions(+), 1 deletion(-)
+ ethernet_interface.cpp | 123 +++++++++++++++++++++++++++++++++++++++++
+ ethernet_interface.hpp | 38 ++++++++++++-
+ network_manager.cpp | 104 ++++++++++++++++++++++++++++++++++
+ network_manager.hpp | 9 +++
+ 4 files changed, 273 insertions(+), 1 deletion(-)
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
-index ed1e1ba..fca86bd 100644
+index 76d7f92..318b94b 100644
--- a/ethernet_interface.cpp
+++ b/ethernet_interface.cpp
-@@ -37,6 +37,10 @@ using namespace phosphor::logging;
- using namespace sdbusplus::xyz::openbmc_project::Common::Error;
- using Argument = xyz::openbmc_project::Common::InvalidArgument;
+@@ -44,6 +44,10 @@ constexpr auto PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties";
+ constexpr auto RESOLVED_SERVICE_PATH = "/org/freedesktop/resolve1/link/";
+ constexpr auto METHOD_GET = "Get";
+static constexpr const char* networkChannelCfgFile =
+ "/var/channel_intf_data.json";
@@ -39,15 +41,15 @@ index ed1e1ba..fca86bd 100644
struct EthernetIntfSocket
{
EthernetIntfSocket(int domain, int type, int protocol)
-@@ -86,6 +90,7 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus,
+@@ -101,6 +105,7 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus,
+ EthernetInterfaceIntf::autoNeg(std::get<2>(ifInfo));
EthernetInterfaceIntf::speed(std::get<0>(ifInfo));
- EthernetInterfaceIntf::linkUp(std::get<3>(ifInfo));
#endif
+ getChannelPrivilege(intfName);
// Emit deferred signal.
if (emitSignal)
-@@ -869,5 +874,123 @@ void EthernetInterface::deleteAll()
+@@ -1076,5 +1081,123 @@ void EthernetInterface::deleteAll()
manager.writeToConfigurationFile();
}
@@ -172,7 +174,7 @@ index ed1e1ba..fca86bd 100644
} // namespace network
} // namespace phosphor
diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp
-index 68668d6..058d328 100644
+index abaf43e..fb538a7 100644
--- a/ethernet_interface.hpp
+++ b/ethernet_interface.hpp
@@ -2,11 +2,14 @@
@@ -183,7 +185,7 @@ index 68668d6..058d328 100644
#include "xyz/openbmc_project/Network/IP/Create/server.hpp"
#include "xyz/openbmc_project/Network/Neighbor/CreateStatic/server.hpp"
- #include <experimental/filesystem>
+ #include <filesystem>
+#include <nlohmann/json.hpp>
#include <sdbusplus/bus.hpp>
+#include <sdbusplus/bus/match.hpp>
@@ -200,7 +202,7 @@ index 68668d6..058d328 100644
using IP = sdbusplus::xyz::openbmc_project::Network::server::IP;
-@@ -31,10 +35,14 @@ using EthernetInterfaceIntf =
+@@ -31,11 +35,15 @@ using EthernetInterfaceIntf =
sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface;
using MacAddressIntf =
sdbusplus::xyz::openbmc_project::Network::server::MACAddress;
@@ -210,12 +212,13 @@ index 68668d6..058d328 100644
using ServerList = std::vector<std::string>;
using ObjectPath = sdbusplus::message::object_path;
-+using DbusVariant = std::variant<std::string, std::vector<std::string>>;
-+
- namespace fs = std::experimental::filesystem;
+ namespace fs = std::filesystem;
++using DbusVariant =
++ sdbusplus::message::variant<std::string, std::vector<std::string>>;
class Manager; // forward declaration of network manager.
-@@ -199,6 +208,14 @@ class EthernetInterface : public Ifaces
+
+@@ -223,6 +231,14 @@ class EthernetInterface : public Ifaces
*/
void deleteAll();
@@ -230,10 +233,10 @@ index 68668d6..058d328 100644
using EthernetInterfaceIntf::dHCPEnabled;
using EthernetInterfaceIntf::interfaceName;
using EthernetInterfaceIntf::linkUp;
-@@ -296,6 +313,26 @@ class EthernetInterface : public Ifaces
- std::string objPath;
-
- friend class TestEthernetInterface;
+@@ -344,6 +360,26 @@ class EthernetInterface : public Ifaces
+ * @returns true/false value if the address is static
+ */
+ bool originIsManuallyAssigned(IP::AddressOrigin origin);
+
+ /** @brief gets the channel privilege.
+ * @param[in] interfaceName - Network interface name.
@@ -258,10 +261,10 @@ index 68668d6..058d328 100644
} // namespace network
diff --git a/network_manager.cpp b/network_manager.cpp
-index 043d7a2..75f4e5f 100644
+index c55c9bb..b5ff278 100644
--- a/network_manager.cpp
+++ b/network_manager.cpp
-@@ -34,6 +34,13 @@ extern std::unique_ptr<Timer> restartTimer;
+@@ -36,6 +36,13 @@ extern std::unique_ptr<Timer> restartTimer;
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
@@ -275,7 +278,7 @@ index 043d7a2..75f4e5f 100644
Manager::Manager(sdbusplus::bus::bus& bus, const char* objPath,
const std::string& path) :
details::VLANCreateIface(bus, objPath, true),
-@@ -41,6 +48,101 @@ Manager::Manager(sdbusplus::bus::bus& bus, const char* objPath,
+@@ -43,6 +50,103 @@ Manager::Manager(sdbusplus::bus::bus& bus, const char* objPath,
{
fs::path confDir(path);
setConfDir(confDir);
@@ -344,10 +347,12 @@ index 043d7a2..75f4e5f 100644
+ return;
+ }
+
-+ std::variant<std::vector<std::string>> result;
++ sdbusplus::message::variant<std::vector<std::string>> result;
+ reply.read(result);
+
-+ supportedPrivList = std::get<std::vector<std::string>>(result);
++ supportedPrivList =
++ sdbusplus::message::variant_ns::get<std::vector<std::string>>(
++ result);
+ }
+
+ // Resgister the signal
@@ -367,8 +372,8 @@ index 043d7a2..75f4e5f 100644
+ {
+ if (t.first == propNameAllPrivileges)
+ {
-+ supportedPrivList =
-+ std::get<std::vector<std::string>>(t.second);
++ supportedPrivList = sdbusplus::message::variant_ns::get<
++ std::vector<std::string>>(t.second);
+ }
+ }
+ });
@@ -378,10 +383,10 @@ index 043d7a2..75f4e5f 100644
bool Manager::createDefaultNetworkFiles(bool force)
diff --git a/network_manager.hpp b/network_manager.hpp
-index edb341f..5fb9fe8 100644
+index 6815d3f..96e20a6 100644
--- a/network_manager.hpp
+++ b/network_manager.hpp
-@@ -137,6 +137,12 @@ class Manager : public details::VLANCreateIface
+@@ -151,6 +151,12 @@ class Manager : public details::VLANCreateIface
return (interfaces.find(intf) != interfaces.end());
}
@@ -394,7 +399,7 @@ index edb341f..5fb9fe8 100644
protected:
/** @brief Persistent sdbusplus DBus bus connection. */
sdbusplus::bus::bus& bus;
-@@ -159,6 +165,9 @@ class Manager : public details::VLANCreateIface
+@@ -173,6 +179,9 @@ class Manager : public details::VLANCreateIface
/** @brief Network Configuration directory. */
fs::path confDir;
@@ -405,5 +410,5 @@ index edb341f..5fb9fe8 100644
} // namespace network
--
-2.7.4
+2.26.2
diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch
deleted file mode 100644
index 1b36e9d77..000000000
--- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch
+++ /dev/null
@@ -1,506 +0,0 @@
-From 8aee963295f7da07ae67aa09c4eba3fbd2a6ff19 Mon Sep 17 00:00:00 2001
-From: Johnathan Mantey <johnathanx.mantey@intel.com>
-Date: Thu, 30 Jan 2020 15:07:39 -0800
-Subject: [PATCH] Enhance DHCP beyond just OFF and IPv4/IPv6 enabled.
-
-DHCP is not a binary option. The network interface can have DHCP
-disabled, IPv4 only, IPv6 only, and IPv4/IPv6.
-
-Tested:
-Using dbus-send or busctl:
-Disabled DHCP, and confirmed only link local addresses were present.
-
-Assigned only static addresses. Both with/and without the gateway set
-to 0.0.0.0
-
-Deleted static IPv4 addresses.
-Reassigned static addresses.
-
-Enabled DHCP for ipv4 only, and witnessed a DHCP server assign a valid
-address.
-
-Assigned static IPv4 address.
-Assigned static IPv6 address.
-Confirmed both IPv4 and IPv6 static addresses are active.
-
-Enabled DHCP for ipv6 only, and confirmed the static v4 address
-remains. The ipv6 address is removed, waiting for a DHCP6 server.
-
-Enabled DHCP for both ipv4 and ipv6. IPv4 address was assigned. IPv6
-address is assumed to succeed, as systemd config file enables IPv6
-DHCP.
-
-Change-Id: I2e0ff80ac3a5e88bcff28adac419bf21e37be162
-Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
-
-%% original patch: 0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch
----
- Makefile.am | 1 +
- configure.ac | 1 +
- ethernet_interface.cpp | 146 ++++++++++++++++++++++---------
- ethernet_interface.hpp | 31 ++++++-
- test/test_ethernet_interface.cpp | 3 +-
- test/test_vlan_interface.cpp | 3 +-
- types.hpp | 3 +
- util.cpp | 16 +++-
- util.hpp | 7 +-
- vlan_interface.cpp | 2 +-
- vlan_interface.hpp | 4 +-
- 11 files changed, 164 insertions(+), 53 deletions(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index 3bb5e7b..0bbbc8f 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -97,6 +97,7 @@ phosphor_network_manager_CXXFLAGS = \
- $(SDEVENTPLUS_CFLAGS) \
- $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
- $(PHOSPHOR_LOGGING_CFLAGS) \
-+ -DBOOST_ASIO_DISABLE_THREADS \
- -flto
-
- if FEATURE_NIC_ETHTOOL
-diff --git a/configure.ac b/configure.ac
-index 12d6caa..fed3e09 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -36,6 +36,7 @@ AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
- PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
- PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
- PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0])
-+AC_CHECK_HEADER(boost/algorithm/string/split.hpp, [], [AC_MSG_ERROR([Could not find boost/algorithm/string/split.hpp])])
-
- # Checks for header files.
- AC_CHECK_HEADER(systemd/sd-bus.h, ,\
-diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
-index d6c7bdd..82716f9 100644
---- a/ethernet_interface.cpp
-+++ b/ethernet_interface.cpp
-@@ -3,7 +3,6 @@
- #include "ethernet_interface.hpp"
-
- #include "config_parser.hpp"
--#include "ipaddress.hpp"
- #include "neighbor.hpp"
- #include "network_manager.hpp"
- #include "vlan_interface.hpp"
-@@ -69,10 +68,12 @@ struct EthernetIntfSocket
-
- int sock{-1};
- };
-+std::map<std::string, std::string> mapDHCPToSystemd = {
-+ {"both", "true"}, {"v4", "ipv4"}, {"v6", "ipv6"}, {"none", "false"}};
-
- EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus,
- const std::string& objPath,
-- bool dhcpEnabled, Manager& parent,
-+ DHCPConf dhcpEnabled, Manager& parent,
- bool emitSignal) :
- Ifaces(bus, objPath.c_str(), true),
- bus(bus), manager(parent), objPath(objPath)
-@@ -119,6 +120,65 @@ static IP::Protocol convertFamily(int family)
- throw std::invalid_argument("Bad address family");
- }
-
-+void EthernetInterface::disableDHCP(IP::Protocol protocol)
-+{
-+ DHCPConf dhcpState = EthernetInterfaceIntf::dHCPEnabled();
-+ if (dhcpState == EthernetInterface::DHCPConf::both)
-+ {
-+ if (protocol == IP::Protocol::IPv4)
-+ {
-+ dHCPEnabled(EthernetInterface::DHCPConf::v6);
-+ }
-+ else if (protocol == IP::Protocol::IPv6)
-+ {
-+ dHCPEnabled(EthernetInterface::DHCPConf::v4);
-+ }
-+ }
-+ else if ((dhcpState == EthernetInterface::DHCPConf::v4) &&
-+ (protocol == IP::Protocol::IPv4))
-+ {
-+ dHCPEnabled(EthernetInterface::DHCPConf::none);
-+ }
-+ else if ((dhcpState == EthernetInterface::DHCPConf::v6) &&
-+ (protocol == IP::Protocol::IPv6))
-+ {
-+ dHCPEnabled(EthernetInterface::DHCPConf::none);
-+ }
-+}
-+
-+bool EthernetInterface::dhcpIsEnabled(IP::Protocol family, bool ignoreProtocol)
-+{
-+ return ((EthernetInterfaceIntf::dHCPEnabled() ==
-+ EthernetInterface::DHCPConf::both) ||
-+ ((EthernetInterfaceIntf::dHCPEnabled() ==
-+ EthernetInterface::DHCPConf::v6) &&
-+ ((family == IP::Protocol::IPv6) || ignoreProtocol)) ||
-+ ((EthernetInterfaceIntf::dHCPEnabled() ==
-+ EthernetInterface::DHCPConf::v4) &&
-+ ((family == IP::Protocol::IPv4) || ignoreProtocol)));
-+}
-+
-+bool EthernetInterface::dhcpToBeEnabled(IP::Protocol family,
-+ std::string& nextDHCPState)
-+{
-+ return ((nextDHCPState == "true") ||
-+ ((nextDHCPState == "ipv6") && (family == IP::Protocol::IPv6)) ||
-+ ((nextDHCPState == "ipv4") && (family == IP::Protocol::IPv4)));
-+}
-+
-+bool EthernetInterface::addressIsStatic(IP::AddressOrigin origin)
-+{
-+ return (
-+#ifdef LINK_LOCAL_AUTOCONFIGURATION
-+ (origin == IP::AddressOrigin::Static)
-+#else
-+ (origin == IP::AddressOrigin::Static ||
-+ origin == IP::AddressOrigin::LinkLocal)
-+#endif
-+
-+ );
-+}
-+
- void EthernetInterface::createIPAddressObjects()
- {
- addrs.clear();
-@@ -129,7 +189,7 @@ void EthernetInterface::createIPAddressObjects()
- {
- IP::Protocol addressType = convertFamily(addr.addrType);
- IP::AddressOrigin origin = IP::AddressOrigin::Static;
-- if (dHCPEnabled())
-+ if (dhcpIsEnabled(addressType))
- {
- origin = IP::AddressOrigin::DHCP;
- }
-@@ -190,11 +250,11 @@ ObjectPath EthernetInterface::iP(IP::Protocol protType, std::string ipaddress,
- uint8_t prefixLength, std::string gateway)
- {
-
-- if (dHCPEnabled())
-+ if (dhcpIsEnabled(protType))
- {
- log<level::INFO>("DHCP enabled on the interface"),
- entry("INTERFACE=%s", interfaceName().c_str());
-- dHCPEnabled(false);
-+ disableDHCP(protType);
- }
-
- IP::AddressOrigin origin = IP::AddressOrigin::Static;
-@@ -469,7 +529,7 @@ bool EthernetInterface::iPv6AcceptRA(bool value)
- return value;
- }
-
--bool EthernetInterface::dHCPEnabled(bool value)
-+EthernetInterface::DHCPConf EthernetInterface::dHCPEnabled(DHCPConf value)
- {
- if (value == EthernetInterfaceIntf::dHCPEnabled())
- {
-@@ -685,7 +745,7 @@ void EthernetInterface::loadVLAN(VlanId id)
- std::string path = objPath;
- path += "_" + std::to_string(id);
-
-- auto dhcpEnabled =
-+ DHCPConf dhcpEnabled =
- getDHCPValue(manager.getConfDir().string(), vlanInterfaceName);
-
- auto vlanIntf = std::make_unique<phosphor::network::VlanInterface>(
-@@ -707,7 +767,8 @@ ObjectPath EthernetInterface::createVLAN(VlanId id)
- path += "_" + std::to_string(id);
-
- auto vlanIntf = std::make_unique<phosphor::network::VlanInterface>(
-- bus, path.c_str(), false, id, *this, manager);
-+ bus, path.c_str(), EthernetInterface::DHCPConf::none, id, *this,
-+ manager);
-
- // write the device file for the vlan interface.
- vlanIntf->writeDeviceFile();
-@@ -780,8 +841,6 @@ void EthernetInterface::writeConfigurationFile()
- // write all the static ip address in the systemd-network conf file
-
- using namespace std::string_literals;
-- using AddressOrigin =
-- sdbusplus::xyz::openbmc_project::Network::server::IP::AddressOrigin;
- namespace fs = std::experimental::filesystem;
-
- // if there is vlan interafce then write the configuration file
-@@ -855,42 +914,45 @@ void EthernetInterface::writeConfigurationFile()
- }
-
- // Add the DHCP entry
-- auto value = dHCPEnabled() ? "true"s : "false"s;
-- stream << "DHCP="s + value + "\n";
-+ std::string value = convertForMessage(EthernetInterfaceIntf::dHCPEnabled());
-+ std::string::size_type loc = value.rfind(".");
-+ std::string requestedDHCPState = value.substr(loc + 1);
-+ std::string mappedDHCPState = mapDHCPToSystemd[requestedDHCPState];
-+ stream << "DHCP="s + mappedDHCPState + "\n";
-+
-+ bool dhcpv6Requested = dhcpToBeEnabled(IP::Protocol::IPv6, mappedDHCPState);
-+ bool dhcpv4Requested = dhcpToBeEnabled(IP::Protocol::IPv4, mappedDHCPState);
-+ // Static IP addresses
-+ for (const auto& addr : addrs)
-+ {
-+ bool isValidIPv4 = isValidIP(AF_INET, addr.second->address());
-+ bool isValidIPv6 = isValidIP(AF_INET6, addr.second->address());
-+ if (((!dhcpv4Requested && isValidIPv4) ||
-+ (!dhcpv6Requested && isValidIPv6)) &&
-+ addressIsStatic(addr.second->origin()))
-+ {
-+ // Process all static addresses
-+ std::string address = addr.second->address() + "/" +
-+ std::to_string(addr.second->prefixLength());
-+
-+ // build the address entries. Do not use [Network] shortcuts to
-+ // insert address entries.
-+ stream << "[Address]\n";
-+ stream << "Address=" << address << "\n";
-+ }
-+ }
-
-- // When the interface configured as dhcp, we don't need below given entries
-- // in config file.
-- if (dHCPEnabled() == false)
-+ if (manager.getSystemConf())
- {
-- // Static
-- for (const auto& addr : addrs)
-+ const auto& gateway = manager.getSystemConf()->defaultGateway();
-+ if (!gateway.empty())
- {
-- if (addr.second->origin() == AddressOrigin::Static
--#ifndef LINK_LOCAL_AUTOCONFIGURATION
-- || addr.second->origin() == AddressOrigin::LinkLocal
--#endif
-- )
-- {
-- std::string address =
-- addr.second->address() + "/" +
-- std::to_string(addr.second->prefixLength());
--
-- stream << "Address=" << address << "\n";
-- }
-+ stream << "Gateway=" << gateway << "\n";
- }
--
-- if (manager.getSystemConf())
-+ const auto& gateway6 = manager.getSystemConf()->defaultGateway6();
-+ if (!gateway6.empty())
- {
-- const auto& gateway = manager.getSystemConf()->defaultGateway();
-- if (!gateway.empty())
-- {
-- stream << "Gateway=" << gateway << "\n";
-- }
-- const auto& gateway6 = manager.getSystemConf()->defaultGateway6();
-- if (!gateway6.empty())
-- {
-- stream << "Gateway=" << gateway6 << "\n";
-- }
-+ stream << "Gateway=" << gateway6 << "\n";
- }
- }
-
-@@ -1001,7 +1063,7 @@ std::string EthernetInterface::mACAddress(std::string value)
-
- void EthernetInterface::deleteAll()
- {
-- if (EthernetInterfaceIntf::dHCPEnabled())
-+ if (dhcpIsEnabled(IP::Protocol::IPv4, true))
- {
- log<level::INFO>("DHCP enabled on the interface"),
- entry("INTERFACE=%s", interfaceName().c_str());
-diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp
-index 6344533..3f7fd31 100644
---- a/ethernet_interface.hpp
-+++ b/ethernet_interface.hpp
-@@ -94,7 +94,7 @@ class EthernetInterface : public Ifaces
- * send.
- */
- EthernetInterface(sdbusplus::bus::bus& bus, const std::string& objPath,
-- bool dhcpEnabled, Manager& parent,
-+ DHCPConf dhcpEnabled, Manager& parent,
- bool emitSignal = true);
-
- /** @brief Function used to load the nameservers.
-@@ -164,7 +164,34 @@ class EthernetInterface : public Ifaces
- }
-
- /** Set value of DHCPEnabled */
-- bool dHCPEnabled(bool value) override;
-+ DHCPConf dHCPEnabled(DHCPConf value) override;
-+
-+ /** @brief Determines if DHCP is active for the IP::Protocol supplied.
-+ * @param[in] protocol - Either IPv4 or IPv6
-+ * @param[in] ignoreProtocol - Allows IPv4 and IPv6 to be checked using a
-+ * single call.
-+ * @returns true/false value if DHCP is active for the input protocol
-+ */
-+ bool dhcpIsEnabled(IP::Protocol protocol, bool ignoreProtocol = false);
-+
-+ /** @brief Determines if DHCP will be active following next reconfig
-+ * @param[in] protocol - Either IPv4 or IPv6
-+ * @param[in] nextDHCPState - The new DHCP mode to take affect
-+ * @returns true/false value if DHCP is active for the input protocol
-+ */
-+ bool dhcpToBeEnabled(IP::Protocol family, std::string& nextDHCPState);
-+
-+ /** @brief Determines if the address is manually assigned
-+ * @param[in] origin - The origin entry of the IP::Address
-+ * @returns true/false value if the address is static
-+ */
-+ bool addressIsStatic(IP::AddressOrigin origin);
-+
-+ /** @brief Selectively disables DHCP
-+ * @param[in] protocol - The IPv4 or IPv6 protocol to return to static
-+ * addressing mode
-+ */
-+ void disableDHCP(IP::Protocol protocol);
-
- /** Retrieve Link State */
- bool linkUp() const override;
-diff --git a/test/test_ethernet_interface.cpp b/test/test_ethernet_interface.cpp
-index d0beef7..3e2f9ff 100644
---- a/test/test_ethernet_interface.cpp
-+++ b/test/test_ethernet_interface.cpp
-@@ -59,7 +59,8 @@ class TestEthernetInterface : public testing::Test
- {
- mock_clear();
- mock_addIF("test0", 1, mac);
-- return {bus, "/xyz/openbmc_test/network/test0", false, manager, true};
-+ return {bus, "/xyz/openbmc_test/network/test0",
-+ EthernetInterface::DHCPConf::none, manager};
- }
-
- int countIPObjects()
-diff --git a/test/test_vlan_interface.cpp b/test/test_vlan_interface.cpp
-index 1dffc7e..e49b43f 100644
---- a/test/test_vlan_interface.cpp
-+++ b/test/test_vlan_interface.cpp
-@@ -50,7 +50,8 @@ class TestVlanInterface : public testing::Test
- {
- mock_clear();
- mock_addIF("test0", 1);
-- return {bus, "/xyz/openbmc_test/network/test0", false, manager};
-+ return {bus, "/xyz/openbmc_test/network/test0",
-+ EthernetInterface::DHCPConf::none, manager};
- }
-
- void setConfDir()
-diff --git a/types.hpp b/types.hpp
-index 123067a..c4409fe 100644
---- a/types.hpp
-+++ b/types.hpp
-@@ -1,5 +1,7 @@
- #pragma once
-
-+#include "ipaddress.hpp"
-+
- #include <ifaddrs.h>
- #include <netinet/in.h>
- #include <systemd/sd-event.h>
-@@ -50,6 +52,7 @@ struct AddrInfo
- {
- uint8_t addrType;
- std::string ipaddress;
-+ IP::AddressOrigin origin;
- uint16_t prefix;
- };
-
-diff --git a/util.cpp b/util.cpp
-index 13a607f..554d7f6 100644
---- a/util.cpp
-+++ b/util.cpp
-@@ -410,9 +410,11 @@ std::optional<std::string> interfaceToUbootEthAddr(const char* intf)
- return "eth" + std::to_string(idx) + "addr";
- }
-
--bool getDHCPValue(const std::string& confDir, const std::string& intf)
-+EthernetInterfaceIntf::DHCPConf getDHCPValue(const std::string& confDir,
-+ const std::string& intf)
- {
-- bool dhcp = false;
-+ EthernetInterfaceIntf::DHCPConf dhcp =
-+ EthernetInterfaceIntf::DHCPConf::none;
- // Get the interface mode value from systemd conf
- // using namespace std::string_literals;
- fs::path confPath = confDir;
-@@ -434,7 +436,15 @@ bool getDHCPValue(const std::string& confDir, const std::string& intf)
- // There will be only single value for DHCP key.
- if (values[0] == "true")
- {
-- dhcp = true;
-+ dhcp = EthernetInterfaceIntf::DHCPConf::both;
-+ }
-+ else if (values[0] == "ipv4")
-+ {
-+ dhcp = EthernetInterfaceIntf::DHCPConf::v4;
-+ }
-+ else if (values[0] == "ipv6")
-+ {
-+ dhcp = EthernetInterfaceIntf::DHCPConf::v6;
- }
- return dhcp;
- }
-diff --git a/util.hpp b/util.hpp
-index 251aa0d..ee11f4e 100644
---- a/util.hpp
-+++ b/util.hpp
-@@ -13,12 +13,16 @@
- #include <sdbusplus/bus.hpp>
- #include <string>
- #include <string_view>
-+#include <xyz/openbmc_project/Network/EthernetInterface/server.hpp>
-
- namespace phosphor
- {
- namespace network
- {
-
-+using EthernetInterfaceIntf =
-+ sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface;
-+
- constexpr auto IPV4_MIN_PREFIX_LENGTH = 1;
- constexpr auto IPV4_MAX_PREFIX_LENGTH = 32;
- constexpr auto IPV6_MAX_PREFIX_LENGTH = 64;
-@@ -156,7 +160,8 @@ std::optional<std::string> interfaceToUbootEthAddr(const char* intf);
- * @param[in] confDir - Network configuration directory.
- * @param[in] intf - Interface name.
- */
--bool getDHCPValue(const std::string& confDir, const std::string& intf);
-+EthernetInterfaceIntf::DHCPConf getDHCPValue(const std::string& confDir,
-+ const std::string& intf);
-
- namespace internal
- {
-diff --git a/vlan_interface.cpp b/vlan_interface.cpp
-index 73de4e8..26282cb 100644
---- a/vlan_interface.cpp
-+++ b/vlan_interface.cpp
-@@ -22,7 +22,7 @@ using namespace phosphor::logging;
- using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-
- VlanInterface::VlanInterface(sdbusplus::bus::bus& bus,
-- const std::string& objPath, bool dhcpEnabled,
-+ const std::string& objPath, DHCPConf dhcpEnabled,
- uint32_t vlanID, EthernetInterface& intf,
- Manager& parent) :
- VlanIface(bus, objPath.c_str()),
-diff --git a/vlan_interface.hpp b/vlan_interface.hpp
-index a994d05..37ae7ee 100644
---- a/vlan_interface.hpp
-+++ b/vlan_interface.hpp
-@@ -45,8 +45,8 @@ class VlanInterface : public VlanIface,
- * @param[in] manager - network manager object.
- */
- VlanInterface(sdbusplus::bus::bus& bus, const std::string& objPath,
-- bool dhcpEnabled, uint32_t vlanID, EthernetInterface& intf,
-- Manager& manager);
-+ DHCPConf dhcpEnabled, uint32_t vlanID,
-+ EthernetInterface& intf, Manager& manager);
-
- /** @brief Delete this d-bus object.
- */
---
-2.25.2
-
diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend
index 5774d5318..4f4030169 100644
--- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend
@@ -3,10 +3,8 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
DEPENDS += "nlohmann-json boost"
#todo: Appu, fix nobranch
-SRC_URI = "git://github.com/openbmc/phosphor-networkd;nobranch=1"
-SRC_URI += "file://0003-Adding-channel-specific-privilege-to-network.patch \
- file://0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch \
- "
-SRCREV = "d0679f9bb46670c593061c4aaebec2a577cdd5c3"
+SRC_URI = "git://github.com/openbmc/phosphor-networkd"
+
+SRCREV = "ffcba341a893318588afe83e8d767d8c20fd9189"
EXTRA_OECONF_append = " --enable-nic-ethtool=yes"