From 1fc0d70f658da30091bcd49f9bf29aecd6b99ba7 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Thu, 6 Jan 2022 13:50:19 -0800 Subject: Update to internal 0.86 Signed-off-by: Jason M. Bills --- ...ing-channel-specific-privilege-to-network.patch | 52 ++-- ...Fix-for-updating-MAC-address-from-RedFish.patch | 40 ++-- ...-logs-to-isolate-the-coredump-issue-of-RT.patch | 261 --------------------- .../network/phosphor-network_%.bbappend | 3 +- 4 files changed, 48 insertions(+), 308 deletions(-) delete mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch (limited to 'meta-openbmc-mods/meta-common/recipes-network/network') 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 2cfa380ef..f21283a75 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 29c6b0a294e2c32c9617d243d71d202e926262d0 Mon Sep 17 00:00:00 2001 +From 145778897e36f407773844b3b96847ff10306ee8 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Thu, 2 Apr 2020 17:06:07 +0530 Subject: [PATCH] Adding channel specific privilege to network @@ -18,18 +18,19 @@ Change-Id: I3b592a19363eef684e31d5f7c34dad8f2f9211df Signed-off-by: AppaRao Puli Signed-off-by: Yong Li Signed-off-by: Johnathan Mantey +Signed-off-by: Ramya Narayana --- src/ethernet_interface.cpp | 124 +++++++++++++++++++++++++++++++++++++ - src/ethernet_interface.hpp | 36 ++++++++++- + src/ethernet_interface.hpp | 37 ++++++++++- src/network_manager.cpp | 102 ++++++++++++++++++++++++++++++ src/network_manager.hpp | 9 +++ - 4 files changed, 270 insertions(+), 1 deletion(-) + 4 files changed, 271 insertions(+), 1 deletion(-) diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp -index 5ce4349..4c52fc8 100644 +index 2e15803..1145773 100644 --- a/src/ethernet_interface.cpp +++ b/src/ethernet_interface.cpp -@@ -49,6 +49,10 @@ constexpr auto PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"; +@@ -48,6 +48,10 @@ constexpr auto PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"; constexpr auto RESOLVED_SERVICE_PATH = "/org/freedesktop/resolve1/link/"; constexpr auto METHOD_GET = "Get"; @@ -40,7 +41,7 @@ index 5ce4349..4c52fc8 100644 struct EthernetIntfSocket { EthernetIntfSocket(int domain, int type, int protocol) -@@ -133,6 +137,7 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, +@@ -132,6 +136,7 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, EthernetInterfaceIntf::autoNeg(std::get<2>(ifInfo)); EthernetInterfaceIntf::speed(std::get<0>(ifInfo)); #endif @@ -48,8 +49,8 @@ index 5ce4349..4c52fc8 100644 // Emit deferred signal. if (emitSignal) -@@ -1248,5 +1253,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) - manager.writeToConfigurationFile(); +@@ -1322,5 +1327,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) + return gw; } + @@ -174,7 +175,7 @@ index 5ce4349..4c52fc8 100644 } // namespace network } // namespace phosphor diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp -index 12d307f..d764b2b 100644 +index 0fe3778..fa5c889 100644 --- a/src/ethernet_interface.hpp +++ b/src/ethernet_interface.hpp @@ -2,11 +2,14 @@ @@ -190,9 +191,9 @@ index 12d307f..d764b2b 100644 #include +#include #include - #include #include -@@ -35,7 +38,8 @@ using Ifaces = sdbusplus::server::object::object< + #include +@@ -23,7 +26,8 @@ using Ifaces = sdbusplus::server::object::object< sdbusplus::xyz::openbmc_project::Network::server::MACAddress, sdbusplus::xyz::openbmc_project::Network::IP::server::Create, sdbusplus::xyz::openbmc_project::Network::Neighbor::server::CreateStatic, @@ -202,7 +203,7 @@ index 12d307f..d764b2b 100644 using IP = sdbusplus::xyz::openbmc_project::Network::server::IP; -@@ -43,11 +47,14 @@ using EthernetInterfaceIntf = +@@ -31,11 +35,14 @@ using EthernetInterfaceIntf = sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface; using MacAddressIntf = sdbusplus::xyz::openbmc_project::Network::server::MACAddress; @@ -217,7 +218,7 @@ index 12d307f..d764b2b 100644 class Manager; // forward declaration of network manager. -@@ -247,6 +254,14 @@ class EthernetInterface : public Ifaces +@@ -240,6 +247,14 @@ class EthernetInterface : public Ifaces std::string defaultGateway6(std::string gateway) override; using EthernetInterfaceIntf::dhcpEnabled; @@ -231,11 +232,12 @@ index 12d307f..d764b2b 100644 + using ChannelAccessIntf::maxPrivilege; using EthernetInterfaceIntf::interfaceName; using EthernetInterfaceIntf::linkUp; - using EthernetInterfaceIntf::nicEnabled; -@@ -374,6 +389,25 @@ class EthernetInterface : public Ifaces + using EthernetInterfaceIntf::mtu; +@@ -372,6 +387,26 @@ class EthernetInterface : public Ifaces * @returns true/false value if the NIC is enabled */ bool queryNicEnabled() const; ++ + /** @brief gets the channel privilege. + * @param[in] interfaceName - Network interface name. + * @returns privilege of the interface @@ -259,10 +261,10 @@ index 12d307f..d764b2b 100644 } // namespace network diff --git a/src/network_manager.cpp b/src/network_manager.cpp -index 9ae9c5b..2f5097a 100644 +index fe59f0b..01a99a3 100644 --- a/src/network_manager.cpp +++ b/src/network_manager.cpp -@@ -36,6 +36,13 @@ extern std::unique_ptr restartTimer; +@@ -39,6 +39,13 @@ extern std::unique_ptr refreshObjectTimer; using namespace phosphor::logging; using namespace sdbusplus::xyz::openbmc_project::Common::Error; @@ -276,7 +278,7 @@ index 9ae9c5b..2f5097a 100644 Manager::Manager(sdbusplus::bus::bus& bus, const char* objPath, const std::string& path) : details::VLANCreateIface(bus, objPath, true), -@@ -43,6 +50,101 @@ Manager::Manager(sdbusplus::bus::bus& bus, const char* objPath, +@@ -46,6 +53,101 @@ Manager::Manager(sdbusplus::bus::bus& bus, const char* objPath, { fs::path confDir(path); setConfDir(confDir); @@ -379,11 +381,11 @@ index 9ae9c5b..2f5097a 100644 bool Manager::createDefaultNetworkFiles(bool force) diff --git a/src/network_manager.hpp b/src/network_manager.hpp -index 227955c..9f5b7a9 100644 +index fb3cc32..0c3d49b 100644 --- a/src/network_manager.hpp +++ b/src/network_manager.hpp -@@ -155,6 +155,12 @@ class Manager : public details::VLANCreateIface - return (interfaces.find(intf) != interfaces.end()); +@@ -156,6 +156,12 @@ class Manager : public details::VLANCreateIface + return routeTable; } + /** supported privilege list **/ @@ -395,10 +397,10 @@ index 227955c..9f5b7a9 100644 protected: /** @brief Persistent sdbusplus DBus bus connection. */ sdbusplus::bus::bus& bus; -@@ -177,6 +183,9 @@ class Manager : public details::VLANCreateIface +@@ -181,6 +187,9 @@ class Manager : public details::VLANCreateIface - /** @brief Network Configuration directory. */ - fs::path confDir; + /** @brief The routing table */ + route::Table routeTable; + + /** Get the user management service name dynamically **/ + std::string getUserServiceName(); @@ -406,5 +408,5 @@ index 227955c..9f5b7a9 100644 } // namespace network -- -2.17.1 +2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch index fe7c45532..90bbc1d5b 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch @@ -1,4 +1,4 @@ -From f6240a81c0ed87c128d454fa9c4023b9062efe5e Mon Sep 17 00:00:00 2001 +From cbd034daf844529eb7f098c990dc8f44c12f6b97 Mon Sep 17 00:00:00 2001 From: sunitakx Date: Tue, 13 Jul 2021 12:54:01 +0000 Subject: [PATCH] Fix for updating MAC address from RedFish @@ -25,16 +25,17 @@ Body: Response code: {"200 OK"} received. Signed-off-by: sunitakx +Signed-off-by: Ramya Narayana --- - src/ethernet_interface.cpp | 19 +++++++++++++------ + src/ethernet_interface.cpp | 17 ++++++++++++----- src/ethernet_interface.hpp | 5 +++++ - 2 files changed, 18 insertions(+), 6 deletions(-) + 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp -index 666173e6587e..95bc8db9cd3a 100644 +index 1145773..129905e 100644 --- a/src/ethernet_interface.cpp +++ b/src/ethernet_interface.cpp -@@ -144,6 +144,8 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, +@@ -143,6 +143,8 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, { this->emit_object_added(); } @@ -43,18 +44,17 @@ index 666173e6587e..95bc8db9cd3a 100644 } static IP::Protocol convertFamily(int family) -@@ -1129,8 +1131,18 @@ void EthernetInterface::writeDHCPSection(std::fstream& stream) +@@ -1209,8 +1211,17 @@ void EthernetInterface::writeDHCPSection(std::fstream& stream) } } +void EthernetInterface::macAddressTimeoutHandler() +{ + macUpdateTimer->stop(); -+ // TODO: would remove the call below and -+ // just restart systemd-netwokd -+ // through https://github.com/systemd/systemd/issues/6696 -+ execute("/sbin/ip", "ip", "link", "set", "dev", interfaceName().c_str(), -+ "down"); ++ // The MAC and LLADDRs will only update if the NIC is already down ++ EthernetIntfSocket eifSocket(PF_INET, SOCK_DGRAM, IPPROTO_IP); ++ setNICAdminState(eifSocket.sock, interfaceName().c_str(), false); ++ manager.reloadConfigs(); +} std::string EthernetInterface::macAddress(std::string value) { @@ -62,22 +62,22 @@ index 666173e6587e..95bc8db9cd3a 100644 ether_addr newMAC; try { -@@ -1164,12 +1176,7 @@ std::string EthernetInterface::macAddress(std::string value) +@@ -1244,12 +1255,8 @@ std::string EthernetInterface::macAddress(std::string value) intf->MacAddressIntf::macAddress(validMAC); } MacAddressIntf::macAddress(validMAC); - -- // TODO: would remove the call below and -- // just restart systemd-netwokd -- // through https://github.com/systemd/systemd/issues/6696 -- execute("/sbin/ip", "ip", "link", "set", "dev", interface.c_str(), -- "down"); + macUpdateTimer->start(usec); - manager.writeToConfigurationFile(); + writeConfigurationFile(); +- // The MAC and LLADDRs will only update if the NIC is already down +- EthernetIntfSocket eifSocket(PF_INET, SOCK_DGRAM, IPPROTO_IP); +- setNICAdminState(eifSocket.sock, interface.c_str(), false); +- manager.reloadConfigs(); } + #ifdef HAVE_UBOOT_ENV diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp -index 6c7bd69ef987..acf6b6792b75 100644 +index fa5c889..70f4756 100644 --- a/src/ethernet_interface.hpp +++ b/src/ethernet_interface.hpp @@ -11,11 +11,14 @@ @@ -95,7 +95,7 @@ index 6c7bd69ef987..acf6b6792b75 100644 namespace phosphor { namespace network -@@ -83,6 +86,8 @@ class EthernetInterface : public Ifaces +@@ -84,6 +87,8 @@ class EthernetInterface : public Ifaces EthernetInterface& operator=(EthernetInterface&&) = delete; virtual ~EthernetInterface() = default; diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch deleted file mode 100644 index 255ae4836..000000000 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch +++ /dev/null @@ -1,261 +0,0 @@ -From f898e4512e7907ba185a1178ad36cb7af6ad0811 Mon Sep 17 00:00:00 2001 -From: sureshv1 -Date: Tue, 10 Aug 2021 16:38:42 +0530 -Subject: [PATCH] Added Debug logs to isolate coredump of RTNETLink Packet - Processing Clang Format updated - -Tested: -Flashed the BMC firmware image with logs included and observed that -the logs are logged during the boot up time and not flooding serial -console.After the BMC is booted up, logs were logged in when ever a -RT Net Link Packet is received and not flooding the journalctl logs. - -Change-Id: I5e1d152b18df17e5351c498210dae5c45f551f7b -Signed-off-by: sureshv1 ---- - src/network_manager.cpp | 15 ++++++++ - src/network_manager_main.cpp | 12 +++++++ - src/rtnetlink_server.cpp | 70 ++++++++++++++++++++++++++++++++++++ - 3 files changed, 97 insertions(+) - -diff --git a/src/network_manager.cpp b/src/network_manager.cpp -index 2f5097a..ec48f2a 100644 ---- a/src/network_manager.cpp -+++ b/src/network_manager.cpp -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -26,6 +27,8 @@ constexpr char SYSTEMD_PATH[] = "/org/freedesktop/systemd1"; - constexpr char SYSTEMD_INTERFACE[] = "org.freedesktop.systemd1.Manager"; - constexpr auto FirstBootFile = "/var/lib/network/firstBoot_"; - -+constexpr bool debug = true; -+ - namespace phosphor - { - namespace network -@@ -273,6 +276,12 @@ void Manager::createInterfaces() - - void Manager::createChildObjects() - { -+ if (debug) -+ { -+ std::cout -+ << "Create Child Objects called(restart system conf and DHCP conf)" -+ << "\n"; -+ } - // creates the ethernet interface dbus object. - createInterfaces(); - -@@ -289,6 +298,12 @@ void Manager::createChildObjects() - objPath /= "dhcp"; - dhcpConf = std::make_unique( - bus, objPath.string(), *this); -+ -+ if (debug) -+ { -+ std::cout << "Create Child Objects Exiting" -+ << "\n"; -+ } - } - - ObjectPath Manager::vlan(IntfName interfaceName, uint32_t id) -diff --git a/src/network_manager_main.cpp b/src/network_manager_main.cpp -index 983616f..c9bdb15 100644 ---- a/src/network_manager_main.cpp -+++ b/src/network_manager_main.cpp -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - #include - #ifdef SYNC_MAC_FROM_INVENTORY - #include -@@ -41,6 +42,8 @@ constexpr auto configFile = "/usr/share/network/config.json"; - constexpr auto invNetworkIntf = - "xyz.openbmc_project.Inventory.Item.NetworkInterface"; - -+constexpr bool debug = true; -+ - namespace phosphor - { - namespace network -@@ -255,10 +258,19 @@ void restartNetwork() - - void initializeTimers() - { -+ if (debug) -+ std::cout -+ << "Initialize Timer for Refresh Object Timer and Restart Timer" -+ << "\n"; -+ - auto event = sdeventplus::Event::get_default(); - refreshObjectTimer = - std::make_unique(event, std::bind(refreshObjects)); - restartTimer = std::make_unique(event, std::bind(restartNetwork)); -+ -+ if (debug) -+ std::cout << "Initialize Timer Exiting" -+ << "\n"; - } - - } // namespace network -diff --git a/src/rtnetlink_server.cpp b/src/rtnetlink_server.cpp -index 07ca08c..74f08b3 100644 ---- a/src/rtnetlink_server.cpp -+++ b/src/rtnetlink_server.cpp -@@ -11,12 +11,15 @@ - #include - #include - -+#include - #include - #include - #include - #include - #include - -+constexpr bool debug = true; -+ - namespace phosphor - { - namespace network -@@ -29,6 +32,9 @@ namespace rtnetlink - - static bool shouldRefresh(const struct nlmsghdr& hdr, std::string_view data) - { -+ if (debug) -+ std::cout << "Should Refresh the Received Header with Data" -+ << "\n"; - switch (hdr.nlmsg_type) - { - case RTM_NEWADDR: -@@ -36,22 +42,43 @@ static bool shouldRefresh(const struct nlmsghdr& hdr, std::string_view data) - case RTM_NEWROUTE: - case RTM_DELROUTE: - { -+ if (debug) -+ std::cout << "Don't Copy Data as the Message Type is:" -+ << hdr.nlmsg_type << "\n"; - return true; - } - case RTM_NEWNEIGH: - case RTM_DELNEIGH: - { -+ if (debug) -+ std::cout << "Message Type is" << hdr.nlmsg_type << "\n"; - struct ndmsg ndm; - if (data.size() < sizeof(ndm)) - { -+ if (debug) -+ std::cout << "Data Size:" << data.size() -+ << " NDM Size:" << sizeof(ndm) << "\n"; - return false; - } -+ if (debug) -+ std::cout -+ << "Processing/Copying the received Data for MLMSG_TYPE:" -+ << hdr.nlmsg_type << " Data Size:" << data.size() << "\n"; - memcpy(&ndm, data.data(), sizeof(ndm)); -+ if (debug) -+ std::cout << "Copied the received Data for MLMSG_TYPE:" -+ << hdr.nlmsg_type -+ << " and NDM Message Size is:" << sizeof(ndm) << "\n"; - // We only want to refresh for static neighbors - return ndm.ndm_state & NUD_PERMANENT; - } - } - -+ if (debug) -+ std::cout << "Should Refresh Object is verified and done without any " -+ "known header type" -+ << "\n"; -+ - return false; - } - -@@ -62,25 +89,58 @@ static int eventHandler(sd_event_source* /*es*/, int fd, uint32_t /*revents*/, - char buffer[phosphor::network::rtnetlink::BUFSIZE]{}; - int len{}; - -+ if (debug) -+ std::cout << "\n" -+ << "RTNETLINK event Handler is called to read the RTNETLINK " -+ "Packet and Refresh it for a buffer size:" -+ << phosphor::network::rtnetlink::BUFSIZE << "\n"; - auto netLinkHeader = reinterpret_cast(buffer); - while ((len = recv(fd, netLinkHeader, phosphor::network::rtnetlink::BUFSIZE, - 0)) > 0) - { -+ if (debug) -+ { -+ std::cout << "Received the Packet with a Length:" << len << "\n"; -+ } - for (; (NLMSG_OK(netLinkHeader, len)) && - (netLinkHeader->nlmsg_type != NLMSG_DONE); - netLinkHeader = NLMSG_NEXT(netLinkHeader, len)) - { -+ if (debug) -+ std::cout << "NetLinkHeader Message Type is:" -+ << netLinkHeader->nlmsg_type -+ << " with total length(len):" << len -+ << " and block data packet " -+ "length(netLinkHeader->nlmsg_len - NLMSG_HDRLEN):" -+ << netLinkHeader->nlmsg_len - NLMSG_HDRLEN -+ << " and Message Length(netLinkHeader->nlmsg_len):" -+ << netLinkHeader->nlmsg_len << "\n"; - std::string_view data( - reinterpret_cast(NLMSG_DATA(netLinkHeader)), - netLinkHeader->nlmsg_len - NLMSG_HDRLEN); -+ if (debug) -+ { -+ if (netLinkHeader) -+ std::cout << "NetLinkHeader is valid" -+ << "\n"; -+ } - if (shouldRefresh(*netLinkHeader, data)) - { - // starting the timer here to make sure that we don't want - // create the child objects multiple times. -+ if (debug) -+ std::cout << "Check Refresh Object Timer is enabled?" -+ << "\n"; - if (!refreshObjectTimer->isEnabled()) - { - // if start timer throws exception then let the application - // crash -+ if (debug) -+ std::cout -+ << "Call Restart Once with a Timeout seconds:" -+ << std::chrono::seconds(refreshTimeout).count() -+ << "\n"; -+ - refreshObjectTimer->restartOnce(refreshTimeout); - } // end if - } // end if -@@ -89,6 +149,16 @@ static int eventHandler(sd_event_source* /*es*/, int fd, uint32_t /*revents*/, - - } // end while - -+ if (debug) -+ { -+ std::cout << "RTNETLINK Event Handler completed read of packets and " -+ "processed it" -+ << " with an length(exit):" << len << "\n"; -+ -+ if (errno) -+ std::cout << "Error Number:" << errno << "\n"; -+ } -+ - return 0; - } - --- -2.17.1 - 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 63746d8be..4828c9ea0 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,11 +3,10 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" DEPENDS += "nlohmann-json boost" SRC_URI = "git://github.com/openbmc/phosphor-networkd" -SRCREV = "2c0fc568057c5575a75ad638ea91bc8c65b57160" +SRCREV = "ee2cba8a7d22ef4a251181087e9ef9bfc5c4b165" SRC_URI += " file://0003-Adding-channel-specific-privilege-to-network.patch \ file://0004-Fix-for-updating-MAC-address-from-RedFish.patch \ - file://0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch \ " EXTRA_OECONF:append = " --enable-nic-ethtool=yes" -- cgit v1.2.3