Ratan Gupta | a54d8f8 | 2017-09-08 17:05:46 +0530 | [diff] [blame] | 1 | #include "config.h" |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 2 | |
Ratan Gupta | 0f9dc1b | 2017-09-03 17:57:50 +0530 | [diff] [blame] | 3 | #include "network_manager.hpp" |
| 4 | #include "rtnetlink_server.hpp" |
William A. Kennington III | 3a70fa2 | 2018-09-20 18:48:20 -0700 | [diff] [blame] | 5 | #include "types.hpp" |
William A. Kennington III | 95530ec | 2022-08-19 01:44:39 -0700 | [diff] [blame] | 6 | #ifdef SYNC_MAC_FROM_INVENTORY |
| 7 | #include "util.hpp" |
| 8 | #endif |
Ratan Gupta | 0f9dc1b | 2017-09-03 17:57:50 +0530 | [diff] [blame] | 9 | |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 10 | #include <fmt/format.h> |
Ratan Gupta | f665738 | 2017-11-10 17:58:17 +0530 | [diff] [blame] | 11 | #include <linux/netlink.h> |
Ratan Gupta | 0f9dc1b | 2017-09-03 17:57:50 +0530 | [diff] [blame] | 12 | |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 13 | #include <filesystem> |
| 14 | #include <fstream> |
William A. Kennington III | 3a70fa2 | 2018-09-20 18:48:20 -0700 | [diff] [blame] | 15 | #include <functional> |
Ratan Gupta | f665738 | 2017-11-10 17:58:17 +0530 | [diff] [blame] | 16 | #include <memory> |
William A. Kennington III | de433b7 | 2021-05-17 22:59:28 -0700 | [diff] [blame] | 17 | #ifdef SYNC_MAC_FROM_INVENTORY |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 18 | #include <nlohmann/json.hpp> |
William A. Kennington III | de433b7 | 2021-05-17 22:59:28 -0700 | [diff] [blame] | 19 | #endif |
Ratan Gupta | f665738 | 2017-11-10 17:58:17 +0530 | [diff] [blame] | 20 | #include <phosphor-logging/elog-errors.hpp> |
Ratan Gupta | 0f9dc1b | 2017-09-03 17:57:50 +0530 | [diff] [blame] | 21 | #include <phosphor-logging/log.hpp> |
Ratan Gupta | cb7098d | 2017-04-14 17:46:05 +0530 | [diff] [blame] | 22 | #include <sdbusplus/bus.hpp> |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 23 | #include <sdbusplus/bus/match.hpp> |
Ratan Gupta | cb7098d | 2017-04-14 17:46:05 +0530 | [diff] [blame] | 24 | #include <sdbusplus/server/manager.hpp> |
William A. Kennington III | 3a70fa2 | 2018-09-20 18:48:20 -0700 | [diff] [blame] | 25 | #include <sdeventplus/event.hpp> |
William A. Kennington III | 217bb3f | 2022-09-29 13:43:13 -0700 | [diff] [blame] | 26 | #include <sdeventplus/source/signal.hpp> |
| 27 | #include <stdplus/signal.hpp> |
Ratan Gupta | f665738 | 2017-11-10 17:58:17 +0530 | [diff] [blame] | 28 | #include <xyz/openbmc_project/Common/error.hpp> |
Ratan Gupta | 0f9dc1b | 2017-09-03 17:57:50 +0530 | [diff] [blame] | 29 | |
William A. Kennington III | 09095f8 | 2018-09-27 12:05:12 -0700 | [diff] [blame] | 30 | using phosphor::logging::elog; |
| 31 | using phosphor::logging::entry; |
| 32 | using phosphor::logging::level; |
| 33 | using phosphor::logging::log; |
| 34 | using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 35 | using DbusObjectPath = std::string; |
| 36 | using DbusInterface = std::string; |
| 37 | using PropertyValue = std::string; |
William A. Kennington III | 09095f8 | 2018-09-27 12:05:12 -0700 | [diff] [blame] | 38 | |
William A. Kennington III | 483e777 | 2019-02-12 19:03:15 -0800 | [diff] [blame] | 39 | constexpr char NETWORK_CONF_DIR[] = "/etc/systemd/network"; |
| 40 | |
William A. Kennington III | 5f1eb46 | 2019-02-12 19:47:51 -0800 | [diff] [blame] | 41 | constexpr char DEFAULT_OBJPATH[] = "/xyz/openbmc_project/network"; |
| 42 | |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 43 | constexpr auto firstBootPath = "/var/lib/network/firstBoot_"; |
| 44 | constexpr auto configFile = "/usr/share/network/config.json"; |
| 45 | |
| 46 | constexpr auto invNetworkIntf = |
| 47 | "xyz.openbmc_project.Inventory.Item.NetworkInterface"; |
| 48 | |
Ratan Gupta | 0f9dc1b | 2017-09-03 17:57:50 +0530 | [diff] [blame] | 49 | namespace phosphor |
| 50 | { |
| 51 | namespace network |
| 52 | { |
| 53 | |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 54 | std::unique_ptr<Manager> manager = nullptr; |
William A. Kennington III | 3a70fa2 | 2018-09-20 18:48:20 -0700 | [diff] [blame] | 55 | std::unique_ptr<Timer> refreshObjectTimer = nullptr; |
William A. Kennington III | c7cf25f | 2021-11-09 16:16:59 -0800 | [diff] [blame] | 56 | std::unique_ptr<Timer> reloadTimer = nullptr; |
Ratan Gupta | a54d8f8 | 2017-09-08 17:05:46 +0530 | [diff] [blame] | 57 | |
William A. Kennington III | 6f39c5e | 2021-05-13 18:39:23 -0700 | [diff] [blame] | 58 | #ifdef SYNC_MAC_FROM_INVENTORY |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 59 | std::unique_ptr<sdbusplus::bus::match_t> EthInterfaceMatch = nullptr; |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 60 | std::vector<std::string> first_boot_status; |
| 61 | |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 62 | bool setInventoryMACOnSystem(sdbusplus::bus_t& bus, |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 63 | const nlohmann::json& configJson, |
| 64 | const std::string& intfname) |
| 65 | { |
| 66 | try |
| 67 | { |
| 68 | auto inventoryMAC = mac_address::getfromInventory(bus, intfname); |
William A. Kennington III | bb0eacc | 2022-10-21 15:22:06 -0700 | [diff] [blame] | 69 | if (inventoryMAC != ether_addr{}) |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 70 | { |
William A. Kennington III | bb0eacc | 2022-10-21 15:22:06 -0700 | [diff] [blame] | 71 | auto macStr = std::to_string(inventoryMAC); |
| 72 | log<level::INFO>("Mac Address in Inventory on ", |
| 73 | entry("Interface : ", intfname.c_str()), |
| 74 | entry("MAC Address :", macStr.c_str())); |
| 75 | manager->setFistBootMACOnInterface( |
| 76 | std::make_pair(intfname.c_str(), std::move(macStr))); |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 77 | first_boot_status.push_back(intfname.c_str()); |
| 78 | bool status = true; |
| 79 | for (const auto& keys : configJson.items()) |
| 80 | { |
| 81 | if (!(std::find(first_boot_status.begin(), |
| 82 | first_boot_status.end(), |
| 83 | keys.key()) != first_boot_status.end())) |
| 84 | { |
| 85 | log<level::INFO>("Interface MAC is NOT set from VPD"), |
| 86 | entry("INTERFACE", keys.key().c_str()); |
| 87 | status = false; |
| 88 | } |
| 89 | } |
| 90 | if (status) |
| 91 | { |
| 92 | log<level::INFO>("Removing the match for ethernet interfaces"); |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 93 | EthInterfaceMatch = nullptr; |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 94 | } |
| 95 | } |
| 96 | else |
| 97 | { |
| 98 | log<level::INFO>("Nothing is present in Inventory"); |
| 99 | return false; |
| 100 | } |
| 101 | } |
| 102 | catch (const std::exception& e) |
| 103 | { |
| 104 | log<level::ERR>("Exception occurred during getting of MAC " |
| 105 | "address from Inventory"); |
| 106 | return false; |
| 107 | } |
| 108 | return true; |
| 109 | } |
| 110 | |
| 111 | // register the macthes to be monitored from inventory manager |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 112 | void registerSignals(sdbusplus::bus_t& bus, const nlohmann::json& configJson) |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 113 | { |
| 114 | log<level::INFO>("Registering the Inventory Signals Matcher"); |
| 115 | |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 116 | static std::unique_ptr<sdbusplus::bus::match_t> MacAddressMatch; |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 117 | |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 118 | auto callback = [&](sdbusplus::message_t& m) { |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 119 | std::map<DbusObjectPath, |
| 120 | std::map<DbusInterface, std::variant<PropertyValue>>> |
| 121 | interfacesProperties; |
| 122 | |
| 123 | sdbusplus::message::object_path objPath; |
| 124 | std::pair<std::string, std::string> ethPair; |
| 125 | m.read(objPath, interfacesProperties); |
| 126 | |
| 127 | for (const auto& pattern : configJson.items()) |
| 128 | { |
| 129 | if (objPath.str.find(pattern.value()) != std::string::npos) |
| 130 | { |
| 131 | for (auto& interface : interfacesProperties) |
| 132 | { |
| 133 | if (interface.first == invNetworkIntf) |
| 134 | { |
| 135 | for (const auto& property : interface.second) |
| 136 | { |
| 137 | if (property.first == "MACAddress") |
| 138 | { |
| 139 | ethPair = std::make_pair( |
| 140 | pattern.key(), |
| 141 | std::get<std::string>(property.second)); |
| 142 | break; |
| 143 | } |
| 144 | } |
| 145 | break; |
| 146 | } |
| 147 | } |
| 148 | if (!(ethPair.first.empty() || ethPair.second.empty())) |
| 149 | { |
| 150 | manager->setFistBootMACOnInterface(ethPair); |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | }; |
| 155 | |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 156 | MacAddressMatch = std::make_unique<sdbusplus::bus::match_t>( |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 157 | bus, |
| 158 | "interface='org.freedesktop.DBus.ObjectManager',type='signal'," |
| 159 | "member='InterfacesAdded',path='/xyz/openbmc_project/" |
| 160 | "inventory'", |
| 161 | callback); |
| 162 | } |
| 163 | |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 164 | void watchEthernetInterface(sdbusplus::bus_t& bus, |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 165 | const nlohmann::json& configJson) |
| 166 | { |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 167 | auto mycallback = [&](sdbusplus::message_t& m) { |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 168 | std::map<DbusObjectPath, |
| 169 | std::map<DbusInterface, std::variant<PropertyValue>>> |
| 170 | interfacesProperties; |
| 171 | |
| 172 | sdbusplus::message::object_path objPath; |
| 173 | std::pair<std::string, std::string> ethPair; |
| 174 | m.read(objPath, interfacesProperties); |
| 175 | for (const auto& interfaces : interfacesProperties) |
| 176 | { |
| 177 | if (interfaces.first == |
| 178 | "xyz.openbmc_project.Network.EthernetInterface") |
| 179 | { |
| 180 | for (const auto& property : interfaces.second) |
| 181 | { |
| 182 | if (property.first == "InterfaceName") |
| 183 | { |
| 184 | std::string infname = |
| 185 | std::get<std::string>(property.second); |
| 186 | |
| 187 | if (configJson.find(infname) == configJson.end()) |
| 188 | { |
| 189 | // ethernet interface not found in configJSON |
| 190 | // check if it is not sit0 interface, as it is |
| 191 | // expected. |
| 192 | if (infname != "sit0") |
| 193 | { |
| 194 | log<level::ERR>( |
| 195 | "Wrong Interface Name in Config Json"); |
| 196 | } |
| 197 | } |
| 198 | else |
| 199 | { |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 200 | if (!setInventoryMACOnSystem(bus, configJson, |
| 201 | infname)) |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 202 | { |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 203 | registerSignals(bus, configJson); |
| 204 | EthInterfaceMatch = nullptr; |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 205 | } |
| 206 | } |
| 207 | break; |
| 208 | } |
| 209 | } |
| 210 | break; |
| 211 | } |
| 212 | } |
| 213 | }; |
| 214 | // Incase if phosphor-inventory-manager started early and the VPD is already |
| 215 | // collected by the time network service has come up, better to check the |
| 216 | // VPD directly and set the MAC Address on the respective Interface. |
| 217 | |
| 218 | bool registeredSignals = false; |
| 219 | for (const auto& interfaceString : configJson.items()) |
| 220 | { |
Potin Lai | 9f621f3 | 2022-11-18 12:03:09 +0800 | [diff] [blame] | 221 | if ((FORCE_SYNC_MAC_FROM_INVENTORY || |
| 222 | !std::filesystem::exists(firstBootPath + interfaceString.key())) && |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 223 | !registeredSignals) |
| 224 | { |
Potin Lai | 9f621f3 | 2022-11-18 12:03:09 +0800 | [diff] [blame] | 225 | auto msg = fmt::format("{}, check VPD for MAC", |
| 226 | (FORCE_SYNC_MAC_FROM_INVENTORY) |
| 227 | ? "Force sync enabled" |
| 228 | : "First boot file is not present"); |
| 229 | log<level::INFO>(msg.c_str()); |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 230 | EthInterfaceMatch = std::make_unique<sdbusplus::bus::match_t>( |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 231 | bus, |
| 232 | "interface='org.freedesktop.DBus.ObjectManager',type='signal'," |
| 233 | "member='InterfacesAdded',path='/xyz/openbmc_project/network'", |
| 234 | mycallback); |
| 235 | registeredSignals = true; |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | #endif |
| 241 | |
Ratan Gupta | 16f1288 | 2017-09-22 18:26:11 +0530 | [diff] [blame] | 242 | /** @brief refresh the network objects. */ |
Ratan Gupta | a54d8f8 | 2017-09-08 17:05:46 +0530 | [diff] [blame] | 243 | void refreshObjects() |
| 244 | { |
Ratan Gupta | 16f1288 | 2017-09-22 18:26:11 +0530 | [diff] [blame] | 245 | if (manager) |
| 246 | { |
Ratan Gupta | 310a0b1 | 2017-11-15 17:40:24 +0530 | [diff] [blame] | 247 | log<level::INFO>("Refreshing the objects."); |
Ratan Gupta | 16f1288 | 2017-09-22 18:26:11 +0530 | [diff] [blame] | 248 | manager->createChildObjects(); |
Ratan Gupta | 310a0b1 | 2017-11-15 17:40:24 +0530 | [diff] [blame] | 249 | log<level::INFO>("Refreshing complete."); |
Ratan Gupta | 16f1288 | 2017-09-22 18:26:11 +0530 | [diff] [blame] | 250 | } |
| 251 | } |
| 252 | |
William A. Kennington III | c7cf25f | 2021-11-09 16:16:59 -0800 | [diff] [blame] | 253 | void reloadNetworkd() |
| 254 | { |
| 255 | if (manager) |
| 256 | { |
| 257 | log<level::INFO>("Sending networkd reload"); |
| 258 | manager->doReloadConfigs(); |
| 259 | log<level::INFO>("Done networkd reload"); |
| 260 | } |
| 261 | } |
| 262 | |
William A. Kennington III | 217bb3f | 2022-09-29 13:43:13 -0700 | [diff] [blame] | 263 | void initializeTimers(sdeventplus::Event& event) |
Ratan Gupta | 16f1288 | 2017-09-22 18:26:11 +0530 | [diff] [blame] | 264 | { |
William A. Kennington III | 3a70fa2 | 2018-09-20 18:48:20 -0700 | [diff] [blame] | 265 | refreshObjectTimer = |
| 266 | std::make_unique<Timer>(event, std::bind(refreshObjects)); |
William A. Kennington III | c7cf25f | 2021-11-09 16:16:59 -0800 | [diff] [blame] | 267 | reloadTimer = std::make_unique<Timer>(event, std::bind(reloadNetworkd)); |
Ratan Gupta | 16f1288 | 2017-09-22 18:26:11 +0530 | [diff] [blame] | 268 | } |
| 269 | |
William A. Kennington III | 217bb3f | 2022-09-29 13:43:13 -0700 | [diff] [blame] | 270 | void termCb(sdeventplus::source::Signal& signal, const struct signalfd_siginfo*) |
| 271 | { |
| 272 | log<level::NOTICE>("Got TERM, exiting"); |
| 273 | signal.get_event().exit(0); |
| 274 | } |
| 275 | |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 276 | int main() |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 277 | { |
William A. Kennington III | 217bb3f | 2022-09-29 13:43:13 -0700 | [diff] [blame] | 278 | auto event = sdeventplus::Event::get_default(); |
| 279 | stdplus::signal::block(SIGTERM); |
| 280 | sdeventplus::source::Signal(event, SIGTERM, termCb).set_floating(true); |
| 281 | |
| 282 | initializeTimers(event); |
Ratan Gupta | a54d8f8 | 2017-09-08 17:05:46 +0530 | [diff] [blame] | 283 | |
Ratan Gupta | cb7098d | 2017-04-14 17:46:05 +0530 | [diff] [blame] | 284 | auto bus = sdbusplus::bus::new_default(); |
Ratan Gupta | 0f9dc1b | 2017-09-03 17:57:50 +0530 | [diff] [blame] | 285 | // Attach the bus to sd_event to service user requests |
William A. Kennington III | 217bb3f | 2022-09-29 13:43:13 -0700 | [diff] [blame] | 286 | bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL); |
Ratan Gupta | 0f9dc1b | 2017-09-03 17:57:50 +0530 | [diff] [blame] | 287 | |
Ratan Gupta | cb7098d | 2017-04-14 17:46:05 +0530 | [diff] [blame] | 288 | // Add sdbusplus Object Manager for the 'root' path of the network manager. |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 289 | sdbusplus::server::manager_t objManager(bus, DEFAULT_OBJPATH); |
William A. Kennington III | 5f1eb46 | 2019-02-12 19:47:51 -0800 | [diff] [blame] | 290 | bus.request_name(DEFAULT_BUSNAME); |
Ratan Gupta | cb7098d | 2017-04-14 17:46:05 +0530 | [diff] [blame] | 291 | |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 292 | manager = std::make_unique<Manager>(bus, DEFAULT_OBJPATH, NETWORK_CONF_DIR); |
Ratan Gupta | cb7098d | 2017-04-14 17:46:05 +0530 | [diff] [blame] | 293 | |
Vishwanatha Subbanna | 18891c6 | 2017-10-17 15:22:46 +0530 | [diff] [blame] | 294 | // RTNETLINK event handler |
William A. Kennington III | 71590bf | 2022-10-31 14:14:16 -0700 | [diff] [blame] | 295 | netlink::Server svr(event, *manager); |
Vishwanatha Subbanna | 18891c6 | 2017-10-17 15:22:46 +0530 | [diff] [blame] | 296 | |
William A. Kennington III | 6f39c5e | 2021-05-13 18:39:23 -0700 | [diff] [blame] | 297 | #ifdef SYNC_MAC_FROM_INVENTORY |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 298 | std::ifstream in(configFile); |
| 299 | nlohmann::json configJson; |
| 300 | in >> configJson; |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 301 | watchEthernetInterface(bus, configJson); |
Manojkiran Eda | cc099a8 | 2020-05-11 14:25:16 +0530 | [diff] [blame] | 302 | #endif |
William A. Kennington III | bd649af | 2021-10-08 17:55:13 -0700 | [diff] [blame] | 303 | |
| 304 | // Trigger the initial object scan |
William A. Kennington III | 26c40a4 | 2021-11-03 18:27:52 -0700 | [diff] [blame] | 305 | // This is intentionally deferred, to ensure that systemd-networkd is |
| 306 | // fully configured. |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 307 | refreshObjectTimer->restartOnce(refreshTimeout); |
William A. Kennington III | bd649af | 2021-10-08 17:55:13 -0700 | [diff] [blame] | 308 | |
William A. Kennington III | 217bb3f | 2022-09-29 13:43:13 -0700 | [diff] [blame] | 309 | return event.loop(); |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | } // namespace network |
| 313 | } // namespace phosphor |
| 314 | |
| 315 | int main(int /*argc*/, char** /*argv*/) |
| 316 | { |
| 317 | try |
| 318 | { |
| 319 | return phosphor::network::main(); |
| 320 | } |
| 321 | catch (const std::exception& e) |
| 322 | { |
William A. Kennington III | be1af44 | 2022-11-12 01:49:21 -0800 | [diff] [blame] | 323 | fmt::print(stderr, "FAILED: {}", e.what()); |
| 324 | fflush(stderr); |
William A. Kennington III | 4fd52ae | 2022-09-30 13:49:39 -0700 | [diff] [blame] | 325 | return 1; |
| 326 | } |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 327 | } |