summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0009-Enhance-DHCP-beyond-just-OFF-and-IPv4-IPv6-enabled.patch104
1 files changed, 52 insertions, 52 deletions
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
index b6cf8f77d..596dfce48 100644
--- 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
@@ -1,4 +1,4 @@
-From 42f361622a9c029221c8a90f92104703166e48c2 Mon Sep 17 00:00:00 2001
+From 163c1756ee676859622614996be81393eb348220 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.
@@ -35,7 +35,7 @@ Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
---
Makefile.am | 1 +
configure.ac | 1 +
- ethernet_interface.cpp | 147 ++++++++++++++++++++++---------
+ ethernet_interface.cpp | 146 ++++++++++++++++++++++---------
ethernet_interface.hpp | 31 ++++++-
test/test_ethernet_interface.cpp | 3 +-
test/test_vlan_interface.cpp | 3 +-
@@ -44,10 +44,10 @@ Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
util.hpp | 7 +-
vlan_interface.cpp | 2 +-
vlan_interface.hpp | 4 +-
- 11 files changed, 165 insertions(+), 53 deletions(-)
+ 11 files changed, 164 insertions(+), 53 deletions(-)
diff --git a/Makefile.am b/Makefile.am
-index 1c47747..ff252fc 100644
+index 3bb5e7b..0bbbc8f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -97,6 +97,7 @@ phosphor_network_manager_CXXFLAGS = \
@@ -56,8 +56,8 @@ index 1c47747..ff252fc 100644
$(PHOSPHOR_LOGGING_CFLAGS) \
+ -DBOOST_ASIO_DISABLE_THREADS \
-flto
+
if FEATURE_NIC_ETHTOOL
- phosphor_network_manager_CXXFLAGS += -DNIC_SUPPORTS_ETHTOOL
diff --git a/configure.ac b/configure.ac
index 12d6caa..fed3e09 100644
--- a/configure.ac
@@ -71,7 +71,7 @@ index 12d6caa..fed3e09 100644
# Checks for header files.
AC_CHECK_HEADER(systemd/sd-bus.h, ,\
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
-index 73fd8fe..ba6195e 100644
+index fca86bd..3fb0f5e 100644
--- a/ethernet_interface.cpp
+++ b/ethernet_interface.cpp
@@ -3,7 +3,6 @@
@@ -82,13 +82,13 @@ index 73fd8fe..ba6195e 100644
#include "neighbor.hpp"
#include "network_manager.hpp"
#include "vlan_interface.hpp"
-@@ -40,9 +39,12 @@ using Argument = xyz::openbmc_project::Common::InvalidArgument;
- static constexpr const char* networkChannelCfgFile =
- "/var/channel_intf_data.json";
- static constexpr const char* defaultChannelPriv = "priv-admin";
+@@ -62,10 +61,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,
@@ -96,7 +96,7 @@ index 73fd8fe..ba6195e 100644
bool emitSignal) :
Ifaces(bus, objPath.c_str(), true),
bus(bus), manager(parent), objPath(objPath)
-@@ -83,6 +85,65 @@ static IP::Protocol convertFamily(int family)
+@@ -112,6 +113,65 @@ static IP::Protocol convertFamily(int family)
throw std::invalid_argument("Bad address family");
}
@@ -162,7 +162,7 @@ index 73fd8fe..ba6195e 100644
void EthernetInterface::createIPAddressObjects()
{
addrs.clear();
-@@ -93,7 +154,7 @@ void EthernetInterface::createIPAddressObjects()
+@@ -122,7 +182,7 @@ void EthernetInterface::createIPAddressObjects()
{
IP::Protocol addressType = convertFamily(addr.addrType);
IP::AddressOrigin origin = IP::AddressOrigin::Static;
@@ -171,7 +171,7 @@ index 73fd8fe..ba6195e 100644
{
origin = IP::AddressOrigin::DHCP;
}
-@@ -154,11 +215,11 @@ ObjectPath EthernetInterface::iP(IP::Protocol protType, std::string ipaddress,
+@@ -183,11 +243,11 @@ ObjectPath EthernetInterface::iP(IP::Protocol protType, std::string ipaddress,
uint8_t prefixLength, std::string gateway)
{
@@ -185,7 +185,7 @@ index 73fd8fe..ba6195e 100644
}
IP::AddressOrigin origin = IP::AddressOrigin::Static;
-@@ -441,7 +502,7 @@ bool EthernetInterface::iPv6AcceptRA(bool value)
+@@ -460,7 +520,7 @@ bool EthernetInterface::iPv6AcceptRA(bool value)
return value;
}
@@ -194,7 +194,7 @@ index 73fd8fe..ba6195e 100644
{
if (value == EthernetInterfaceIntf::dHCPEnabled())
{
-@@ -508,7 +569,7 @@ void EthernetInterface::loadVLAN(VlanId id)
+@@ -552,7 +612,7 @@ void EthernetInterface::loadVLAN(VlanId id)
std::string path = objPath;
path += "_" + std::to_string(id);
@@ -203,7 +203,7 @@ index 73fd8fe..ba6195e 100644
getDHCPValue(manager.getConfDir().string(), vlanInterfaceName);
auto vlanIntf = std::make_unique<phosphor::network::VlanInterface>(
-@@ -530,7 +591,8 @@ ObjectPath EthernetInterface::createVLAN(VlanId id)
+@@ -574,7 +634,8 @@ ObjectPath EthernetInterface::createVLAN(VlanId id)
path += "_" + std::to_string(id);
auto vlanIntf = std::make_unique<phosphor::network::VlanInterface>(
@@ -213,7 +213,7 @@ index 73fd8fe..ba6195e 100644
// write the device file for the vlan interface.
vlanIntf->writeDeviceFile();
-@@ -603,8 +665,6 @@ void EthernetInterface::writeConfigurationFile()
+@@ -647,8 +708,6 @@ void EthernetInterface::writeConfigurationFile()
// write all the static ip address in the systemd-network conf file
using namespace std::string_literals;
@@ -222,12 +222,16 @@ index 73fd8fe..ba6195e 100644
namespace fs = std::experimental::filesystem;
// if there is vlan interafce then write the configuration file
-@@ -673,42 +733,45 @@ void EthernetInterface::writeConfigurationFile()
+@@ -717,42 +776,45 @@ void EthernetInterface::writeConfigurationFile()
}
// Add the DHCP entry
- auto value = dHCPEnabled() ? "true"s : "false"s;
- stream << "DHCP="s + value + "\n";
+-
+- // When the interface configured as dhcp, we don't need below given entries
+- // in config file.
+- if (dHCPEnabled() == false)
+ std::string value = convertForMessage(EthernetInterfaceIntf::dHCPEnabled());
+ std::string::size_type loc = value.rfind(".");
+ std::string requestedDHCPState = value.substr(loc + 1);
@@ -238,33 +242,14 @@ index 73fd8fe..ba6195e 100644
+ bool dhcpv4Requested = dhcpToBeEnabled(IP::Protocol::IPv4, mappedDHCPState);
+ // Static IP addresses
+ for (const auto& addr : addrs)
-+ {
+ {
+- // Static
+- 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
@@ -278,12 +263,22 @@ index 73fd8fe..ba6195e 100644
-
- stream << "Address=" << address << "\n";
- }
-+ stream << "Gateway=" << gateway << "\n";
++ // 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";
}
--
++ }
+
- if (manager.getSystemConf())
-+ const auto& gateway6 = manager.getSystemConf()->defaultGateway6();
-+ if (!gateway6.empty())
++ if (manager.getSystemConf())
++ {
++ const auto& gateway = manager.getSystemConf()->defaultGateway();
++ if (!gateway.empty())
{
- const auto& gateway = manager.getSystemConf()->defaultGateway();
- if (!gateway.empty())
@@ -295,11 +290,16 @@ index 73fd8fe..ba6195e 100644
- {
- stream << "Gateway=" << gateway6 << "\n";
- }
++ stream << "Gateway=" << gateway << "\n";
++ }
++ const auto& gateway6 = manager.getSystemConf()->defaultGateway6();
++ if (!gateway6.empty())
++ {
+ stream << "Gateway=" << gateway6 << "\n";
}
}
-@@ -819,7 +882,7 @@ std::string EthernetInterface::mACAddress(std::string value)
+@@ -863,7 +925,7 @@ std::string EthernetInterface::mACAddress(std::string value)
void EthernetInterface::deleteAll()
{
@@ -309,10 +309,10 @@ index 73fd8fe..ba6195e 100644
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 3e4cf12..a962751 100644
+index 058d328..4e36ae8 100644
--- a/ethernet_interface.hpp
+++ b/ethernet_interface.hpp
-@@ -91,7 +91,7 @@ class EthernetInterface : public Ifaces
+@@ -92,7 +92,7 @@ class EthernetInterface : public Ifaces
* send.
*/
EthernetInterface(sdbusplus::bus::bus& bus, const std::string& objPath,
@@ -321,7 +321,7 @@ index 3e4cf12..a962751 100644
bool emitSignal = true);
/** @brief Function to create ipaddress dbus object.
-@@ -157,7 +157,34 @@ class EthernetInterface : public Ifaces
+@@ -158,7 +158,34 @@ class EthernetInterface : public Ifaces
}
/** Set value of DHCPEnabled */
@@ -355,8 +355,8 @@ index 3e4cf12..a962751 100644
+ */
+ void disableDHCP(IP::Protocol protocol);
- /** @brief sets the MAC address.
- * @param[in] value - MAC address which needs to be set on the system.
+ /** Retrieve Link State */
+ bool linkUp() const override;
diff --git a/test/test_ethernet_interface.cpp b/test/test_ethernet_interface.cpp
index 30dee8a..87fd68d 100644
--- a/test/test_ethernet_interface.cpp
@@ -500,5 +500,5 @@ index a994d05..37ae7ee 100644
/** @brief Delete this d-bus object.
*/
--
-2.24.1
+2.25.1