From 18f97faa411078b95d042d207f5fff32bc8ece1d Mon Sep 17 00:00:00 2001 From: P Dheeraj Srujan Kumar Date: Thu, 31 Mar 2022 02:50:48 +0530 Subject: Update to internal 1-0.91 Signed-off-by: P Dheeraj Srujan Kumar --- .../recipes-network/network/ncsi-monitor.bb | 2 + .../network/ncsi-monitor/check-for-host-in-reset | 14 ++- ...ing-channel-specific-privilege-to-network.patch | 36 ++++--- ...Fix-for-updating-MAC-address-from-RedFish.patch | 109 --------------------- .../network/phosphor-network_%.bbappend | 3 +- .../recipes-network/network/static-mac-addr.bb | 4 +- .../network/static-mac-addr/mac-check | 27 ++++- 7 files changed, 59 insertions(+), 136 deletions(-) delete mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch (limited to 'meta-openbmc-mods/meta-common/recipes-network') 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 index cdb8e2097..4219a8e42 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb +++ b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb @@ -14,6 +14,8 @@ SRC_URI = "\ file://${BPN}.service \ " +RDEPENDS:${PN} += "bash" + inherit obmc-phosphor-systemd SYSTEMD_SERVICE:${PN} += "${BPN}.service" 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 index aa17aebf2..be01092a2 100755 --- 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 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # PFR Boot Time Detection # @@ -51,14 +51,20 @@ 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")) + local gpioFound=$($GPIOFIND $RSMRST) + # Test to see if the RSMRST_N input exists. This test does not cover the + # case where an input is already owned by another service/process. + if [ -z "$gpioFound" ] + then + return 1 + fi + local gpio_state=$($GPIOGET $gpioFound) eval $__resultVal="'$gpio_state'" return 0 } get_rsmrst_state rsmrst_val - -if [ "$rsmrst_val" -eq 0 ] +if [[ $? == 0 && $rsmrst_val -eq 0 ]] then echo "RSMRST_N is asserted, take eth1 down" ip link set down dev eth1 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 f21283a75..153480728 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 145778897e36f407773844b3b96847ff10306ee8 Mon Sep 17 00:00:00 2001 +From eacd73a119e55599d1f8837d04b4fa40452e5653 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 @@ -23,11 +23,11 @@ Signed-off-by: Ramya Narayana src/ethernet_interface.cpp | 124 +++++++++++++++++++++++++++++++++++++ src/ethernet_interface.hpp | 37 ++++++++++- src/network_manager.cpp | 102 ++++++++++++++++++++++++++++++ - src/network_manager.hpp | 9 +++ - 4 files changed, 271 insertions(+), 1 deletion(-) + src/network_manager.hpp | 7 +++ + 4 files changed, 269 insertions(+), 1 deletion(-) diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp -index 2e15803..1145773 100644 +index 44f46f6..61eb8de 100644 --- a/src/ethernet_interface.cpp +++ b/src/ethernet_interface.cpp @@ -48,6 +48,10 @@ constexpr auto PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"; @@ -49,7 +49,7 @@ index 2e15803..1145773 100644 // Emit deferred signal. if (emitSignal) -@@ -1322,5 +1327,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) +@@ -1319,5 +1324,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) return gw; } @@ -175,7 +175,7 @@ index 2e15803..1145773 100644 } // namespace network } // namespace phosphor diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp -index 0fe3778..fa5c889 100644 +index 8928455..0f54814 100644 --- a/src/ethernet_interface.hpp +++ b/src/ethernet_interface.hpp @@ -2,11 +2,14 @@ @@ -233,7 +233,7 @@ index 0fe3778..fa5c889 100644 using EthernetInterfaceIntf::interfaceName; using EthernetInterfaceIntf::linkUp; using EthernetInterfaceIntf::mtu; -@@ -372,6 +387,26 @@ class EthernetInterface : public Ifaces +@@ -363,6 +378,26 @@ class EthernetInterface : public Ifaces * @returns true/false value if the NIC is enabled */ bool queryNicEnabled() const; @@ -261,10 +261,10 @@ index 0fe3778..fa5c889 100644 } // namespace network diff --git a/src/network_manager.cpp b/src/network_manager.cpp -index fe59f0b..01a99a3 100644 +index 19e4673..1c8bf3b 100644 --- a/src/network_manager.cpp +++ b/src/network_manager.cpp -@@ -39,6 +39,13 @@ extern std::unique_ptr refreshObjectTimer; +@@ -39,6 +39,13 @@ extern std::unique_ptr reloadTimer; using namespace phosphor::logging; using namespace sdbusplus::xyz::openbmc_project::Common::Error; @@ -381,27 +381,25 @@ index fe59f0b..01a99a3 100644 bool Manager::createDefaultNetworkFiles(bool force) diff --git a/src/network_manager.hpp b/src/network_manager.hpp -index fb3cc32..0c3d49b 100644 +index f574891..49f1cfa 100644 --- a/src/network_manager.hpp +++ b/src/network_manager.hpp -@@ -156,6 +156,12 @@ class Manager : public details::VLANCreateIface - return routeTable; +@@ -170,6 +170,11 @@ class Manager : public details::VLANCreateIface + { + reloadPreHooks.push_back(std::move(hook)); } - + /** supported privilege list **/ + std::vector supportedPrivList; + + /** @brief initializes the supportedPrivilege List */ + void initSupportedPrivilges(); -+ + protected: /** @brief Persistent sdbusplus DBus bus connection. */ - sdbusplus::bus::bus& bus; -@@ -181,6 +187,9 @@ class Manager : public details::VLANCreateIface +@@ -199,6 +204,8 @@ class Manager : public details::VLANCreateIface - /** @brief The routing table */ - route::Table routeTable; -+ + /** @brief List of hooks to execute during the next reload */ + std::vector> reloadPreHooks; + /** Get the user management service name dynamically **/ + std::string getUserServiceName(); }; 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 deleted file mode 100644 index 90bbc1d5b..000000000 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch +++ /dev/null @@ -1,109 +0,0 @@ -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 - -Issue: When IP address source for an interface is DHCP and its MAC -address is patched using RedFish, response code is not reaching the -RedFish request initiator (client). - -RootCause: After bmcweb patches the MAC address, immediately IP address -of that interface also changes to new value (because of DHCP). -Due to this, success response from bmcweb is not reaching the client as -expected. - -Fix: Do MAC-ADDR patching after validating the request and responding -"200 OK" to RedFish client. i.e Start a timer which will modify the -MAC-ADDR at the end of its expiry. - -Tested: -Update the MAC address from RedFish. -PATCH: https:///redfish/v1/Managers/bmc/EthernetInterfaces/eth0 -Body: - {"MACAddress": "xx:xx:xx:xx:xx:xx"} - -Response code: {"200 OK"} received. - -Signed-off-by: sunitakx -Signed-off-by: Ramya Narayana ---- - src/ethernet_interface.cpp | 17 ++++++++++++----- - src/ethernet_interface.hpp | 5 +++++ - 2 files changed, 17 insertions(+), 5 deletions(-) - -diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp -index 1145773..129905e 100644 ---- a/src/ethernet_interface.cpp -+++ b/src/ethernet_interface.cpp -@@ -143,6 +143,8 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, - { - this->emit_object_added(); - } -+ macUpdateTimer = std::make_unique( -+ [this](void) { macAddressTimeoutHandler(); }); - } - - static IP::Protocol convertFamily(int family) -@@ -1209,8 +1211,17 @@ void EthernetInterface::writeDHCPSection(std::fstream& stream) - } - } - -+void EthernetInterface::macAddressTimeoutHandler() -+{ -+ macUpdateTimer->stop(); -+ // 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) - { -+ std::chrono::seconds usec(defaultTimeout); - ether_addr newMAC; - try - { -@@ -1244,12 +1255,8 @@ std::string EthernetInterface::macAddress(std::string value) - intf->MacAddressIntf::macAddress(validMAC); - } - MacAddressIntf::macAddress(validMAC); -- -+ macUpdateTimer->start(usec); - 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 fa5c889..70f4756 100644 ---- a/src/ethernet_interface.hpp -+++ b/src/ethernet_interface.hpp -@@ -11,11 +11,14 @@ - #include - #include - #include -+#include - #include - #include - #include - #include - -+static constexpr const uint32_t defaultTimeout = 1; -+ - namespace phosphor - { - namespace network -@@ -84,6 +87,8 @@ class EthernetInterface : public Ifaces - EthernetInterface& operator=(EthernetInterface&&) = delete; - virtual ~EthernetInterface() = default; - -+ std::unique_ptr macUpdateTimer; -+ void macAddressTimeoutHandler(); - /** @brief Constructor to put object onto bus at a dbus path. - * @param[in] bus - Bus to attach to. - * @param[in] objPath - Path to attach at. --- -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 4828c9ea0..a6cc6f510 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,9 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" DEPENDS += "nlohmann-json boost" SRC_URI = "git://github.com/openbmc/phosphor-networkd" -SRCREV = "ee2cba8a7d22ef4a251181087e9ef9bfc5c4b165" +SRCREV = "cc5a670f1650e76b66750365bd4beecf821969fa" SRC_URI += " file://0003-Adding-channel-specific-privilege-to-network.patch \ - file://0004-Fix-for-updating-MAC-address-from-RedFish.patch \ " EXTRA_OECONF:append = " --enable-nic-ethtool=yes" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb index ee55c5407..c32e14b6f 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb @@ -4,6 +4,8 @@ DESCRIPTION = "Set a priority on MAC addresses to run with: \ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +RDEPENDS:${PN} += "bash" + PV = "1.0" LICENSE = "Apache-2.0" @@ -11,7 +13,7 @@ LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fe SRC_URI = "\ file://mac-check \ - file://${PN}.service \ + file://${BPN}.service \ " inherit obmc-phosphor-systemd diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check index 39d7dd8a7..429f9264b 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright 2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -158,4 +158,29 @@ done <<-END_CONF eth0 eth1addr eth1 ethaddr END_CONF + +### HOSTNAME FEATURE ### +if [[ $* == *--no-unique-hostname* ]]; then + echo "mac-check: Skipping hostname check" +else + # Read MAC and strip colon chars + hw_mac=$(cat /sys/class/net/eth0/address | tr -d ":") + # Read Hostname + hostname=$(hostname) + #Match bmc-mac (a MAC address has 12 hex digits) + bmc_mac_format="^bmc-mac[a-f0-9]{12}$" + #Match bmc-mac + inteldefault="bmc-mac$hw_mac" + #if the current hostname already has the current MAC address, we won't rewrite the name unnecessarily. + #Otherwise, match intel-obmc or bmc-mac, and change the hostname to use the current MAC address + if [[ "$hostname" == "intel-obmc" || \ + ("$hostname" != "$inteldefault" && \ + "$hostname" =~ $bmc_mac_format) ]]; then + hostnamectl set-hostname "$inteldefault" + echo "mac-check: HOSTNAME CHANGED (hostname deemed to be default or wrong MAC Address)" + else + echo "mac-check: HOSTNAME NOT CHANGED (hostname is already correct or is custom)" + fi +fi + exit $first_error_seen -- cgit v1.2.3