Patrick Venture | 690a234 | 2020-05-17 11:51:31 -0700 | [diff] [blame] | 1 | #include "transporthandler.hpp" |
| 2 | |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 3 | #include <stdplus/net/addr/subnet.hpp> |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 4 | #include <stdplus/raw.hpp> |
| 5 | |
| 6 | #include <array> |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 7 | #include <fstream> |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 8 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 9 | using phosphor::logging::commit; |
| 10 | using phosphor::logging::elog; |
| 11 | using phosphor::logging::entry; |
| 12 | using phosphor::logging::level; |
| 13 | using phosphor::logging::log; |
Willy Tu | 523e2d1 | 2023-09-05 11:36:48 -0700 | [diff] [blame] | 14 | using sdbusplus::error::xyz::openbmc_project::common::InternalFailure; |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 15 | using sdbusplus::error::xyz::openbmc_project::common::InvalidArgument; |
Willy Tu | 523e2d1 | 2023-09-05 11:36:48 -0700 | [diff] [blame] | 16 | using sdbusplus::server::xyz::openbmc_project::network::EthernetInterface; |
| 17 | using sdbusplus::server::xyz::openbmc_project::network::IP; |
| 18 | using sdbusplus::server::xyz::openbmc_project::network::Neighbor; |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 19 | |
Johnathan Mantey | affadb5 | 2019-10-07 10:13:53 -0700 | [diff] [blame] | 20 | namespace cipher |
| 21 | { |
| 22 | |
| 23 | std::vector<uint8_t> getCipherList() |
| 24 | { |
| 25 | std::vector<uint8_t> cipherList; |
| 26 | |
| 27 | std::ifstream jsonFile(cipher::configFile); |
| 28 | if (!jsonFile.is_open()) |
| 29 | { |
| 30 | log<level::ERR>("Channel Cipher suites file not found"); |
| 31 | elog<InternalFailure>(); |
| 32 | } |
| 33 | |
| 34 | auto data = Json::parse(jsonFile, nullptr, false); |
| 35 | if (data.is_discarded()) |
| 36 | { |
| 37 | log<level::ERR>("Parsing channel cipher suites JSON failed"); |
| 38 | elog<InternalFailure>(); |
| 39 | } |
| 40 | |
| 41 | // Byte 1 is reserved |
| 42 | cipherList.push_back(0x00); |
| 43 | |
| 44 | for (const auto& record : data) |
| 45 | { |
| 46 | cipherList.push_back(record.value(cipher, 0)); |
| 47 | } |
| 48 | |
| 49 | return cipherList; |
| 50 | } |
| 51 | } // namespace cipher |
| 52 | |
| 53 | namespace ipmi |
| 54 | { |
| 55 | namespace transport |
| 56 | { |
| 57 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 58 | /** @brief Valid address origins for IPv4 */ |
| 59 | const std::unordered_set<IP::AddressOrigin> originsV4 = { |
| 60 | IP::AddressOrigin::Static, |
| 61 | IP::AddressOrigin::DHCP, |
| 62 | }; |
| 63 | |
Johnathan Mantey | b87034e | 2019-09-16 10:50:50 -0700 | [diff] [blame] | 64 | static constexpr uint8_t oemCmdStart = 192; |
Johnathan Mantey | b87034e | 2019-09-16 10:50:50 -0700 | [diff] [blame] | 65 | |
William A. Kennington III | c72f360 | 2023-10-19 03:51:37 -0700 | [diff] [blame] | 66 | // Checks if the ifname is part of the networkd path |
| 67 | // This assumes the path came from the network subtree PATH_ROOT |
| 68 | bool ifnameInPath(std::string_view ifname, std::string_view path) |
| 69 | { |
| 70 | constexpr auto rs = PATH_ROOT.size() + 1; // ROOT + separator |
| 71 | const auto is = rs + ifname.size(); // ROOT + sep + ifname |
| 72 | return path.size() > rs && path.substr(rs).starts_with(ifname) && |
| 73 | (path.size() == is || path[is] == '/'); |
| 74 | } |
| 75 | |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 76 | std::optional<ChannelParams> maybeGetChannelParams(sdbusplus::bus_t& bus, |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 77 | uint8_t channel) |
| 78 | { |
| 79 | auto ifname = getChannelName(channel); |
| 80 | if (ifname.empty()) |
Patrick Venture | c7c1c3c | 2017-11-15 14:29:18 -0800 | [diff] [blame] | 81 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 82 | return std::nullopt; |
Patrick Venture | c7c1c3c | 2017-11-15 14:29:18 -0800 | [diff] [blame] | 83 | } |
Patrick Venture | c7c1c3c | 2017-11-15 14:29:18 -0800 | [diff] [blame] | 84 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 85 | // Enumerate all VLAN + ETHERNET interfaces |
| 86 | auto req = bus.new_method_call(MAPPER_BUS_NAME, MAPPER_OBJ, MAPPER_INTF, |
| 87 | "GetSubTree"); |
William A. Kennington III | c72f360 | 2023-10-19 03:51:37 -0700 | [diff] [blame] | 88 | req.append(std::string_view(PATH_ROOT), 0, |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 89 | std::vector<std::string>{INTF_VLAN, INTF_ETHERNET}); |
| 90 | auto reply = bus.call(req); |
| 91 | ObjectTree objs; |
| 92 | reply.read(objs); |
| 93 | |
| 94 | ChannelParams params; |
| 95 | for (const auto& [path, impls] : objs) |
| 96 | { |
William A. Kennington III | c72f360 | 2023-10-19 03:51:37 -0700 | [diff] [blame] | 97 | if (!ifnameInPath(ifname, path)) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 98 | { |
| 99 | continue; |
| 100 | } |
| 101 | for (const auto& [service, intfs] : impls) |
| 102 | { |
| 103 | bool vlan = false; |
| 104 | bool ethernet = false; |
| 105 | for (const auto& intf : intfs) |
| 106 | { |
| 107 | if (intf == INTF_VLAN) |
| 108 | { |
| 109 | vlan = true; |
| 110 | } |
| 111 | else if (intf == INTF_ETHERNET) |
| 112 | { |
| 113 | ethernet = true; |
| 114 | } |
| 115 | } |
| 116 | if (params.service.empty() && (vlan || ethernet)) |
| 117 | { |
| 118 | params.service = service; |
| 119 | } |
| 120 | if (params.ifPath.empty() && !vlan && ethernet) |
| 121 | { |
| 122 | params.ifPath = path; |
| 123 | } |
| 124 | if (params.logicalPath.empty() && vlan) |
| 125 | { |
| 126 | params.logicalPath = path; |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | // We must have a path for the underlying interface |
| 132 | if (params.ifPath.empty()) |
| 133 | { |
| 134 | return std::nullopt; |
| 135 | } |
| 136 | // We don't have a VLAN so the logical path is the same |
| 137 | if (params.logicalPath.empty()) |
| 138 | { |
| 139 | params.logicalPath = params.ifPath; |
| 140 | } |
| 141 | |
| 142 | params.id = channel; |
| 143 | params.ifname = std::move(ifname); |
Willy Tu | 11d6889 | 2022-01-20 10:37:34 -0800 | [diff] [blame] | 144 | return params; |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 145 | } |
| 146 | |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 147 | ChannelParams getChannelParams(sdbusplus::bus_t& bus, uint8_t channel) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 148 | { |
| 149 | auto params = maybeGetChannelParams(bus, channel); |
| 150 | if (!params) |
| 151 | { |
| 152 | log<level::ERR>("Failed to get channel params", |
| 153 | entry("CHANNEL=%" PRIu8, channel)); |
| 154 | elog<InternalFailure>(); |
| 155 | } |
| 156 | return std::move(*params); |
| 157 | } |
| 158 | |
| 159 | /** @brief Wraps the phosphor logging method to insert some additional metadata |
| 160 | * |
| 161 | * @param[in] params - The parameters for the channel |
| 162 | * ... |
| 163 | */ |
| 164 | template <auto level, typename... Args> |
| 165 | auto logWithChannel(const ChannelParams& params, Args&&... args) |
| 166 | { |
| 167 | return log<level>(std::forward<Args>(args)..., |
| 168 | entry("CHANNEL=%d", params.id), |
| 169 | entry("IFNAME=%s", params.ifname.c_str())); |
| 170 | } |
| 171 | template <auto level, typename... Args> |
| 172 | auto logWithChannel(const std::optional<ChannelParams>& params, Args&&... args) |
| 173 | { |
| 174 | if (params) |
| 175 | { |
| 176 | return logWithChannel<level>(*params, std::forward<Args>(args)...); |
| 177 | } |
| 178 | return log<level>(std::forward<Args>(args)...); |
| 179 | } |
| 180 | |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 181 | /** @brief Get / Set the Property value from phosphor-networkd EthernetInterface |
| 182 | */ |
| 183 | template <typename T> |
| 184 | static T getEthProp(sdbusplus::bus_t& bus, const ChannelParams& params, |
| 185 | const std::string& prop) |
| 186 | { |
| 187 | return std::get<T>(getDbusProperty(bus, params.service, params.logicalPath, |
| 188 | INTF_ETHERNET, prop)); |
| 189 | } |
| 190 | template <typename T> |
| 191 | static void setEthProp(sdbusplus::bus_t& bus, const ChannelParams& params, |
| 192 | const std::string& prop, const T& t) |
| 193 | { |
| 194 | return setDbusProperty(bus, params.service, params.logicalPath, |
| 195 | INTF_ETHERNET, prop, t); |
| 196 | } |
| 197 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 198 | /** @brief Determines the MAC of the ethernet interface |
| 199 | * |
| 200 | * @param[in] bus - The bus object used for lookups |
| 201 | * @param[in] params - The parameters for the channel |
| 202 | * @return The configured mac address |
| 203 | */ |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 204 | stdplus::EtherAddr getMACProperty(sdbusplus::bus_t& bus, |
| 205 | const ChannelParams& params) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 206 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 207 | auto prop = getDbusProperty(bus, params.service, params.ifPath, INTF_MAC, |
| 208 | "MACAddress"); |
| 209 | return stdplus::fromStr<stdplus::EtherAddr>(std::get<std::string>(prop)); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | /** @brief Sets the system value for MAC address on the given interface |
| 213 | * |
| 214 | * @param[in] bus - The bus object used for lookups |
| 215 | * @param[in] params - The parameters for the channel |
| 216 | * @param[in] mac - MAC address to apply |
| 217 | */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 218 | void setMACProperty(sdbusplus::bus_t& bus, const ChannelParams& params, |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 219 | stdplus::EtherAddr mac) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 220 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 221 | setDbusProperty(bus, params.service, params.ifPath, INTF_MAC, "MACAddress", |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 222 | stdplus::toStr(mac)); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 223 | } |
| 224 | |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 225 | void deleteObjectIfExists(sdbusplus::bus_t& bus, const std::string& service, |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 226 | const std::string& path) |
| 227 | { |
| 228 | if (path.empty()) |
| 229 | { |
| 230 | return; |
| 231 | } |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 232 | try |
tomjose | 26e1773 | 2016-03-03 08:52:51 -0600 | [diff] [blame] | 233 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 234 | auto req = bus.new_method_call(service.c_str(), path.c_str(), |
| 235 | ipmi::DELETE_INTERFACE, "Delete"); |
| 236 | bus.call_noreply(req); |
| 237 | } |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 238 | catch (const sdbusplus::exception_t& e) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 239 | { |
jayaprakash Mutyala | 84c49dc | 2020-05-18 23:12:13 +0000 | [diff] [blame] | 240 | if (strcmp(e.name(), |
| 241 | "xyz.openbmc_project.Common.Error.InternalFailure") != 0 && |
| 242 | strcmp(e.name(), "org.freedesktop.DBus.Error.UnknownObject") != 0) |
tomjose | 26e1773 | 2016-03-03 08:52:51 -0600 | [diff] [blame] | 243 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 244 | // We want to rethrow real errors |
| 245 | throw; |
tomjose | 26e1773 | 2016-03-03 08:52:51 -0600 | [diff] [blame] | 246 | } |
| 247 | } |
tomjose | 26e1773 | 2016-03-03 08:52:51 -0600 | [diff] [blame] | 248 | } |
| 249 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 250 | /** @brief Sets the address info configured for the interface |
| 251 | * If a previous address path exists then it will be removed |
| 252 | * before the new address is added. |
| 253 | * |
| 254 | * @param[in] bus - The bus object used for lookups |
| 255 | * @param[in] params - The parameters for the channel |
| 256 | * @param[in] address - The address of the new IP |
| 257 | * @param[in] prefix - The prefix of the new IP |
| 258 | */ |
| 259 | template <int family> |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 260 | void createIfAddr(sdbusplus::bus_t& bus, const ChannelParams& params, |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 261 | typename AddrFamily<family>::addr address, uint8_t prefix) |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 262 | { |
Patrick Williams | fbc6c9d | 2023-05-10 07:50:16 -0500 | [diff] [blame] | 263 | auto newreq = bus.new_method_call(params.service.c_str(), |
| 264 | params.logicalPath.c_str(), |
| 265 | INTF_IP_CREATE, "IP"); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 266 | std::string protocol = |
Willy Tu | 523e2d1 | 2023-09-05 11:36:48 -0700 | [diff] [blame] | 267 | sdbusplus::common::xyz::openbmc_project::network::convertForMessage( |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 268 | AddrFamily<family>::protocol); |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 269 | stdplus::ToStrHandle<stdplus::ToStr<typename AddrFamily<family>::addr>> tsh; |
| 270 | newreq.append(protocol, tsh(address), prefix, ""); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 271 | bus.call_noreply(newreq); |
| 272 | } |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 273 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 274 | /** @brief Trivial helper for getting the IPv4 address from getIfAddrs() |
| 275 | * |
| 276 | * @param[in] bus - The bus object used for lookups |
| 277 | * @param[in] params - The parameters for the channel |
| 278 | * @return The address and prefix if found |
| 279 | */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 280 | auto getIfAddr4(sdbusplus::bus_t& bus, const ChannelParams& params) |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 281 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 282 | return getIfAddr<AF_INET>(bus, params, 0, originsV4); |
| 283 | } |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 284 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 285 | /** @brief Reconfigures the IPv4 address info configured for the interface |
| 286 | * |
| 287 | * @param[in] bus - The bus object used for lookups |
| 288 | * @param[in] params - The parameters for the channel |
| 289 | * @param[in] address - The new address if specified |
| 290 | * @param[in] prefix - The new address prefix if specified |
| 291 | */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 292 | void reconfigureIfAddr4(sdbusplus::bus_t& bus, const ChannelParams& params, |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 293 | std::optional<stdplus::In4Addr> address, |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 294 | std::optional<uint8_t> prefix) |
| 295 | { |
| 296 | auto ifaddr = getIfAddr4(bus, params); |
| 297 | if (!ifaddr && !address) |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 298 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 299 | log<level::ERR>("Missing address for IPv4 assignment"); |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 300 | elog<InternalFailure>(); |
| 301 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 302 | uint8_t fallbackPrefix = AddrFamily<AF_INET>::defaultPrefix; |
| 303 | if (ifaddr) |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 304 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 305 | fallbackPrefix = ifaddr->prefix; |
| 306 | deleteObjectIfExists(bus, params.service, ifaddr->path); |
| 307 | } |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 308 | auto addr = address.value_or(ifaddr->address); |
| 309 | if (addr != stdplus::In4Addr{}) |
Johnathan Mantey | cbfa6e1 | 2023-06-01 06:57:25 -0700 | [diff] [blame] | 310 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 311 | createIfAddr<AF_INET>(bus, params, addr, |
Johnathan Mantey | cbfa6e1 | 2023-06-01 06:57:25 -0700 | [diff] [blame] | 312 | prefix.value_or(fallbackPrefix)); |
| 313 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 314 | } |
| 315 | |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 316 | template <int family> |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 317 | std::optional<IfNeigh<family>> findGatewayNeighbor(sdbusplus::bus_t& bus, |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 318 | const ChannelParams& params, |
| 319 | ObjectLookupCache& neighbors) |
| 320 | { |
| 321 | auto gateway = getGatewayProperty<family>(bus, params); |
| 322 | if (!gateway) |
| 323 | { |
| 324 | return std::nullopt; |
| 325 | } |
| 326 | |
| 327 | return findStaticNeighbor<family>(bus, params, *gateway, neighbors); |
| 328 | } |
| 329 | |
| 330 | template <int family> |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 331 | std::optional<IfNeigh<family>> getGatewayNeighbor(sdbusplus::bus_t& bus, |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 332 | const ChannelParams& params) |
| 333 | { |
| 334 | ObjectLookupCache neighbors(bus, params, INTF_NEIGHBOR); |
| 335 | return findGatewayNeighbor<family>(bus, params, neighbors); |
| 336 | } |
| 337 | |
| 338 | template <int family> |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 339 | void reconfigureGatewayMAC(sdbusplus::bus_t& bus, const ChannelParams& params, |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 340 | stdplus::EtherAddr mac) |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 341 | { |
| 342 | auto gateway = getGatewayProperty<family>(bus, params); |
| 343 | if (!gateway) |
| 344 | { |
| 345 | log<level::ERR>("Tried to set Gateway MAC without Gateway"); |
| 346 | elog<InternalFailure>(); |
| 347 | } |
| 348 | |
| 349 | ObjectLookupCache neighbors(bus, params, INTF_NEIGHBOR); |
Patrick Williams | fbc6c9d | 2023-05-10 07:50:16 -0500 | [diff] [blame] | 350 | auto neighbor = findStaticNeighbor<family>(bus, params, *gateway, |
| 351 | neighbors); |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 352 | if (neighbor) |
| 353 | { |
| 354 | deleteObjectIfExists(bus, params.service, neighbor->path); |
| 355 | } |
| 356 | |
| 357 | createNeighbor<family>(bus, params, *gateway, mac); |
| 358 | } |
| 359 | |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 360 | /** @brief Deconfigures the IPv6 address info configured for the interface |
| 361 | * |
| 362 | * @param[in] bus - The bus object used for lookups |
| 363 | * @param[in] params - The parameters for the channel |
| 364 | * @param[in] idx - The address index to operate on |
| 365 | */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 366 | void deconfigureIfAddr6(sdbusplus::bus_t& bus, const ChannelParams& params, |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 367 | uint8_t idx) |
| 368 | { |
| 369 | auto ifaddr = getIfAddr<AF_INET6>(bus, params, idx, originsV6Static); |
| 370 | if (ifaddr) |
| 371 | { |
| 372 | deleteObjectIfExists(bus, params.service, ifaddr->path); |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | /** @brief Reconfigures the IPv6 address info configured for the interface |
| 377 | * |
| 378 | * @param[in] bus - The bus object used for lookups |
| 379 | * @param[in] params - The parameters for the channel |
| 380 | * @param[in] idx - The address index to operate on |
| 381 | * @param[in] address - The new address |
| 382 | * @param[in] prefix - The new address prefix |
| 383 | */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 384 | void reconfigureIfAddr6(sdbusplus::bus_t& bus, const ChannelParams& params, |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 385 | uint8_t idx, stdplus::In6Addr address, uint8_t prefix) |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 386 | { |
| 387 | deconfigureIfAddr6(bus, params, idx); |
| 388 | createIfAddr<AF_INET6>(bus, params, address, prefix); |
| 389 | } |
| 390 | |
| 391 | /** @brief Converts the AddressOrigin into an IPv6Source |
| 392 | * |
| 393 | * @param[in] origin - The DBus Address Origin to convert |
| 394 | * @return The IPv6Source version of the origin |
| 395 | */ |
| 396 | IPv6Source originToSourceType(IP::AddressOrigin origin) |
| 397 | { |
| 398 | switch (origin) |
| 399 | { |
| 400 | case IP::AddressOrigin::Static: |
| 401 | return IPv6Source::Static; |
| 402 | case IP::AddressOrigin::DHCP: |
| 403 | return IPv6Source::DHCP; |
| 404 | case IP::AddressOrigin::SLAAC: |
| 405 | return IPv6Source::SLAAC; |
| 406 | default: |
| 407 | { |
Willy Tu | 523e2d1 | 2023-09-05 11:36:48 -0700 | [diff] [blame] | 408 | auto originStr = sdbusplus::common::xyz::openbmc_project::network:: |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 409 | convertForMessage(origin); |
| 410 | log<level::ERR>( |
| 411 | "Invalid IP::AddressOrigin conversion to IPv6Source", |
| 412 | entry("ORIGIN=%s", originStr.c_str())); |
| 413 | elog<InternalFailure>(); |
| 414 | } |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | /** @brief Packs the IPMI message response with IPv6 address data |
| 419 | * |
| 420 | * @param[out] ret - The IPMI response payload to be packed |
| 421 | * @param[in] channel - The channel id corresponding to an ethernet interface |
| 422 | * @param[in] set - The set selector for determining address index |
| 423 | * @param[in] origins - Set of valid origins for address filtering |
| 424 | */ |
| 425 | void getLanIPv6Address(message::Payload& ret, uint8_t channel, uint8_t set, |
| 426 | const std::unordered_set<IP::AddressOrigin>& origins) |
| 427 | { |
| 428 | auto source = IPv6Source::Static; |
| 429 | bool enabled = false; |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 430 | stdplus::In6Addr addr{}; |
Johnathan Mantey | 5aae092 | 2021-10-21 13:05:36 -0700 | [diff] [blame] | 431 | uint8_t prefix{}; |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 432 | auto status = IPv6AddressStatus::Disabled; |
| 433 | |
| 434 | auto ifaddr = channelCall<getIfAddr<AF_INET6>>(channel, set, origins); |
| 435 | if (ifaddr) |
| 436 | { |
| 437 | source = originToSourceType(ifaddr->origin); |
Johnathan Mantey | 846af86 | 2021-10-21 12:48:54 -0700 | [diff] [blame] | 438 | enabled = (origins == originsV6Static); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 439 | addr = ifaddr->address; |
| 440 | prefix = ifaddr->prefix; |
| 441 | status = IPv6AddressStatus::Active; |
| 442 | } |
| 443 | |
| 444 | ret.pack(set); |
William A. Kennington III | 7a0e5df | 2021-05-19 13:31:29 -0700 | [diff] [blame] | 445 | ret.pack(types::enum_cast<uint4_t>(source), uint3_t{}, enabled); |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 446 | ret.pack(stdplus::raw::asView<char>(addr)); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 447 | ret.pack(prefix); |
William A. Kennington III | 7a0e5df | 2021-05-19 13:31:29 -0700 | [diff] [blame] | 448 | ret.pack(types::enum_cast<uint8_t>(status)); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 449 | } |
| 450 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 451 | /** @brief Gets the vlan ID configured on the interface |
| 452 | * |
| 453 | * @param[in] bus - The bus object used for lookups |
| 454 | * @param[in] params - The parameters for the channel |
| 455 | * @return VLAN id or the standard 0 for no VLAN |
| 456 | */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 457 | uint16_t getVLANProperty(sdbusplus::bus_t& bus, const ChannelParams& params) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 458 | { |
| 459 | // VLAN devices will always have a separate logical object |
| 460 | if (params.ifPath == params.logicalPath) |
| 461 | { |
| 462 | return 0; |
| 463 | } |
| 464 | |
| 465 | auto vlan = std::get<uint32_t>(getDbusProperty( |
| 466 | bus, params.service, params.logicalPath, INTF_VLAN, "Id")); |
| 467 | if ((vlan & VLAN_VALUE_MASK) != vlan) |
| 468 | { |
| 469 | logWithChannel<level::ERR>(params, "networkd returned an invalid vlan", |
| 470 | entry("VLAN=%" PRIu32, vlan)); |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 471 | elog<InternalFailure>(); |
| 472 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 473 | return vlan; |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 474 | } |
| 475 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 476 | /** @brief Deletes all of the possible configuration parameters for a channel |
| 477 | * |
| 478 | * @param[in] bus - The bus object used for lookups |
| 479 | * @param[in] params - The parameters for the channel |
| 480 | */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 481 | void deconfigureChannel(sdbusplus::bus_t& bus, ChannelParams& params) |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 482 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 483 | // Delete all objects associated with the interface |
| 484 | auto objreq = bus.new_method_call(MAPPER_BUS_NAME, MAPPER_OBJ, MAPPER_INTF, |
| 485 | "GetSubTree"); |
William A. Kennington III | c72f360 | 2023-10-19 03:51:37 -0700 | [diff] [blame] | 486 | objreq.append(std::string_view(PATH_ROOT), 0, |
| 487 | std::vector<std::string>{DELETE_INTERFACE}); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 488 | auto objreply = bus.call(objreq); |
| 489 | ObjectTree objs; |
| 490 | objreply.read(objs); |
| 491 | for (const auto& [path, impls] : objs) |
| 492 | { |
William A. Kennington III | c72f360 | 2023-10-19 03:51:37 -0700 | [diff] [blame] | 493 | if (!ifnameInPath(params.ifname, path)) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 494 | { |
| 495 | continue; |
| 496 | } |
| 497 | for (const auto& [service, intfs] : impls) |
| 498 | { |
| 499 | deleteObjectIfExists(bus, service, path); |
| 500 | } |
| 501 | // Update params to reflect the deletion of vlan |
| 502 | if (path == params.logicalPath) |
| 503 | { |
| 504 | params.logicalPath = params.ifPath; |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | // Clear out any settings on the lower physical interface |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 509 | setEthProp(bus, params, "DHCP4", false); |
| 510 | setEthProp(bus, params, "DHCP6", false); |
| 511 | setEthProp(bus, params, "IPv6AcceptRA", false); |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 512 | } |
| 513 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 514 | /** @brief Creates a new VLAN on the specified interface |
| 515 | * |
| 516 | * @param[in] bus - The bus object used for lookups |
| 517 | * @param[in] params - The parameters for the channel |
| 518 | * @param[in] vlan - The id of the new vlan |
| 519 | */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 520 | void createVLAN(sdbusplus::bus_t& bus, ChannelParams& params, uint16_t vlan) |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 521 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 522 | if (vlan == 0) |
Richard Marian Thomaiyar | 75b480b | 2019-01-22 00:20:15 +0530 | [diff] [blame] | 523 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 524 | return; |
Richard Marian Thomaiyar | 75b480b | 2019-01-22 00:20:15 +0530 | [diff] [blame] | 525 | } |
| 526 | |
William A. Kennington III | c72f360 | 2023-10-19 03:51:37 -0700 | [diff] [blame] | 527 | auto req = bus.new_method_call(params.service.c_str(), PATH_ROOT.c_str(), |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 528 | INTF_VLAN_CREATE, "VLAN"); |
| 529 | req.append(params.ifname, static_cast<uint32_t>(vlan)); |
| 530 | auto reply = bus.call(req); |
| 531 | sdbusplus::message::object_path newPath; |
| 532 | reply.read(newPath); |
| 533 | params.logicalPath = std::move(newPath); |
Richard Marian Thomaiyar | 75b480b | 2019-01-22 00:20:15 +0530 | [diff] [blame] | 534 | } |
| 535 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 536 | /** @brief Performs the necessary reconfiguration to change the VLAN |
| 537 | * |
| 538 | * @param[in] bus - The bus object used for lookups |
| 539 | * @param[in] params - The parameters for the channel |
| 540 | * @param[in] vlan - The new vlan id to use |
| 541 | */ |
Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 542 | void reconfigureVLAN(sdbusplus::bus_t& bus, ChannelParams& params, |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 543 | uint16_t vlan) |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 544 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 545 | // Unfortunatetly we don't have built-in functions to migrate our interface |
| 546 | // customizations to new VLAN interfaces, or have some kind of decoupling. |
| 547 | // We therefore must retain all of our old information, setup the new VLAN |
| 548 | // configuration, then restore the old info. |
Nan Li | 3d0df91 | 2016-10-18 19:51:41 +0800 | [diff] [blame] | 549 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 550 | // Save info from the old logical interface |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 551 | bool dhcp4 = getEthProp<bool>(bus, params, "DHCP4"); |
| 552 | bool dhcp6 = getEthProp<bool>(bus, params, "DHCP6"); |
| 553 | bool ra = getEthProp<bool>(bus, params, "IPv6AcceptRA"); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 554 | ObjectLookupCache ips(bus, params, INTF_IP); |
| 555 | auto ifaddr4 = findIfAddr<AF_INET>(bus, params, 0, originsV4, ips); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 556 | std::vector<IfAddr<AF_INET6>> ifaddrs6; |
| 557 | for (uint8_t i = 0; i < MAX_IPV6_STATIC_ADDRESSES; ++i) |
| 558 | { |
Patrick Williams | fbc6c9d | 2023-05-10 07:50:16 -0500 | [diff] [blame] | 559 | auto ifaddr6 = findIfAddr<AF_INET6>(bus, params, i, originsV6Static, |
| 560 | ips); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 561 | if (!ifaddr6) |
| 562 | { |
| 563 | break; |
| 564 | } |
| 565 | ifaddrs6.push_back(std::move(*ifaddr6)); |
| 566 | } |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 567 | ObjectLookupCache neighbors(bus, params, INTF_NEIGHBOR); |
| 568 | auto neighbor4 = findGatewayNeighbor<AF_INET>(bus, params, neighbors); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 569 | auto neighbor6 = findGatewayNeighbor<AF_INET6>(bus, params, neighbors); |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 570 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 571 | deconfigureChannel(bus, params); |
| 572 | createVLAN(bus, params, vlan); |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 573 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 574 | // Re-establish the saved settings |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 575 | setEthProp(bus, params, "DHCP4", dhcp4); |
| 576 | setEthProp(bus, params, "DHCP6", dhcp6); |
| 577 | setEthProp(bus, params, "IPv6AcceptRA", ra); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 578 | if (ifaddr4) |
Patrick Venture | c7c1c3c | 2017-11-15 14:29:18 -0800 | [diff] [blame] | 579 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 580 | createIfAddr<AF_INET>(bus, params, ifaddr4->address, ifaddr4->prefix); |
Patrick Venture | c7c1c3c | 2017-11-15 14:29:18 -0800 | [diff] [blame] | 581 | } |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 582 | for (const auto& ifaddr6 : ifaddrs6) |
| 583 | { |
| 584 | createIfAddr<AF_INET6>(bus, params, ifaddr6.address, ifaddr6.prefix); |
| 585 | } |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 586 | if (neighbor4) |
| 587 | { |
| 588 | createNeighbor<AF_INET>(bus, params, neighbor4->ip, neighbor4->mac); |
| 589 | } |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 590 | if (neighbor6) |
| 591 | { |
| 592 | createNeighbor<AF_INET6>(bus, params, neighbor6->ip, neighbor6->mac); |
| 593 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 594 | } |
Patrick Venture | c7c1c3c | 2017-11-15 14:29:18 -0800 | [diff] [blame] | 595 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 596 | // We need to store this value so it can be returned to the client |
| 597 | // It is volatile so safe to store in daemon memory. |
| 598 | static std::unordered_map<uint8_t, SetStatus> setStatus; |
| 599 | |
| 600 | // Until we have good support for fixed versions of IPMI tool |
| 601 | // we need to return the VLAN id for disabled VLANs. The value is only |
| 602 | // used for verification that a disable operation succeeded and will only |
| 603 | // be sent if our system indicates that vlans are disabled. |
| 604 | static std::unordered_map<uint8_t, uint16_t> lastDisabledVlan; |
| 605 | |
| 606 | /** @brief Gets the set status for the channel if it exists |
| 607 | * Otherise populates and returns the default value. |
| 608 | * |
| 609 | * @param[in] channel - The channel id corresponding to an ethernet interface |
| 610 | * @return A reference to the SetStatus for the channel |
| 611 | */ |
| 612 | SetStatus& getSetStatus(uint8_t channel) |
| 613 | { |
| 614 | auto it = setStatus.find(channel); |
| 615 | if (it != setStatus.end()) |
| 616 | { |
| 617 | return it->second; |
| 618 | } |
| 619 | return setStatus[channel] = SetStatus::Complete; |
| 620 | } |
| 621 | |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 622 | /** @brief Unpacks the trivially copyable type from the message */ |
| 623 | template <typename T> |
| 624 | static T unpackT(message::Payload& req) |
| 625 | { |
| 626 | std::array<uint8_t, sizeof(T)> bytes; |
| 627 | if (req.unpack(bytes) != 0) |
| 628 | { |
| 629 | throw ccReqDataLenInvalid; |
| 630 | } |
| 631 | return stdplus::raw::copyFrom<T>(bytes); |
| 632 | } |
| 633 | |
| 634 | /** @brief Ensure the message is fully unpacked */ |
| 635 | static void unpackFinal(message::Payload& req) |
| 636 | { |
| 637 | if (!req.fullyUnpacked()) |
| 638 | { |
| 639 | throw ccReqDataTruncated; |
| 640 | } |
| 641 | } |
| 642 | |
Johnathan Mantey | b87034e | 2019-09-16 10:50:50 -0700 | [diff] [blame] | 643 | /** |
| 644 | * Define placeholder command handlers for the OEM Extension bytes for the Set |
| 645 | * LAN Configuration Parameters and Get LAN Configuration Parameters |
| 646 | * commands. Using "weak" linking allows the placeholder setLanOem/getLanOem |
| 647 | * functions below to be overridden. |
| 648 | * To create handlers for your own proprietary command set: |
| 649 | * Create/modify a phosphor-ipmi-host Bitbake append file within your Yocto |
| 650 | * recipe |
| 651 | * Create C++ file(s) that define IPMI handler functions matching the |
| 652 | * function names below (i.e. setLanOem). The default name for the |
| 653 | * transport IPMI commands is transporthandler_oem.cpp. |
| 654 | * Add: |
Johnathan Mantey | efe2668 | 2022-08-11 14:30:45 -0700 | [diff] [blame] | 655 | * EXTRA_OEMESON:append = "-Dtransport-oem=enabled" |
| 656 | * Create a do_configure:prepend()/do_install:append() method in your |
Johnathan Mantey | b87034e | 2019-09-16 10:50:50 -0700 | [diff] [blame] | 657 | * bbappend file to copy the file to the build directory. |
| 658 | * Add: |
| 659 | * PROJECT_SRC_DIR := "${THISDIR}/${PN}" |
| 660 | * # Copy the "strong" functions into the working directory, overriding the |
| 661 | * # placeholder functions. |
Johnathan Mantey | efe2668 | 2022-08-11 14:30:45 -0700 | [diff] [blame] | 662 | * do_configure:prepend(){ |
Johnathan Mantey | b87034e | 2019-09-16 10:50:50 -0700 | [diff] [blame] | 663 | * cp -f ${PROJECT_SRC_DIR}/transporthandler_oem.cpp ${S} |
| 664 | * } |
| 665 | * |
| 666 | * # Clean up after complilation has completed |
Johnathan Mantey | efe2668 | 2022-08-11 14:30:45 -0700 | [diff] [blame] | 667 | * do_install:append(){ |
Johnathan Mantey | b87034e | 2019-09-16 10:50:50 -0700 | [diff] [blame] | 668 | * rm -f ${S}/transporthandler_oem.cpp |
| 669 | * } |
| 670 | * |
| 671 | */ |
| 672 | |
| 673 | /** |
| 674 | * Define the placeholder OEM commands as having weak linkage. Create |
| 675 | * setLanOem, and getLanOem functions in the transporthandler_oem.cpp |
| 676 | * file. The functions defined there must not have the "weak" attribute |
| 677 | * applied to them. |
| 678 | */ |
| 679 | RspType<> setLanOem(uint8_t channel, uint8_t parameter, message::Payload& req) |
| 680 | __attribute__((weak)); |
| 681 | RspType<message::Payload> getLanOem(uint8_t channel, uint8_t parameter, |
| 682 | uint8_t set, uint8_t block) |
| 683 | __attribute__((weak)); |
| 684 | |
Willy Tu | 11d6889 | 2022-01-20 10:37:34 -0800 | [diff] [blame] | 685 | RspType<> setLanOem(uint8_t, uint8_t, message::Payload& req) |
Johnathan Mantey | b87034e | 2019-09-16 10:50:50 -0700 | [diff] [blame] | 686 | { |
| 687 | req.trailingOk = true; |
| 688 | return response(ccParamNotSupported); |
| 689 | } |
| 690 | |
Willy Tu | 11d6889 | 2022-01-20 10:37:34 -0800 | [diff] [blame] | 691 | RspType<message::Payload> getLanOem(uint8_t, uint8_t, uint8_t, uint8_t) |
Johnathan Mantey | b87034e | 2019-09-16 10:50:50 -0700 | [diff] [blame] | 692 | { |
| 693 | return response(ccParamNotSupported); |
| 694 | } |
| 695 | |
Jian Zhang | cf19d14 | 2023-07-31 10:22:53 +0800 | [diff] [blame] | 696 | /** |
| 697 | * @brief is a valid LAN channel. |
| 698 | * |
| 699 | * This function checks whether the input channel is a valid LAN channel or not. |
| 700 | * |
| 701 | * @param[in] channel: the channel number. |
| 702 | * @return nullopt if the channel is invalid, false if the channel is not a LAN |
| 703 | * channel, true if the channel is a LAN channel. |
| 704 | **/ |
| 705 | std::optional<bool> isLanChannel(uint8_t channel) |
| 706 | { |
| 707 | ChannelInfo chInfo; |
| 708 | auto cc = getChannelInfo(channel, chInfo); |
| 709 | if (cc != ccSuccess) |
| 710 | { |
| 711 | return std::nullopt; |
| 712 | } |
| 713 | |
| 714 | return chInfo.mediumType == |
| 715 | static_cast<uint8_t>(EChannelMediumType::lan8032); |
| 716 | } |
| 717 | |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 718 | RspType<> setLanInt(Context::ptr ctx, uint4_t channelBits, uint4_t reserved1, |
| 719 | uint8_t parameter, message::Payload& req) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 720 | { |
vijayabharathix shetty | cc76925 | 2020-02-27 17:52:20 +0000 | [diff] [blame] | 721 | const uint8_t channel = convertCurrentChannelNum( |
| 722 | static_cast<uint8_t>(channelBits), ctx->channel); |
| 723 | if (reserved1 || !isValidChannel(channel)) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 724 | { |
vijayabharathix shetty | cc76925 | 2020-02-27 17:52:20 +0000 | [diff] [blame] | 725 | log<level::ERR>("Set Lan - Invalid field in request"); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 726 | req.trailingOk = true; |
| 727 | return responseInvalidFieldRequest(); |
| 728 | } |
| 729 | |
Jian Zhang | cf19d14 | 2023-07-31 10:22:53 +0800 | [diff] [blame] | 730 | if (!isLanChannel(channel).value_or(false)) |
| 731 | { |
| 732 | log<level::ERR>("Set Lan - Not a LAN channel"); |
| 733 | return responseInvalidFieldRequest(); |
| 734 | } |
| 735 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 736 | switch (static_cast<LanParam>(parameter)) |
| 737 | { |
| 738 | case LanParam::SetStatus: |
| 739 | { |
| 740 | uint2_t flag; |
| 741 | uint6_t rsvd; |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 742 | if (req.unpack(flag, rsvd) != 0) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 743 | { |
| 744 | return responseReqDataLenInvalid(); |
| 745 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 746 | unpackFinal(req); |
Johnathan Mantey | 4a15685 | 2019-12-11 13:47:43 -0800 | [diff] [blame] | 747 | if (rsvd) |
| 748 | { |
| 749 | return responseInvalidFieldRequest(); |
| 750 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 751 | auto status = static_cast<SetStatus>(static_cast<uint8_t>(flag)); |
| 752 | switch (status) |
| 753 | { |
| 754 | case SetStatus::Complete: |
| 755 | { |
| 756 | getSetStatus(channel) = status; |
| 757 | return responseSuccess(); |
| 758 | } |
| 759 | case SetStatus::InProgress: |
| 760 | { |
| 761 | auto& storedStatus = getSetStatus(channel); |
| 762 | if (storedStatus == SetStatus::InProgress) |
| 763 | { |
| 764 | return response(ccParamSetLocked); |
| 765 | } |
| 766 | storedStatus = status; |
| 767 | return responseSuccess(); |
| 768 | } |
| 769 | case SetStatus::Commit: |
| 770 | if (getSetStatus(channel) != SetStatus::InProgress) |
| 771 | { |
| 772 | return responseInvalidFieldRequest(); |
| 773 | } |
| 774 | return responseSuccess(); |
| 775 | } |
| 776 | return response(ccParamNotSupported); |
| 777 | } |
| 778 | case LanParam::AuthSupport: |
| 779 | { |
| 780 | req.trailingOk = true; |
| 781 | return response(ccParamReadOnly); |
| 782 | } |
| 783 | case LanParam::AuthEnables: |
| 784 | { |
| 785 | req.trailingOk = true; |
Johnathan Mantey | 76ce9c7 | 2019-11-14 14:41:46 -0800 | [diff] [blame] | 786 | return response(ccParamReadOnly); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 787 | } |
William A. Kennington III | aab2023 | 2018-11-19 18:20:39 -0800 | [diff] [blame] | 788 | case LanParam::IP: |
Hariharasubramanian R | 8395191 | 2016-01-20 07:06:36 -0600 | [diff] [blame] | 789 | { |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 790 | if (channelCall<getEthProp<bool>>(channel, "DHCP4")) |
Johnathan Mantey | 930104a | 2019-12-17 09:18:34 -0800 | [diff] [blame] | 791 | { |
| 792 | return responseCommandNotAvailable(); |
| 793 | } |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 794 | auto ip = unpackT<stdplus::In4Addr>(req); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 795 | unpackFinal(req); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 796 | channelCall<reconfigureIfAddr4>(channel, ip, std::nullopt); |
| 797 | return responseSuccess(); |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 798 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 799 | case LanParam::IPSrc: |
Ratan Gupta | cc6cdbf | 2017-09-01 23:06:25 +0530 | [diff] [blame] | 800 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 801 | uint4_t flag; |
| 802 | uint4_t rsvd; |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 803 | if (req.unpack(flag, rsvd) != 0) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 804 | { |
| 805 | return responseReqDataLenInvalid(); |
| 806 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 807 | unpackFinal(req); |
Johnathan Mantey | 4a15685 | 2019-12-11 13:47:43 -0800 | [diff] [blame] | 808 | if (rsvd) |
| 809 | { |
| 810 | return responseInvalidFieldRequest(); |
| 811 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 812 | switch (static_cast<IPSrc>(static_cast<uint8_t>(flag))) |
| 813 | { |
| 814 | case IPSrc::DHCP: |
Johnathan Mantey | 6526536 | 2019-11-14 11:24:19 -0800 | [diff] [blame] | 815 | // The IPSrc IPMI command is only for IPv4 |
| 816 | // management. Modifying IPv6 state is done using |
| 817 | // a completely different Set LAN Configuration |
| 818 | // subcommand. |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 819 | channelCall<setEthProp<bool>>(channel, "DHCP4", true); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 820 | return responseSuccess(); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 821 | case IPSrc::Unspecified: |
| 822 | case IPSrc::Static: |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 823 | channelCall<setEthProp<bool>>(channel, "DHCP4", false); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 824 | return responseSuccess(); |
Rajashekar Gade Reddy | 8a860ea | 2019-12-24 11:31:19 +0530 | [diff] [blame] | 825 | case IPSrc::BIOS: |
| 826 | case IPSrc::BMC: |
Rajashekar Gade Reddy | 8a860ea | 2019-12-24 11:31:19 +0530 | [diff] [blame] | 827 | return responseInvalidFieldRequest(); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 828 | } |
| 829 | return response(ccParamNotSupported); |
Ratan Gupta | cc6cdbf | 2017-09-01 23:06:25 +0530 | [diff] [blame] | 830 | } |
William A. Kennington III | aab2023 | 2018-11-19 18:20:39 -0800 | [diff] [blame] | 831 | case LanParam::MAC: |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 832 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 833 | auto mac = unpackT<stdplus::EtherAddr>(req); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 834 | unpackFinal(req); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 835 | channelCall<setMACProperty>(channel, mac); |
| 836 | return responseSuccess(); |
Ratan Gupta | 533d03b | 2017-07-30 10:39:22 +0530 | [diff] [blame] | 837 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 838 | case LanParam::SubnetMask: |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 839 | { |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 840 | if (channelCall<getEthProp<bool>>(channel, "DHCP4")) |
Johnathan Mantey | 930104a | 2019-12-17 09:18:34 -0800 | [diff] [blame] | 841 | { |
| 842 | return responseCommandNotAvailable(); |
| 843 | } |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 844 | auto pfx = stdplus::maskToPfx(unpackT<stdplus::In4Addr>(req)); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 845 | unpackFinal(req); |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 846 | channelCall<reconfigureIfAddr4>(channel, std::nullopt, pfx); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 847 | return responseSuccess(); |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 848 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 849 | case LanParam::Gateway1: |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 850 | { |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 851 | if (channelCall<getEthProp<bool>>(channel, "DHCP4")) |
Johnathan Mantey | 930104a | 2019-12-17 09:18:34 -0800 | [diff] [blame] | 852 | { |
| 853 | return responseCommandNotAvailable(); |
| 854 | } |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 855 | auto gateway = unpackT<stdplus::In4Addr>(req); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 856 | unpackFinal(req); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 857 | channelCall<setGatewayProperty<AF_INET>>(channel, gateway); |
| 858 | return responseSuccess(); |
| 859 | } |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 860 | case LanParam::Gateway1MAC: |
| 861 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 862 | auto gatewayMAC = unpackT<stdplus::EtherAddr>(req); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 863 | unpackFinal(req); |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 864 | channelCall<reconfigureGatewayMAC<AF_INET>>(channel, gatewayMAC); |
| 865 | return responseSuccess(); |
| 866 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 867 | case LanParam::VLANId: |
| 868 | { |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 869 | uint12_t vlanData; |
| 870 | uint3_t rsvd; |
| 871 | bool vlanEnable; |
Suryakanth Sekar | 8e8c8e2 | 2019-08-30 11:54:20 +0530 | [diff] [blame] | 872 | |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 873 | if (req.unpack(vlanData, rsvd, vlanEnable) != 0) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 874 | { |
| 875 | return responseReqDataLenInvalid(); |
| 876 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 877 | unpackFinal(req); |
Suryakanth Sekar | 8e8c8e2 | 2019-08-30 11:54:20 +0530 | [diff] [blame] | 878 | |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 879 | if (rsvd) |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 880 | { |
Suryakanth Sekar | 8e8c8e2 | 2019-08-30 11:54:20 +0530 | [diff] [blame] | 881 | return responseInvalidFieldRequest(); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 882 | } |
Suryakanth Sekar | 8e8c8e2 | 2019-08-30 11:54:20 +0530 | [diff] [blame] | 883 | |
| 884 | uint16_t vlan = static_cast<uint16_t>(vlanData); |
| 885 | |
| 886 | if (!vlanEnable) |
| 887 | { |
| 888 | lastDisabledVlan[channel] = vlan; |
| 889 | vlan = 0; |
| 890 | } |
Jayaprakash Mutyala | 0d1d7ad | 2024-06-19 10:19:33 +0000 | [diff] [blame^] | 891 | else if (vlan == 0 || vlan == VLAN_VALUE_MASK) |
| 892 | { |
| 893 | return responseInvalidFieldRequest(); |
| 894 | } |
Suryakanth Sekar | 8e8c8e2 | 2019-08-30 11:54:20 +0530 | [diff] [blame] | 895 | |
jayaprakash Mutyala | 84c49dc | 2020-05-18 23:12:13 +0000 | [diff] [blame] | 896 | channelCall<reconfigureVLAN>(channel, vlan); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 897 | return responseSuccess(); |
| 898 | } |
| 899 | case LanParam::CiphersuiteSupport: |
| 900 | case LanParam::CiphersuiteEntries: |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 901 | case LanParam::IPFamilySupport: |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 902 | { |
| 903 | req.trailingOk = true; |
| 904 | return response(ccParamReadOnly); |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 905 | } |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 906 | case LanParam::IPFamilyEnables: |
| 907 | { |
| 908 | uint8_t enables; |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 909 | if (req.unpack(enables) != 0) |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 910 | { |
| 911 | return responseReqDataLenInvalid(); |
| 912 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 913 | unpackFinal(req); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 914 | switch (static_cast<IPFamilyEnables>(enables)) |
| 915 | { |
| 916 | case IPFamilyEnables::DualStack: |
| 917 | return responseSuccess(); |
| 918 | case IPFamilyEnables::IPv4Only: |
| 919 | case IPFamilyEnables::IPv6Only: |
| 920 | return response(ccParamNotSupported); |
| 921 | } |
| 922 | return response(ccParamNotSupported); |
| 923 | } |
| 924 | case LanParam::IPv6Status: |
| 925 | { |
| 926 | req.trailingOk = true; |
| 927 | return response(ccParamReadOnly); |
| 928 | } |
| 929 | case LanParam::IPv6StaticAddresses: |
| 930 | { |
| 931 | uint8_t set; |
| 932 | uint7_t rsvd; |
| 933 | bool enabled; |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 934 | uint8_t prefix; |
| 935 | uint8_t status; |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 936 | if (req.unpack(set, rsvd, enabled) != 0) |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 937 | { |
| 938 | return responseReqDataLenInvalid(); |
| 939 | } |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 940 | auto ip = unpackT<stdplus::In6Addr>(req); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 941 | if (req.unpack(prefix, status) != 0) |
| 942 | { |
| 943 | return responseReqDataLenInvalid(); |
| 944 | } |
| 945 | unpackFinal(req); |
Johnathan Mantey | 4a15685 | 2019-12-11 13:47:43 -0800 | [diff] [blame] | 946 | if (rsvd) |
| 947 | { |
| 948 | return responseInvalidFieldRequest(); |
| 949 | } |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 950 | if (enabled) |
| 951 | { |
Jiaqing Zhao | 6d4a44e | 2022-01-24 15:04:00 +0800 | [diff] [blame] | 952 | if (prefix < MIN_IPV6_PREFIX_LENGTH || |
| 953 | prefix > MAX_IPV6_PREFIX_LENGTH) |
| 954 | { |
| 955 | return responseParmOutOfRange(); |
| 956 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 957 | channelCall<reconfigureIfAddr6>(channel, set, ip, prefix); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 958 | } |
| 959 | else |
| 960 | { |
| 961 | channelCall<deconfigureIfAddr6>(channel, set); |
| 962 | } |
| 963 | return responseSuccess(); |
| 964 | } |
| 965 | case LanParam::IPv6DynamicAddresses: |
| 966 | { |
| 967 | req.trailingOk = true; |
| 968 | return response(ccParamReadOnly); |
| 969 | } |
| 970 | case LanParam::IPv6RouterControl: |
| 971 | { |
| 972 | std::bitset<8> control; |
Johnathan Mantey | 3b7a407 | 2021-01-26 14:24:53 -0800 | [diff] [blame] | 973 | constexpr uint8_t reservedRACCBits = 0xfc; |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 974 | if (req.unpack(control) != 0) |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 975 | { |
| 976 | return responseReqDataLenInvalid(); |
| 977 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 978 | unpackFinal(req); |
Johnathan Mantey | 3b7a407 | 2021-01-26 14:24:53 -0800 | [diff] [blame] | 979 | if (std::bitset<8> expected(control & |
| 980 | std::bitset<8>(reservedRACCBits)); |
| 981 | expected.any()) |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 982 | { |
Johnathan Mantey | 3b7a407 | 2021-01-26 14:24:53 -0800 | [diff] [blame] | 983 | return response(ccParamNotSupported); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 984 | } |
Johnathan Mantey | 3b7a407 | 2021-01-26 14:24:53 -0800 | [diff] [blame] | 985 | |
| 986 | bool enableRA = control[IPv6RouterControlFlag::Dynamic]; |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 987 | channelCall<setEthProp<bool>>(channel, "IPv6AcceptRA", enableRA); |
| 988 | channelCall<setEthProp<bool>>(channel, "DHCP6", enableRA); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 989 | return responseSuccess(); |
| 990 | } |
| 991 | case LanParam::IPv6StaticRouter1IP: |
| 992 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 993 | auto gateway = unpackT<stdplus::In6Addr>(req); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 994 | unpackFinal(req); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 995 | channelCall<setGatewayProperty<AF_INET6>>(channel, gateway); |
| 996 | return responseSuccess(); |
| 997 | } |
| 998 | case LanParam::IPv6StaticRouter1MAC: |
| 999 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1000 | auto mac = unpackT<stdplus::EtherAddr>(req); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1001 | unpackFinal(req); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1002 | channelCall<reconfigureGatewayMAC<AF_INET6>>(channel, mac); |
| 1003 | return responseSuccess(); |
| 1004 | } |
| 1005 | case LanParam::IPv6StaticRouter1PrefixLength: |
| 1006 | { |
| 1007 | uint8_t prefix; |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1008 | if (req.unpack(prefix) != 0) |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1009 | { |
| 1010 | return responseReqDataLenInvalid(); |
| 1011 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1012 | unpackFinal(req); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1013 | if (prefix != 0) |
| 1014 | { |
| 1015 | return responseInvalidFieldRequest(); |
| 1016 | } |
| 1017 | return responseSuccess(); |
| 1018 | } |
| 1019 | case LanParam::IPv6StaticRouter1PrefixValue: |
| 1020 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1021 | unpackT<stdplus::In6Addr>(req); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1022 | unpackFinal(req); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1023 | // Accept any prefix value since our prefix length has to be 0 |
| 1024 | return responseSuccess(); |
| 1025 | } |
jayaprakash Mutyala | b741b99 | 2019-12-02 17:29:09 +0000 | [diff] [blame] | 1026 | case LanParam::cipherSuitePrivilegeLevels: |
| 1027 | { |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1028 | uint8_t rsvd; |
jayaprakash Mutyala | b741b99 | 2019-12-02 17:29:09 +0000 | [diff] [blame] | 1029 | std::array<uint4_t, ipmi::maxCSRecords> cipherSuitePrivs; |
| 1030 | |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1031 | if (req.unpack(rsvd, cipherSuitePrivs)) |
jayaprakash Mutyala | b741b99 | 2019-12-02 17:29:09 +0000 | [diff] [blame] | 1032 | { |
| 1033 | return responseReqDataLenInvalid(); |
| 1034 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1035 | unpackFinal(req); |
jayaprakash Mutyala | b741b99 | 2019-12-02 17:29:09 +0000 | [diff] [blame] | 1036 | |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1037 | if (rsvd) |
jayaprakash Mutyala | b741b99 | 2019-12-02 17:29:09 +0000 | [diff] [blame] | 1038 | { |
| 1039 | return responseInvalidFieldRequest(); |
| 1040 | } |
| 1041 | |
Patrick Williams | fbc6c9d | 2023-05-10 07:50:16 -0500 | [diff] [blame] | 1042 | uint8_t resp = getCipherConfigObject(csPrivFileName, |
| 1043 | csPrivDefaultFileName) |
| 1044 | .setCSPrivilegeLevels(channel, cipherSuitePrivs); |
jayaprakash Mutyala | b741b99 | 2019-12-02 17:29:09 +0000 | [diff] [blame] | 1045 | if (!resp) |
| 1046 | { |
| 1047 | return responseSuccess(); |
| 1048 | } |
| 1049 | else |
| 1050 | { |
| 1051 | req.trailingOk = true; |
| 1052 | return response(resp); |
| 1053 | } |
| 1054 | } |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 1055 | } |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 1056 | |
PavanKumarIntel | 3771f5f | 2023-11-02 06:26:42 +0000 | [diff] [blame] | 1057 | if (parameter >= oemCmdStart) |
Johnathan Mantey | b87034e | 2019-09-16 10:50:50 -0700 | [diff] [blame] | 1058 | { |
| 1059 | return setLanOem(channel, parameter, req); |
| 1060 | } |
| 1061 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1062 | req.trailingOk = true; |
| 1063 | return response(ccParamNotSupported); |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 1064 | } |
| 1065 | |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1066 | RspType<> setLan(Context::ptr ctx, uint4_t channelBits, uint4_t reserved1, |
| 1067 | uint8_t parameter, message::Payload& req) |
| 1068 | { |
| 1069 | try |
| 1070 | { |
| 1071 | return setLanInt(ctx, channelBits, reserved1, parameter, req); |
| 1072 | } |
| 1073 | catch (ipmi::Cc cc) |
| 1074 | { |
| 1075 | return response(cc); |
| 1076 | } |
| 1077 | catch (const sdbusplus::exception_t& e) |
| 1078 | { |
| 1079 | if (std::string_view{InvalidArgument::errName} == e.name()) |
| 1080 | { |
| 1081 | return responseInvalidFieldRequest(); |
| 1082 | } |
| 1083 | throw; |
| 1084 | } |
| 1085 | } |
| 1086 | |
vijayabharathix shetty | cc76925 | 2020-02-27 17:52:20 +0000 | [diff] [blame] | 1087 | RspType<message::Payload> getLan(Context::ptr ctx, uint4_t channelBits, |
| 1088 | uint3_t reserved, bool revOnly, |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1089 | uint8_t parameter, uint8_t set, uint8_t block) |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 1090 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1091 | message::Payload ret; |
| 1092 | constexpr uint8_t current_revision = 0x11; |
| 1093 | ret.pack(current_revision); |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 1094 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1095 | if (revOnly) |
Suryakanth Sekar | e405440 | 2019-08-08 15:16:52 +0530 | [diff] [blame] | 1096 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1097 | return responseSuccess(std::move(ret)); |
Suryakanth Sekar | e405440 | 2019-08-08 15:16:52 +0530 | [diff] [blame] | 1098 | } |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 1099 | |
vijayabharathix shetty | cc76925 | 2020-02-27 17:52:20 +0000 | [diff] [blame] | 1100 | const uint8_t channel = convertCurrentChannelNum( |
| 1101 | static_cast<uint8_t>(channelBits), ctx->channel); |
| 1102 | if (reserved || !isValidChannel(channel)) |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 1103 | { |
vijayabharathix shetty | cc76925 | 2020-02-27 17:52:20 +0000 | [diff] [blame] | 1104 | log<level::ERR>("Get Lan - Invalid field in request"); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1105 | return responseInvalidFieldRequest(); |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 1106 | } |
| 1107 | |
Jian Zhang | cf19d14 | 2023-07-31 10:22:53 +0800 | [diff] [blame] | 1108 | if (!isLanChannel(channel).value_or(false)) |
| 1109 | { |
| 1110 | log<level::ERR>("Set Lan - Not a LAN channel"); |
| 1111 | return responseInvalidFieldRequest(); |
| 1112 | } |
| 1113 | |
Johnathan Mantey | affadb5 | 2019-10-07 10:13:53 -0700 | [diff] [blame] | 1114 | static std::vector<uint8_t> cipherList; |
| 1115 | static bool listInit = false; |
| 1116 | if (!listInit) |
| 1117 | { |
| 1118 | try |
| 1119 | { |
| 1120 | cipherList = cipher::getCipherList(); |
| 1121 | listInit = true; |
| 1122 | } |
| 1123 | catch (const std::exception& e) |
Patrick Williams | fbc6c9d | 2023-05-10 07:50:16 -0500 | [diff] [blame] | 1124 | {} |
Johnathan Mantey | affadb5 | 2019-10-07 10:13:53 -0700 | [diff] [blame] | 1125 | } |
| 1126 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1127 | switch (static_cast<LanParam>(parameter)) |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 1128 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1129 | case LanParam::SetStatus: |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 1130 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1131 | SetStatus status; |
| 1132 | try |
| 1133 | { |
| 1134 | status = setStatus.at(channel); |
| 1135 | } |
| 1136 | catch (const std::out_of_range&) |
| 1137 | { |
| 1138 | status = SetStatus::Complete; |
| 1139 | } |
William A. Kennington III | 7a0e5df | 2021-05-19 13:31:29 -0700 | [diff] [blame] | 1140 | ret.pack(types::enum_cast<uint2_t>(status), uint6_t{}); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1141 | return responseSuccess(std::move(ret)); |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 1142 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1143 | case LanParam::AuthSupport: |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 1144 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1145 | std::bitset<6> support; |
| 1146 | ret.pack(support, uint2_t{}); |
| 1147 | return responseSuccess(std::move(ret)); |
Tom Joseph | a30c8d3 | 2018-03-22 02:15:03 +0530 | [diff] [blame] | 1148 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1149 | case LanParam::AuthEnables: |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 1150 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1151 | std::bitset<6> enables; |
| 1152 | ret.pack(enables, uint2_t{}); // Callback |
| 1153 | ret.pack(enables, uint2_t{}); // User |
| 1154 | ret.pack(enables, uint2_t{}); // Operator |
| 1155 | ret.pack(enables, uint2_t{}); // Admin |
| 1156 | ret.pack(enables, uint2_t{}); // OEM |
| 1157 | return responseSuccess(std::move(ret)); |
William A. Kennington III | 39f94ef | 2018-11-19 22:36:16 -0800 | [diff] [blame] | 1158 | } |
William A. Kennington III | aab2023 | 2018-11-19 18:20:39 -0800 | [diff] [blame] | 1159 | case LanParam::IP: |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1160 | { |
| 1161 | auto ifaddr = channelCall<getIfAddr4>(channel); |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1162 | stdplus::In4Addr addr{}; |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1163 | if (ifaddr) |
| 1164 | { |
| 1165 | addr = ifaddr->address; |
| 1166 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1167 | ret.pack(stdplus::raw::asView<char>(addr)); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1168 | return responseSuccess(std::move(ret)); |
| 1169 | } |
| 1170 | case LanParam::IPSrc: |
| 1171 | { |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 1172 | auto src = channelCall<getEthProp<bool>>(channel, "DHCP4") |
| 1173 | ? IPSrc::DHCP |
| 1174 | : IPSrc::Static; |
William A. Kennington III | 7a0e5df | 2021-05-19 13:31:29 -0700 | [diff] [blame] | 1175 | ret.pack(types::enum_cast<uint4_t>(src), uint4_t{}); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1176 | return responseSuccess(std::move(ret)); |
| 1177 | } |
William A. Kennington III | aab2023 | 2018-11-19 18:20:39 -0800 | [diff] [blame] | 1178 | case LanParam::MAC: |
William A. Kennington III | 39f94ef | 2018-11-19 22:36:16 -0800 | [diff] [blame] | 1179 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1180 | auto mac = channelCall<getMACProperty>(channel); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1181 | ret.pack(stdplus::raw::asView<char>(mac)); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1182 | return responseSuccess(std::move(ret)); |
| 1183 | } |
| 1184 | case LanParam::SubnetMask: |
| 1185 | { |
| 1186 | auto ifaddr = channelCall<getIfAddr4>(channel); |
| 1187 | uint8_t prefix = AddrFamily<AF_INET>::defaultPrefix; |
| 1188 | if (ifaddr) |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 1189 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1190 | prefix = ifaddr->prefix; |
| 1191 | } |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1192 | auto netmask = stdplus::pfxToMask<stdplus::In4Addr>(prefix); |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1193 | ret.pack(stdplus::raw::asView<char>(netmask)); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1194 | return responseSuccess(std::move(ret)); |
| 1195 | } |
| 1196 | case LanParam::Gateway1: |
| 1197 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1198 | auto gateway = channelCall<getGatewayProperty<AF_INET>>(channel); |
| 1199 | ret.pack(stdplus::raw::asView<char>( |
| 1200 | gateway.value_or(stdplus::In4Addr{}))); |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1201 | return responseSuccess(std::move(ret)); |
| 1202 | } |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 1203 | case LanParam::Gateway1MAC: |
| 1204 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1205 | stdplus::EtherAddr mac{}; |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 1206 | auto neighbor = channelCall<getGatewayNeighbor<AF_INET>>(channel); |
| 1207 | if (neighbor) |
| 1208 | { |
| 1209 | mac = neighbor->mac; |
| 1210 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1211 | ret.pack(stdplus::raw::asView<char>(mac)); |
William A. Kennington III | 4bbc3db | 2019-04-15 00:02:10 -0700 | [diff] [blame] | 1212 | return responseSuccess(std::move(ret)); |
| 1213 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1214 | case LanParam::VLANId: |
| 1215 | { |
| 1216 | uint16_t vlan = channelCall<getVLANProperty>(channel); |
| 1217 | if (vlan != 0) |
| 1218 | { |
| 1219 | vlan |= VLAN_ENABLE_FLAG; |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 1220 | } |
| 1221 | else |
| 1222 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1223 | vlan = lastDisabledVlan[channel]; |
Ratan Gupta | b8e9955 | 2017-07-27 07:07:48 +0530 | [diff] [blame] | 1224 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1225 | ret.pack(vlan); |
| 1226 | return responseSuccess(std::move(ret)); |
Adriana Kobylak | 342df10 | 2016-02-10 13:48:16 -0600 | [diff] [blame] | 1227 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1228 | case LanParam::CiphersuiteSupport: |
Johnathan Mantey | affadb5 | 2019-10-07 10:13:53 -0700 | [diff] [blame] | 1229 | { |
srikanta mondal | 1d8579c | 2020-04-15 17:13:25 +0000 | [diff] [blame] | 1230 | if (getChannelSessionSupport(channel) == |
| 1231 | EChannelSessSupported::none) |
| 1232 | { |
| 1233 | return responseInvalidFieldRequest(); |
| 1234 | } |
Johnathan Mantey | affadb5 | 2019-10-07 10:13:53 -0700 | [diff] [blame] | 1235 | if (!listInit) |
| 1236 | { |
| 1237 | return responseUnspecifiedError(); |
| 1238 | } |
| 1239 | ret.pack(static_cast<uint8_t>(cipherList.size() - 1)); |
| 1240 | return responseSuccess(std::move(ret)); |
| 1241 | } |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1242 | case LanParam::CiphersuiteEntries: |
Johnathan Mantey | affadb5 | 2019-10-07 10:13:53 -0700 | [diff] [blame] | 1243 | { |
srikanta mondal | 1d8579c | 2020-04-15 17:13:25 +0000 | [diff] [blame] | 1244 | if (getChannelSessionSupport(channel) == |
| 1245 | EChannelSessSupported::none) |
| 1246 | { |
| 1247 | return responseInvalidFieldRequest(); |
| 1248 | } |
Johnathan Mantey | affadb5 | 2019-10-07 10:13:53 -0700 | [diff] [blame] | 1249 | if (!listInit) |
| 1250 | { |
| 1251 | return responseUnspecifiedError(); |
| 1252 | } |
| 1253 | ret.pack(cipherList); |
| 1254 | return responseSuccess(std::move(ret)); |
| 1255 | } |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1256 | case LanParam::IPFamilySupport: |
| 1257 | { |
| 1258 | std::bitset<8> support; |
| 1259 | support[IPFamilySupportFlag::IPv6Only] = 0; |
| 1260 | support[IPFamilySupportFlag::DualStack] = 1; |
| 1261 | support[IPFamilySupportFlag::IPv6Alerts] = 1; |
| 1262 | ret.pack(support); |
| 1263 | return responseSuccess(std::move(ret)); |
| 1264 | } |
| 1265 | case LanParam::IPFamilyEnables: |
| 1266 | { |
| 1267 | ret.pack(static_cast<uint8_t>(IPFamilyEnables::DualStack)); |
| 1268 | return responseSuccess(std::move(ret)); |
| 1269 | } |
| 1270 | case LanParam::IPv6Status: |
| 1271 | { |
| 1272 | ret.pack(MAX_IPV6_STATIC_ADDRESSES); |
| 1273 | ret.pack(MAX_IPV6_DYNAMIC_ADDRESSES); |
| 1274 | std::bitset<8> support; |
| 1275 | support[IPv6StatusFlag::DHCP] = 1; |
| 1276 | support[IPv6StatusFlag::SLAAC] = 1; |
| 1277 | ret.pack(support); |
| 1278 | return responseSuccess(std::move(ret)); |
| 1279 | } |
| 1280 | case LanParam::IPv6StaticAddresses: |
| 1281 | { |
| 1282 | if (set >= MAX_IPV6_STATIC_ADDRESSES) |
| 1283 | { |
| 1284 | return responseParmOutOfRange(); |
| 1285 | } |
| 1286 | getLanIPv6Address(ret, channel, set, originsV6Static); |
| 1287 | return responseSuccess(std::move(ret)); |
| 1288 | } |
| 1289 | case LanParam::IPv6DynamicAddresses: |
| 1290 | { |
| 1291 | if (set >= MAX_IPV6_DYNAMIC_ADDRESSES) |
| 1292 | { |
| 1293 | return responseParmOutOfRange(); |
| 1294 | } |
| 1295 | getLanIPv6Address(ret, channel, set, originsV6Dynamic); |
| 1296 | return responseSuccess(std::move(ret)); |
| 1297 | } |
| 1298 | case LanParam::IPv6RouterControl: |
| 1299 | { |
| 1300 | std::bitset<8> control; |
Johnathan Mantey | 3b7a407 | 2021-01-26 14:24:53 -0800 | [diff] [blame] | 1301 | control[IPv6RouterControlFlag::Dynamic] = |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 1302 | channelCall<getEthProp<bool>>(channel, "IPv6AcceptRA"); |
Johnathan Mantey | 3b7a407 | 2021-01-26 14:24:53 -0800 | [diff] [blame] | 1303 | control[IPv6RouterControlFlag::Static] = 1; |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1304 | ret.pack(control); |
| 1305 | return responseSuccess(std::move(ret)); |
| 1306 | } |
| 1307 | case LanParam::IPv6StaticRouter1IP: |
| 1308 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1309 | stdplus::In6Addr gateway{}; |
William A. Kennington III | a8a2e5f | 2023-06-21 17:50:01 -0700 | [diff] [blame] | 1310 | if (!channelCall<getEthProp<bool>>(channel, "IPv6AcceptRA")) |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1311 | { |
| 1312 | gateway = |
| 1313 | channelCall<getGatewayProperty<AF_INET6>>(channel).value_or( |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1314 | stdplus::In6Addr{}); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1315 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1316 | ret.pack(stdplus::raw::asView<char>(gateway)); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1317 | return responseSuccess(std::move(ret)); |
| 1318 | } |
| 1319 | case LanParam::IPv6StaticRouter1MAC: |
| 1320 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1321 | stdplus::EtherAddr mac{}; |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1322 | auto neighbor = channelCall<getGatewayNeighbor<AF_INET6>>(channel); |
| 1323 | if (neighbor) |
| 1324 | { |
| 1325 | mac = neighbor->mac; |
| 1326 | } |
William A. Kennington III | 7a3831b | 2023-06-21 01:10:49 -0700 | [diff] [blame] | 1327 | ret.pack(stdplus::raw::asView<char>(mac)); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1328 | return responseSuccess(std::move(ret)); |
| 1329 | } |
| 1330 | case LanParam::IPv6StaticRouter1PrefixLength: |
| 1331 | { |
Jian Zhang | 796e824 | 2024-02-01 14:07:34 +0800 | [diff] [blame] | 1332 | ret.pack(uint8_t{0}); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1333 | return responseSuccess(std::move(ret)); |
| 1334 | } |
| 1335 | case LanParam::IPv6StaticRouter1PrefixValue: |
| 1336 | { |
William A. Kennington III | 726f2bd | 2023-06-21 01:11:40 -0700 | [diff] [blame] | 1337 | ret.pack(stdplus::raw::asView<char>(stdplus::In6Addr{})); |
William A. Kennington III | 16064aa | 2019-04-13 17:44:53 -0700 | [diff] [blame] | 1338 | return responseSuccess(std::move(ret)); |
| 1339 | } |
jayaprakash Mutyala | b741b99 | 2019-12-02 17:29:09 +0000 | [diff] [blame] | 1340 | case LanParam::cipherSuitePrivilegeLevels: |
| 1341 | { |
| 1342 | std::array<uint4_t, ipmi::maxCSRecords> csPrivilegeLevels; |
| 1343 | |
| 1344 | uint8_t resp = |
| 1345 | getCipherConfigObject(csPrivFileName, csPrivDefaultFileName) |
| 1346 | .getCSPrivilegeLevels(channel, csPrivilegeLevels); |
| 1347 | if (!resp) |
| 1348 | { |
| 1349 | constexpr uint8_t reserved1 = 0x00; |
| 1350 | ret.pack(reserved1, csPrivilegeLevels); |
| 1351 | return responseSuccess(std::move(ret)); |
| 1352 | } |
| 1353 | else |
| 1354 | { |
| 1355 | return response(resp); |
| 1356 | } |
| 1357 | } |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 1358 | } |
| 1359 | |
PavanKumarIntel | 3771f5f | 2023-11-02 06:26:42 +0000 | [diff] [blame] | 1360 | if (parameter >= oemCmdStart) |
Johnathan Mantey | b87034e | 2019-09-16 10:50:50 -0700 | [diff] [blame] | 1361 | { |
| 1362 | return getLanOem(channel, parameter, set, block); |
| 1363 | } |
| 1364 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1365 | return response(ccParamNotSupported); |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 1366 | } |
| 1367 | |
Jian Zhang | 23f4465 | 2022-03-17 17:13:10 +0800 | [diff] [blame] | 1368 | constexpr const char* solInterface = "xyz.openbmc_project.Ipmi.SOL"; |
| 1369 | constexpr const char* solPath = "/xyz/openbmc_project/ipmi/sol/"; |
| 1370 | constexpr const uint16_t solDefaultPort = 623; |
| 1371 | |
| 1372 | RspType<> setSolConfParams(Context::ptr ctx, uint4_t channelBits, |
Willy Tu | 11d6889 | 2022-01-20 10:37:34 -0800 | [diff] [blame] | 1373 | uint4_t /*reserved*/, uint8_t parameter, |
Jian Zhang | 23f4465 | 2022-03-17 17:13:10 +0800 | [diff] [blame] | 1374 | message::Payload& req) |
| 1375 | { |
| 1376 | const uint8_t channel = convertCurrentChannelNum( |
| 1377 | static_cast<uint8_t>(channelBits), ctx->channel); |
| 1378 | |
| 1379 | if (!isValidChannel(channel)) |
| 1380 | { |
| 1381 | log<level::ERR>("Set Sol Config - Invalid channel in request"); |
| 1382 | return responseInvalidFieldRequest(); |
| 1383 | } |
| 1384 | |
| 1385 | std::string solService{}; |
| 1386 | std::string solPathWitheEthName = solPath + ipmi::getChannelName(channel); |
| 1387 | |
| 1388 | if (ipmi::getService(ctx, solInterface, solPathWitheEthName, solService)) |
| 1389 | { |
| 1390 | log<level::ERR>("Set Sol Config - Invalid solInterface", |
| 1391 | entry("SERVICE=%s", solService.c_str()), |
| 1392 | entry("OBJPATH=%s", solPathWitheEthName.c_str()), |
| 1393 | entry("INTERFACE=%s", solInterface)); |
| 1394 | return responseInvalidFieldRequest(); |
| 1395 | } |
| 1396 | |
| 1397 | switch (static_cast<SolConfParam>(parameter)) |
| 1398 | { |
| 1399 | case SolConfParam::Progress: |
| 1400 | { |
| 1401 | uint8_t progress; |
| 1402 | if (req.unpack(progress) != 0 || !req.fullyUnpacked()) |
| 1403 | { |
| 1404 | return responseReqDataLenInvalid(); |
| 1405 | } |
| 1406 | |
| 1407 | if (ipmi::setDbusProperty(ctx, solService, solPathWitheEthName, |
| 1408 | solInterface, "Progress", progress)) |
| 1409 | { |
| 1410 | return responseUnspecifiedError(); |
| 1411 | } |
| 1412 | break; |
| 1413 | } |
| 1414 | case SolConfParam::Enable: |
| 1415 | { |
| 1416 | bool enable; |
| 1417 | uint7_t reserved2; |
| 1418 | |
| 1419 | if (req.unpack(enable, reserved2) != 0 || !req.fullyUnpacked()) |
| 1420 | { |
| 1421 | return responseReqDataLenInvalid(); |
| 1422 | } |
| 1423 | |
| 1424 | if (ipmi::setDbusProperty(ctx, solService, solPathWitheEthName, |
| 1425 | solInterface, "Enable", enable)) |
| 1426 | { |
| 1427 | return responseUnspecifiedError(); |
| 1428 | } |
| 1429 | break; |
| 1430 | } |
| 1431 | case SolConfParam::Authentication: |
| 1432 | { |
| 1433 | uint4_t privilegeBits{}; |
| 1434 | uint2_t reserved2{}; |
| 1435 | bool forceAuth = false; |
| 1436 | bool forceEncrypt = false; |
| 1437 | |
| 1438 | if (req.unpack(privilegeBits, reserved2, forceAuth, forceEncrypt) != |
| 1439 | 0 || |
| 1440 | !req.fullyUnpacked()) |
| 1441 | { |
| 1442 | return responseReqDataLenInvalid(); |
| 1443 | } |
| 1444 | |
| 1445 | uint8_t privilege = static_cast<uint8_t>(privilegeBits); |
Jonathan Doman | a48bf77 | 2023-05-26 17:54:57 -0700 | [diff] [blame] | 1446 | if (privilege < static_cast<uint8_t>(Privilege::User) || |
Jian Zhang | 23f4465 | 2022-03-17 17:13:10 +0800 | [diff] [blame] | 1447 | privilege > static_cast<uint8_t>(Privilege::Oem)) |
| 1448 | { |
| 1449 | return ipmi::responseInvalidFieldRequest(); |
| 1450 | } |
| 1451 | |
| 1452 | if (ipmi::setDbusProperty(ctx, solService, solPathWitheEthName, |
| 1453 | solInterface, "Privilege", privilege)) |
| 1454 | { |
| 1455 | return responseUnspecifiedError(); |
| 1456 | } |
| 1457 | |
| 1458 | if (ipmi::setDbusProperty(ctx, solService, solPathWitheEthName, |
| 1459 | solInterface, "ForceEncryption", |
| 1460 | forceEncrypt)) |
| 1461 | { |
| 1462 | return responseUnspecifiedError(); |
| 1463 | } |
| 1464 | |
| 1465 | if (ipmi::setDbusProperty(ctx, solService, solPathWitheEthName, |
| 1466 | solInterface, "ForceAuthentication", |
| 1467 | forceAuth)) |
| 1468 | { |
| 1469 | return responseUnspecifiedError(); |
| 1470 | } |
| 1471 | break; |
| 1472 | } |
| 1473 | case SolConfParam::Accumulate: |
| 1474 | { |
| 1475 | uint8_t interval; |
| 1476 | uint8_t threshold; |
| 1477 | if (req.unpack(interval, threshold) != 0 || !req.fullyUnpacked()) |
| 1478 | { |
| 1479 | return responseReqDataLenInvalid(); |
| 1480 | } |
| 1481 | |
| 1482 | if (threshold == 0) |
| 1483 | { |
| 1484 | return responseInvalidFieldRequest(); |
| 1485 | } |
| 1486 | |
| 1487 | if (ipmi::setDbusProperty(ctx, solService, solPathWitheEthName, |
| 1488 | solInterface, "AccumulateIntervalMS", |
| 1489 | interval)) |
| 1490 | { |
| 1491 | return responseUnspecifiedError(); |
| 1492 | } |
| 1493 | |
| 1494 | if (ipmi::setDbusProperty(ctx, solService, solPathWitheEthName, |
| 1495 | solInterface, "Threshold", threshold)) |
| 1496 | { |
| 1497 | return responseUnspecifiedError(); |
| 1498 | } |
| 1499 | break; |
| 1500 | } |
| 1501 | case SolConfParam::Retry: |
| 1502 | { |
| 1503 | uint3_t countBits; |
| 1504 | uint5_t reserved2; |
| 1505 | uint8_t interval; |
| 1506 | |
| 1507 | if (req.unpack(countBits, reserved2, interval) != 0 || |
| 1508 | !req.fullyUnpacked()) |
| 1509 | { |
| 1510 | return responseReqDataLenInvalid(); |
| 1511 | } |
| 1512 | |
| 1513 | uint8_t count = static_cast<uint8_t>(countBits); |
| 1514 | if (ipmi::setDbusProperty(ctx, solService, solPathWitheEthName, |
| 1515 | solInterface, "RetryCount", count)) |
| 1516 | { |
| 1517 | return responseUnspecifiedError(); |
| 1518 | } |
| 1519 | |
| 1520 | if (ipmi::setDbusProperty(ctx, solService, solPathWitheEthName, |
| 1521 | solInterface, "RetryIntervalMS", |
| 1522 | interval)) |
| 1523 | { |
| 1524 | return responseUnspecifiedError(); |
| 1525 | } |
| 1526 | break; |
| 1527 | } |
| 1528 | case SolConfParam::Port: |
| 1529 | { |
| 1530 | return response(ipmiCCWriteReadParameter); |
| 1531 | } |
| 1532 | case SolConfParam::NonVbitrate: |
| 1533 | case SolConfParam::Vbitrate: |
| 1534 | case SolConfParam::Channel: |
| 1535 | default: |
| 1536 | return response(ipmiCCParamNotSupported); |
| 1537 | } |
| 1538 | return responseSuccess(); |
| 1539 | } |
| 1540 | |
| 1541 | RspType<message::Payload> getSolConfParams(Context::ptr ctx, |
| 1542 | uint4_t channelBits, |
Willy Tu | 11d6889 | 2022-01-20 10:37:34 -0800 | [diff] [blame] | 1543 | uint3_t /*reserved*/, bool revOnly, |
| 1544 | uint8_t parameter, uint8_t /*set*/, |
| 1545 | uint8_t /*block*/) |
Jian Zhang | 23f4465 | 2022-03-17 17:13:10 +0800 | [diff] [blame] | 1546 | { |
| 1547 | message::Payload ret; |
| 1548 | constexpr uint8_t current_revision = 0x11; |
| 1549 | ret.pack(current_revision); |
| 1550 | if (revOnly) |
| 1551 | { |
| 1552 | return responseSuccess(std::move(ret)); |
| 1553 | } |
| 1554 | |
| 1555 | const uint8_t channel = convertCurrentChannelNum( |
| 1556 | static_cast<uint8_t>(channelBits), ctx->channel); |
| 1557 | |
| 1558 | if (!isValidChannel(channel)) |
| 1559 | { |
| 1560 | log<level::ERR>("Get Sol Config - Invalid channel in request"); |
| 1561 | return responseInvalidFieldRequest(); |
| 1562 | } |
| 1563 | |
| 1564 | std::string solService{}; |
| 1565 | std::string solPathWitheEthName = solPath + ipmi::getChannelName(channel); |
| 1566 | |
| 1567 | if (ipmi::getService(ctx, solInterface, solPathWitheEthName, solService)) |
| 1568 | { |
| 1569 | log<level::ERR>("Set Sol Config - Invalid solInterface", |
| 1570 | entry("SERVICE=%s", solService.c_str()), |
| 1571 | entry("OBJPATH=%s", solPathWitheEthName.c_str()), |
| 1572 | entry("INTERFACE=%s", solInterface)); |
| 1573 | return responseInvalidFieldRequest(); |
| 1574 | } |
| 1575 | |
| 1576 | switch (static_cast<SolConfParam>(parameter)) |
| 1577 | { |
| 1578 | case SolConfParam::Progress: |
| 1579 | { |
| 1580 | uint8_t progress; |
| 1581 | if (ipmi::getDbusProperty(ctx, solService, solPathWitheEthName, |
| 1582 | solInterface, "Progress", progress)) |
| 1583 | { |
| 1584 | return responseUnspecifiedError(); |
| 1585 | } |
| 1586 | ret.pack(progress); |
| 1587 | return responseSuccess(std::move(ret)); |
| 1588 | } |
| 1589 | case SolConfParam::Enable: |
| 1590 | { |
| 1591 | bool enable{}; |
| 1592 | if (ipmi::getDbusProperty(ctx, solService, solPathWitheEthName, |
| 1593 | solInterface, "Enable", enable)) |
| 1594 | { |
| 1595 | return responseUnspecifiedError(); |
| 1596 | } |
| 1597 | ret.pack(enable, uint7_t{}); |
| 1598 | return responseSuccess(std::move(ret)); |
| 1599 | } |
| 1600 | case SolConfParam::Authentication: |
| 1601 | { |
| 1602 | // 4bits, cast when pack |
| 1603 | uint8_t privilege; |
| 1604 | bool forceAuth = false; |
| 1605 | bool forceEncrypt = false; |
| 1606 | |
| 1607 | if (ipmi::getDbusProperty(ctx, solService, solPathWitheEthName, |
| 1608 | solInterface, "Privilege", privilege)) |
| 1609 | { |
| 1610 | return responseUnspecifiedError(); |
| 1611 | } |
| 1612 | |
| 1613 | if (ipmi::getDbusProperty(ctx, solService, solPathWitheEthName, |
| 1614 | solInterface, "ForceAuthentication", |
| 1615 | forceAuth)) |
| 1616 | { |
| 1617 | return responseUnspecifiedError(); |
| 1618 | } |
| 1619 | |
| 1620 | if (ipmi::getDbusProperty(ctx, solService, solPathWitheEthName, |
| 1621 | solInterface, "ForceEncryption", |
| 1622 | forceEncrypt)) |
| 1623 | { |
| 1624 | return responseUnspecifiedError(); |
| 1625 | } |
| 1626 | ret.pack(uint4_t{privilege}, uint2_t{}, forceAuth, forceEncrypt); |
| 1627 | return responseSuccess(std::move(ret)); |
| 1628 | } |
| 1629 | case SolConfParam::Accumulate: |
| 1630 | { |
| 1631 | uint8_t interval{}, threshold{}; |
| 1632 | |
| 1633 | if (ipmi::getDbusProperty(ctx, solService, solPathWitheEthName, |
| 1634 | solInterface, "AccumulateIntervalMS", |
| 1635 | interval)) |
| 1636 | { |
| 1637 | return responseUnspecifiedError(); |
| 1638 | } |
| 1639 | |
| 1640 | if (ipmi::getDbusProperty(ctx, solService, solPathWitheEthName, |
| 1641 | solInterface, "Threshold", threshold)) |
| 1642 | { |
| 1643 | return responseUnspecifiedError(); |
| 1644 | } |
| 1645 | ret.pack(interval, threshold); |
| 1646 | return responseSuccess(std::move(ret)); |
| 1647 | } |
| 1648 | case SolConfParam::Retry: |
| 1649 | { |
| 1650 | // 3bits, cast when cast |
| 1651 | uint8_t count{}; |
| 1652 | uint8_t interval{}; |
| 1653 | |
| 1654 | if (ipmi::getDbusProperty(ctx, solService, solPathWitheEthName, |
| 1655 | solInterface, "RetryCount", count)) |
| 1656 | { |
| 1657 | return responseUnspecifiedError(); |
| 1658 | } |
| 1659 | |
| 1660 | if (ipmi::getDbusProperty(ctx, solService, solPathWitheEthName, |
| 1661 | solInterface, "RetryIntervalMS", |
| 1662 | interval)) |
| 1663 | { |
| 1664 | return responseUnspecifiedError(); |
| 1665 | } |
| 1666 | ret.pack(uint3_t{count}, uint5_t{}, interval); |
| 1667 | return responseSuccess(std::move(ret)); |
| 1668 | } |
| 1669 | case SolConfParam::Port: |
| 1670 | { |
| 1671 | auto port = solDefaultPort; |
| 1672 | ret.pack(static_cast<uint16_t>(port)); |
| 1673 | return responseSuccess(std::move(ret)); |
| 1674 | } |
| 1675 | case SolConfParam::Channel: |
| 1676 | { |
| 1677 | ret.pack(channel); |
| 1678 | return responseSuccess(std::move(ret)); |
| 1679 | } |
| 1680 | case SolConfParam::NonVbitrate: |
Jonathan Doman | a48bf77 | 2023-05-26 17:54:57 -0700 | [diff] [blame] | 1681 | { |
| 1682 | uint64_t baudRate; |
| 1683 | uint8_t encodedBitRate = 0; |
| 1684 | if (ipmi::getDbusProperty( |
| 1685 | ctx, "xyz.openbmc_project.Console.default", |
| 1686 | "/xyz/openbmc_project/console/default", |
| 1687 | "xyz.openbmc_project.Console.UART", "Baud", baudRate)) |
| 1688 | { |
| 1689 | return ipmi::responseUnspecifiedError(); |
| 1690 | } |
| 1691 | switch (baudRate) |
| 1692 | { |
| 1693 | case 9600: |
| 1694 | encodedBitRate = 0x06; |
| 1695 | break; |
| 1696 | case 19200: |
| 1697 | encodedBitRate = 0x07; |
| 1698 | break; |
| 1699 | case 38400: |
| 1700 | encodedBitRate = 0x08; |
| 1701 | break; |
| 1702 | case 57600: |
| 1703 | encodedBitRate = 0x09; |
| 1704 | break; |
| 1705 | case 115200: |
| 1706 | encodedBitRate = 0x0a; |
| 1707 | break; |
| 1708 | default: |
| 1709 | break; |
| 1710 | } |
| 1711 | ret.pack(encodedBitRate); |
| 1712 | return responseSuccess(std::move(ret)); |
| 1713 | } |
Jian Zhang | 23f4465 | 2022-03-17 17:13:10 +0800 | [diff] [blame] | 1714 | case SolConfParam::Vbitrate: |
| 1715 | default: |
| 1716 | return response(ipmiCCParamNotSupported); |
| 1717 | } |
| 1718 | |
| 1719 | return response(ccParamNotSupported); |
| 1720 | } |
| 1721 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1722 | } // namespace transport |
| 1723 | } // namespace ipmi |
Ratan Gupta | 1247e0b | 2018-03-07 10:47:25 +0530 | [diff] [blame] | 1724 | |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1725 | void register_netfn_transport_functions() __attribute__((constructor)); |
Ratan Gupta | 1247e0b | 2018-03-07 10:47:25 +0530 | [diff] [blame] | 1726 | |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 1727 | void register_netfn_transport_functions() |
| 1728 | { |
William A. Kennington III | c514d87 | 2019-04-06 18:19:38 -0700 | [diff] [blame] | 1729 | ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnTransport, |
| 1730 | ipmi::transport::cmdSetLanConfigParameters, |
| 1731 | ipmi::Privilege::Admin, ipmi::transport::setLan); |
| 1732 | ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnTransport, |
| 1733 | ipmi::transport::cmdGetLanConfigParameters, |
Johnathan Mantey | 34698d5 | 2019-11-19 14:47:30 -0800 | [diff] [blame] | 1734 | ipmi::Privilege::Operator, ipmi::transport::getLan); |
Jian Zhang | 23f4465 | 2022-03-17 17:13:10 +0800 | [diff] [blame] | 1735 | ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnTransport, |
| 1736 | ipmi::transport::cmdSetSolConfigParameters, |
| 1737 | ipmi::Privilege::Admin, |
| 1738 | ipmi::transport::setSolConfParams); |
| 1739 | ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnTransport, |
| 1740 | ipmi::transport::cmdGetSolConfigParameters, |
| 1741 | ipmi::Privilege::User, |
| 1742 | ipmi::transport::getSolConfParams); |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 1743 | } |