Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 1 | #pragma once |
Jishnu CM | 57dfea9 | 2023-05-05 06:07:26 -0500 | [diff] [blame] | 2 | #include "dhcp_configuration.hpp" |
William A. Kennington III | 9a20a6e | 2022-10-05 13:41:12 -0700 | [diff] [blame] | 3 | #include "ipaddress.hpp" |
| 4 | #include "neighbor.hpp" |
Ratan Gupta | 82549cc | 2017-04-21 08:45:23 +0530 | [diff] [blame] | 5 | #include "types.hpp" |
Ratan Gupta | 82549cc | 2017-04-21 08:45:23 +0530 | [diff] [blame] | 6 | #include "xyz/openbmc_project/Network/IP/Create/server.hpp" |
William A. Kennington III | 0850579 | 2019-01-30 16:00:04 -0800 | [diff] [blame] | 7 | #include "xyz/openbmc_project/Network/Neighbor/CreateStatic/server.hpp" |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 8 | |
| 9 | #include <sdbusplus/bus.hpp> |
| 10 | #include <sdbusplus/server/object.hpp> |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 11 | #include <stdplus/pinned.hpp> |
Jishnu CM | 57dfea9 | 2023-05-05 06:07:26 -0500 | [diff] [blame] | 12 | #include <stdplus/str/maps.hpp> |
William A. Kennington III | be3bd2f | 2022-10-11 14:11:27 -0700 | [diff] [blame] | 13 | #include <stdplus/zstring_view.hpp> |
Patrick Venture | 189d44e | 2018-07-09 12:30:59 -0700 | [diff] [blame] | 14 | #include <xyz/openbmc_project/Collection/DeleteAll/server.hpp> |
| 15 | #include <xyz/openbmc_project/Network/EthernetInterface/server.hpp> |
| 16 | #include <xyz/openbmc_project/Network/MACAddress/server.hpp> |
William A. Kennington III | 09f3a4a | 2022-10-25 02:59:16 -0700 | [diff] [blame] | 17 | #include <xyz/openbmc_project/Network/VLAN/server.hpp> |
| 18 | #include <xyz/openbmc_project/Object/Delete/server.hpp> |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 19 | |
Patrick Williams | 89d734b | 2023-05-10 07:50:25 -0500 | [diff] [blame] | 20 | #include <optional> |
| 21 | #include <string> |
| 22 | #include <vector> |
| 23 | |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 24 | namespace phosphor |
| 25 | { |
| 26 | namespace network |
| 27 | { |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 28 | |
Patrick Williams | c38b071 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 29 | using Ifaces = sdbusplus::server::object_t< |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 30 | sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface, |
| 31 | sdbusplus::xyz::openbmc_project::Network::server::MACAddress, |
| 32 | sdbusplus::xyz::openbmc_project::Network::IP::server::Create, |
William A. Kennington III | 0850579 | 2019-01-30 16:00:04 -0800 | [diff] [blame] | 33 | sdbusplus::xyz::openbmc_project::Network::Neighbor::server::CreateStatic, |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 34 | sdbusplus::xyz::openbmc_project::Collection::server::DeleteAll>; |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 35 | |
William A. Kennington III | 09f3a4a | 2022-10-25 02:59:16 -0700 | [diff] [blame] | 36 | using VlanIfaces = sdbusplus::server::object_t< |
| 37 | sdbusplus::xyz::openbmc_project::Object::server::Delete, |
| 38 | sdbusplus::xyz::openbmc_project::Network::server::VLAN>; |
| 39 | |
| 40 | using VlanIntf = sdbusplus::xyz::openbmc_project::Network::server::VLAN; |
| 41 | |
Ratan Gupta | 82549cc | 2017-04-21 08:45:23 +0530 | [diff] [blame] | 42 | using IP = sdbusplus::xyz::openbmc_project::Network::server::IP; |
Ratan Gupta | 87c1398 | 2017-06-15 09:27:27 +0530 | [diff] [blame] | 43 | |
| 44 | using EthernetInterfaceIntf = |
| 45 | sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface; |
Ratan Gupta | bd303b1 | 2017-08-18 17:10:07 +0530 | [diff] [blame] | 46 | using MacAddressIntf = |
| 47 | sdbusplus::xyz::openbmc_project::Network::server::MACAddress; |
Ratan Gupta | 87c1398 | 2017-06-15 09:27:27 +0530 | [diff] [blame] | 48 | |
Ratan Gupta | 497c0c9 | 2017-08-22 19:15:59 +0530 | [diff] [blame] | 49 | using ServerList = std::vector<std::string>; |
raviteja-b | ce37956 | 2019-03-28 05:59:36 -0500 | [diff] [blame] | 50 | using ObjectPath = sdbusplus::message::object_path; |
Ratan Gupta | 497c0c9 | 2017-08-22 19:15:59 +0530 | [diff] [blame] | 51 | |
William A. Kennington III | 9a20a6e | 2022-10-05 13:41:12 -0700 | [diff] [blame] | 52 | class Manager; |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 53 | |
Ratan Gupta | 47722dc | 2017-05-26 18:32:23 +0530 | [diff] [blame] | 54 | class TestEthernetInterface; |
William A. Kennington III | 09f3a4a | 2022-10-25 02:59:16 -0700 | [diff] [blame] | 55 | class TestNetworkManager; |
Ratan Gupta | 5978dd1 | 2017-07-25 13:47:13 +0530 | [diff] [blame] | 56 | |
William A. Kennington III | 95530ec | 2022-08-19 01:44:39 -0700 | [diff] [blame] | 57 | namespace config |
| 58 | { |
| 59 | class Parser; |
| 60 | } |
William A. Kennington III | d298f93 | 2022-10-17 14:31:38 -0700 | [diff] [blame] | 61 | |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 62 | /** @class EthernetInterface |
| 63 | * @brief OpenBMC Ethernet Interface implementation. |
| 64 | * @details A concrete implementation for the |
| 65 | * xyz.openbmc_project.Network.EthernetInterface DBus API. |
| 66 | */ |
Ratan Gupta | 82549cc | 2017-04-21 08:45:23 +0530 | [diff] [blame] | 67 | class EthernetInterface : public Ifaces |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 68 | { |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 69 | public: |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 70 | EthernetInterface(EthernetInterface&&) = delete; |
| 71 | EthernetInterface& operator=(EthernetInterface&&) = delete; |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 72 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 73 | /** @brief Constructor to put object onto bus at a dbus path. |
| 74 | * @param[in] bus - Bus to attach to. |
William A. Kennington III | d298f93 | 2022-10-17 14:31:38 -0700 | [diff] [blame] | 75 | * @param[in] manager - parent object. |
| 76 | * @param[in] info - Interface information. |
| 77 | * @param[in] objRoot - Path to attach at. |
William A. Kennington III | a520a39 | 2022-08-08 12:17:34 -0700 | [diff] [blame] | 78 | * @param[in] config - The parsed configuation file. |
William A. Kennington III | 09f3a4a | 2022-10-25 02:59:16 -0700 | [diff] [blame] | 79 | * @param[in] vlan - The id of the vlan if configured |
William A. Kennington III | 80d2901 | 2022-11-12 02:31:40 -0800 | [diff] [blame] | 80 | * @param[in] enabled - Determine if systemd-networkd is managing this link |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 81 | */ |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 82 | EthernetInterface(stdplus::PinnedRef<sdbusplus::bus_t> bus, |
| 83 | stdplus::PinnedRef<Manager> manager, |
William A. Kennington III | 13d665c | 2022-11-15 20:34:40 -0800 | [diff] [blame] | 84 | const AllIntfInfo& info, std::string_view objRoot, |
William A. Kennington III | b645254 | 2022-11-15 18:09:12 -0800 | [diff] [blame] | 85 | const config::Parser& config, bool enabled); |
Ratan Gupta | 82549cc | 2017-04-21 08:45:23 +0530 | [diff] [blame] | 86 | |
William A. Kennington III | 59e5b91 | 2022-11-02 02:49:46 -0700 | [diff] [blame] | 87 | /** @brief Network Manager object. */ |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 88 | stdplus::PinnedRef<Manager> manager; |
William A. Kennington III | 59e5b91 | 2022-11-02 02:49:46 -0700 | [diff] [blame] | 89 | |
| 90 | /** @brief Persistent map of IPAddress dbus objects and their names */ |
William A. Kennington III | 9b2a20d | 2023-06-17 14:05:48 -0700 | [diff] [blame] | 91 | std::unordered_map<stdplus::SubnetAny, std::unique_ptr<IPAddress>> addrs; |
William A. Kennington III | 59e5b91 | 2022-11-02 02:49:46 -0700 | [diff] [blame] | 92 | |
William A. Kennington III | 434a943 | 2022-11-04 18:38:46 -0700 | [diff] [blame] | 93 | /** @brief Persistent map of Neighbor dbus objects and their names */ |
William A. Kennington III | 9b2a20d | 2023-06-17 14:05:48 -0700 | [diff] [blame] | 94 | std::unordered_map<stdplus::InAnyAddr, std::unique_ptr<Neighbor>> |
| 95 | staticNeighbors; |
William A. Kennington III | 434a943 | 2022-11-04 18:38:46 -0700 | [diff] [blame] | 96 | |
William A. Kennington III | d6f5340 | 2022-11-07 14:48:53 -0800 | [diff] [blame] | 97 | void addAddr(const AddressInfo& info); |
William A. Kennington III | bc2502c | 2022-11-07 16:31:54 -0800 | [diff] [blame] | 98 | void addStaticNeigh(const NeighborInfo& info); |
William A. Kennington III | d6f5340 | 2022-11-07 14:48:53 -0800 | [diff] [blame] | 99 | |
William A. Kennington III | d298f93 | 2022-10-17 14:31:38 -0700 | [diff] [blame] | 100 | /** @brief Updates the interface information based on new InterfaceInfo */ |
William A. Kennington III | d99e6db | 2022-11-15 20:39:45 -0800 | [diff] [blame] | 101 | void updateInfo(const InterfaceInfo& info, bool skipSignal = false); |
William A. Kennington III | d298f93 | 2022-10-17 14:31:38 -0700 | [diff] [blame] | 102 | |
Asmitha Karunanithi | 003b8b7 | 2022-01-06 04:17:59 -0600 | [diff] [blame] | 103 | /** @brief Function used to load the ntpservers |
| 104 | */ |
| 105 | void loadNTPServers(const config::Parser& config); |
| 106 | |
Manojkiran Eda | acd6dd5 | 2019-10-15 15:00:51 +0530 | [diff] [blame] | 107 | /** @brief Function used to load the nameservers. |
| 108 | */ |
William A. Kennington III | a520a39 | 2022-08-08 12:17:34 -0700 | [diff] [blame] | 109 | void loadNameServers(const config::Parser& config); |
Manojkiran Eda | acd6dd5 | 2019-10-15 15:00:51 +0530 | [diff] [blame] | 110 | |
Patrick Williams | 6aef769 | 2021-05-01 06:39:41 -0500 | [diff] [blame] | 111 | /** @brief Function to create ipAddress dbus object. |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 112 | * @param[in] addressType - Type of ip address. |
Patrick Williams | 6aef769 | 2021-05-01 06:39:41 -0500 | [diff] [blame] | 113 | * @param[in] ipAddress- IP address. |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 114 | * @param[in] prefixLength - Length of prefix. |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 115 | */ |
Ratan Gupta | 82549cc | 2017-04-21 08:45:23 +0530 | [diff] [blame] | 116 | |
Patrick Williams | 6aef769 | 2021-05-01 06:39:41 -0500 | [diff] [blame] | 117 | ObjectPath ip(IP::Protocol addressType, std::string ipAddress, |
William A. Kennington III | e25f8b4 | 2022-10-11 14:43:28 -0700 | [diff] [blame] | 118 | uint8_t prefixLength, std::string) override; |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 119 | |
William A. Kennington III | 0850579 | 2019-01-30 16:00:04 -0800 | [diff] [blame] | 120 | /** @brief Function to create static neighbor dbus object. |
| 121 | * @param[in] ipAddress - IP address. |
| 122 | * @param[in] macAddress - Low level MAC address. |
| 123 | */ |
Patrick Williams | 6aef769 | 2021-05-01 06:39:41 -0500 | [diff] [blame] | 124 | ObjectPath neighbor(std::string ipAddress, std::string macAddress) override; |
William A. Kennington III | 0850579 | 2019-01-30 16:00:04 -0800 | [diff] [blame] | 125 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 126 | /** Set value of DHCPEnabled */ |
William A. Kennington III | 8060c0d | 2022-08-18 19:19:34 -0700 | [diff] [blame] | 127 | DHCPConf dhcpEnabled() const override; |
Patrick Williams | 6aef769 | 2021-05-01 06:39:41 -0500 | [diff] [blame] | 128 | DHCPConf dhcpEnabled(DHCPConf value) override; |
William A. Kennington III | 8060c0d | 2022-08-18 19:19:34 -0700 | [diff] [blame] | 129 | using EthernetInterfaceIntf::dhcp4; |
| 130 | bool dhcp4(bool value) override; |
| 131 | using EthernetInterfaceIntf::dhcp6; |
| 132 | bool dhcp6(bool value) override; |
Ratan Gupta | 87c1398 | 2017-06-15 09:27:27 +0530 | [diff] [blame] | 133 | |
William A. Kennington III | 9b2a20d | 2023-06-17 14:05:48 -0700 | [diff] [blame] | 134 | inline bool dhcpIsEnabled(stdplus::In4Addr) const |
William A. Kennington III | 59e5b91 | 2022-11-02 02:49:46 -0700 | [diff] [blame] | 135 | { |
| 136 | return dhcp4(); |
| 137 | } |
William A. Kennington III | 9b2a20d | 2023-06-17 14:05:48 -0700 | [diff] [blame] | 138 | inline bool dhcpIsEnabled(stdplus::In6Addr) const |
William A. Kennington III | 59e5b91 | 2022-11-02 02:49:46 -0700 | [diff] [blame] | 139 | { |
| 140 | return dhcp6(); |
| 141 | } |
William A. Kennington III | 9b2a20d | 2023-06-17 14:05:48 -0700 | [diff] [blame] | 142 | inline bool dhcpIsEnabled(stdplus::InAnyAddr addr) const |
William A. Kennington III | 59e5b91 | 2022-11-02 02:49:46 -0700 | [diff] [blame] | 143 | { |
| 144 | return std::visit([&](auto v) { return dhcpIsEnabled(v); }, addr); |
| 145 | } |
| 146 | |
Tejas Patil | 2c0fc56 | 2021-08-03 19:13:46 +0530 | [diff] [blame] | 147 | /** Set size of MTU */ |
| 148 | size_t mtu(size_t value) override; |
| 149 | |
Johnathan Mantey | d0679f9 | 2019-10-29 16:20:28 -0700 | [diff] [blame] | 150 | /** Set value of NICEnabled */ |
Patrick Williams | 6aef769 | 2021-05-01 06:39:41 -0500 | [diff] [blame] | 151 | bool nicEnabled(bool value) override; |
Johnathan Mantey | d0679f9 | 2019-10-29 16:20:28 -0700 | [diff] [blame] | 152 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 153 | /** @brief sets the MAC address. |
| 154 | * @param[in] value - MAC address which needs to be set on the system. |
| 155 | * @returns macAddress of the interface or throws an error. |
| 156 | */ |
Patrick Williams | 6aef769 | 2021-05-01 06:39:41 -0500 | [diff] [blame] | 157 | std::string macAddress(std::string value) override; |
Ratan Gupta | bd303b1 | 2017-08-18 17:10:07 +0530 | [diff] [blame] | 158 | |
Johnathan Mantey | 5b023f5 | 2019-06-24 16:06:37 -0700 | [diff] [blame] | 159 | /** @brief check conf file for Router Advertisements |
| 160 | * |
| 161 | */ |
Patrick Williams | 6aef769 | 2021-05-01 06:39:41 -0500 | [diff] [blame] | 162 | bool ipv6AcceptRA(bool value) override; |
William A. Kennington III | 8060c0d | 2022-08-18 19:19:34 -0700 | [diff] [blame] | 163 | using EthernetInterfaceIntf::ipv6AcceptRA; |
Johnathan Mantey | 5b023f5 | 2019-06-24 16:06:37 -0700 | [diff] [blame] | 164 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 165 | /** @brief sets the NTP servers. |
| 166 | * @param[in] value - vector of NTP servers. |
| 167 | */ |
Patrick Williams | 6aef769 | 2021-05-01 06:39:41 -0500 | [diff] [blame] | 168 | ServerList ntpServers(ServerList value) override; |
Ratan Gupta | 497c0c9 | 2017-08-22 19:15:59 +0530 | [diff] [blame] | 169 | |
Asmitha Karunanithi | 003b8b7 | 2022-01-06 04:17:59 -0600 | [diff] [blame] | 170 | /** @brief sets the static NTP servers. |
| 171 | * @param[in] value - vector of NTP servers. |
| 172 | */ |
| 173 | ServerList staticNTPServers(ServerList value) override; |
| 174 | |
Ravi Teja | 4f8b9a0 | 2023-09-06 13:41:52 -0500 | [diff] [blame] | 175 | /** @brief Get value of nameservers */ |
| 176 | ServerList nameservers() const override; |
| 177 | |
Manojkiran Eda | acd6dd5 | 2019-10-15 15:00:51 +0530 | [diff] [blame] | 178 | /** @brief sets the Static DNS/nameservers. |
| 179 | * @param[in] value - vector of DNS servers. |
| 180 | */ |
| 181 | |
| 182 | ServerList staticNameServers(ServerList value) override; |
| 183 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 184 | /** @brief create Vlan interface. |
| 185 | * @param[in] id- VLAN identifier. |
| 186 | */ |
William A. Kennington III | d298f93 | 2022-10-17 14:31:38 -0700 | [diff] [blame] | 187 | ObjectPath createVLAN(uint16_t id); |
Ratan Gupta | 5978dd1 | 2017-07-25 13:47:13 +0530 | [diff] [blame] | 188 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 189 | /** @brief write the network conf file with the in-memory objects. |
| 190 | */ |
| 191 | void writeConfigurationFile(); |
Ratan Gupta | 2b10653 | 2017-07-25 16:05:02 +0530 | [diff] [blame] | 192 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 193 | /** @brief delete all dbus objects. |
| 194 | */ |
William A. Kennington III | af77f82 | 2023-06-23 02:17:20 -0700 | [diff] [blame] | 195 | void deleteAll() override; |
Ratan Gupta | e9c9b81 | 2017-09-22 17:15:37 +0530 | [diff] [blame] | 196 | |
Ravi Teja | a5a0944 | 2020-07-17 00:57:33 -0500 | [diff] [blame] | 197 | /** @brief set the default v4 gateway of the interface. |
| 198 | * @param[in] gateway - default v4 gateway of the interface. |
| 199 | */ |
| 200 | std::string defaultGateway(std::string gateway) override; |
| 201 | |
| 202 | /** @brief set the default v6 gateway of the interface. |
| 203 | * @param[in] gateway - default v6 gateway of the interface. |
| 204 | */ |
| 205 | std::string defaultGateway6(std::string gateway) override; |
| 206 | |
Jishnu CM | 57dfea9 | 2023-05-05 06:07:26 -0500 | [diff] [blame] | 207 | /** @brief Function to reload network configurations. |
| 208 | */ |
| 209 | void reloadConfigs(); |
| 210 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 211 | using EthernetInterfaceIntf::interfaceName; |
Johnathan Mantey | faa72e5 | 2020-01-08 10:38:58 -0800 | [diff] [blame] | 212 | using EthernetInterfaceIntf::linkUp; |
Tejas Patil | 2c0fc56 | 2021-08-03 19:13:46 +0530 | [diff] [blame] | 213 | using EthernetInterfaceIntf::mtu; |
Patrick Williams | 6aef769 | 2021-05-01 06:39:41 -0500 | [diff] [blame] | 214 | using EthernetInterfaceIntf::nicEnabled; |
| 215 | using MacAddressIntf::macAddress; |
Ratan Gupta | 5978dd1 | 2017-07-25 13:47:13 +0530 | [diff] [blame] | 216 | |
Ravi Teja | a5a0944 | 2020-07-17 00:57:33 -0500 | [diff] [blame] | 217 | using EthernetInterfaceIntf::defaultGateway; |
| 218 | using EthernetInterfaceIntf::defaultGateway6; |
Ratan Gupta | 6dec390f | 2017-08-20 15:28:12 +0530 | [diff] [blame] | 219 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 220 | protected: |
Asmitha Karunanithi | 003b8b7 | 2022-01-06 04:17:59 -0600 | [diff] [blame] | 221 | /** @brief get the NTP server list from the timsyncd dbus obj |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 222 | * |
| 223 | */ |
Asmitha Karunanithi | 003b8b7 | 2022-01-06 04:17:59 -0600 | [diff] [blame] | 224 | virtual ServerList getNTPServerFromTimeSyncd(); |
Ratan Gupta | 497c0c9 | 2017-08-22 19:15:59 +0530 | [diff] [blame] | 225 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 226 | /** @brief get the name server details from the network conf |
| 227 | * |
| 228 | */ |
Ravi Teja | 4f8b9a0 | 2023-09-06 13:41:52 -0500 | [diff] [blame] | 229 | virtual ServerList getNameServerFromResolvd() const; |
Ratan Gupta | 6dec390f | 2017-08-20 15:28:12 +0530 | [diff] [blame] | 230 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 231 | /** @brief Persistent sdbusplus DBus bus connection. */ |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 232 | stdplus::PinnedRef<sdbusplus::bus_t> bus; |
Ratan Gupta | 82549cc | 2017-04-21 08:45:23 +0530 | [diff] [blame] | 233 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 234 | /** @brief Dbus object path */ |
| 235 | std::string objPath; |
Ratan Gupta | 47722dc | 2017-05-26 18:32:23 +0530 | [diff] [blame] | 236 | |
William A. Kennington III | 2e09d27 | 2022-10-14 17:15:00 -0700 | [diff] [blame] | 237 | /** @brief Interface index */ |
| 238 | unsigned ifIdx; |
| 239 | |
William A. Kennington III | 09f3a4a | 2022-10-25 02:59:16 -0700 | [diff] [blame] | 240 | struct VlanProperties : VlanIfaces |
| 241 | { |
| 242 | VlanProperties(sdbusplus::bus_t& bus, stdplus::const_zstring objPath, |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 243 | const InterfaceInfo& info, |
| 244 | stdplus::PinnedRef<EthernetInterface> eth); |
William A. Kennington III | 09f3a4a | 2022-10-25 02:59:16 -0700 | [diff] [blame] | 245 | void delete_() override; |
| 246 | unsigned parentIdx; |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 247 | stdplus::PinnedRef<EthernetInterface> eth; |
William A. Kennington III | 09f3a4a | 2022-10-25 02:59:16 -0700 | [diff] [blame] | 248 | }; |
| 249 | std::optional<VlanProperties> vlan; |
| 250 | |
William A. Kennington III | f179e70 | 2024-04-17 00:50:28 -0700 | [diff] [blame] | 251 | std::optional<dhcp::Configuration> dhcp4Conf, dhcp6Conf; |
| 252 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 253 | friend class TestEthernetInterface; |
William A. Kennington III | 09f3a4a | 2022-10-25 02:59:16 -0700 | [diff] [blame] | 254 | friend class TestNetworkManager; |
Johnathan Mantey | 817012a | 2020-01-30 15:07:39 -0800 | [diff] [blame] | 255 | |
| 256 | private: |
William A. Kennington III | 9ede1b7 | 2022-11-21 01:59:28 -0800 | [diff] [blame] | 257 | EthernetInterface(stdplus::PinnedRef<sdbusplus::bus_t> bus, |
| 258 | stdplus::PinnedRef<Manager> manager, |
William A. Kennington III | 13d665c | 2022-11-15 20:34:40 -0800 | [diff] [blame] | 259 | const AllIntfInfo& info, std::string&& objPath, |
William A. Kennington III | b645254 | 2022-11-15 18:09:12 -0800 | [diff] [blame] | 260 | const config::Parser& config, bool enabled); |
William A. Kennington III | d298f93 | 2022-10-17 14:31:38 -0700 | [diff] [blame] | 261 | |
Johnathan Mantey | 817012a | 2020-01-30 15:07:39 -0800 | [diff] [blame] | 262 | /** @brief Determines if the address is manually assigned |
| 263 | * @param[in] origin - The origin entry of the IP::Address |
| 264 | * @returns true/false value if the address is static |
| 265 | */ |
| 266 | bool originIsManuallyAssigned(IP::AddressOrigin origin); |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 267 | }; |
| 268 | |
| 269 | } // namespace network |
| 270 | } // namespace phosphor |