routing_table: Remove obsolete code
This is no longer used by any of our daemon code
Change-Id: Ia2283c217027a7dfec612810d1bb3ae4a1d5928f
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/meson.build b/src/meson.build
index ce1c142..3119a88 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -57,7 +57,6 @@
'system_queries.cpp',
'types.cpp',
'util.cpp',
- 'routing_table.cpp',
'config_parser.cpp',
'dhcp_configuration.cpp',
'rtnetlink_server.cpp',
diff --git a/src/network_manager.hpp b/src/network_manager.hpp
index 3f7a050..a1b4699 100644
--- a/src/network_manager.hpp
+++ b/src/network_manager.hpp
@@ -1,7 +1,6 @@
#pragma once
#include "dhcp_configuration.hpp"
#include "ethernet_interface.hpp"
-#include "routing_table.hpp"
#include "system_configuration.hpp"
#include "types.hpp"
#include "xyz/openbmc_project/Network/VLAN/Create/server.hpp"
diff --git a/src/routing_table.cpp b/src/routing_table.cpp
deleted file mode 100644
index d6285a7..0000000
--- a/src/routing_table.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#include "routing_table.hpp"
-
-#include "netlink.hpp"
-#include "rtnetlink.hpp"
-
-#include <optional>
-#include <phosphor-logging/elog-errors.hpp>
-#include <phosphor-logging/log.hpp>
-#include <stdexcept>
-#include <stdplus/raw.hpp>
-#include <string_view>
-#include <xyz/openbmc_project/Common/error.hpp>
-
-namespace phosphor
-{
-namespace network
-{
-namespace route
-{
-
-using namespace phosphor::logging;
-using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-
-static void parseRoute(auto& gws4, auto& gws6, const nlmsghdr& hdr,
- std::string_view msg)
-{
- if (hdr.nlmsg_type != RTM_NEWROUTE)
- {
- throw std::runtime_error("Not a route msg");
- }
-
- if (auto ret = netlink::gatewayFromRtm(msg); ret)
- {
- std::visit(
- [&](auto addr) {
- if constexpr (std::is_same_v<in_addr, decltype(addr)>)
- {
- gws4.emplace(std::get<unsigned>(*ret), addr);
- }
- else if constexpr (std::is_same_v<in6_addr, decltype(addr)>)
- {
- gws6.emplace(std::get<unsigned>(*ret), addr);
- }
- else
- {
- static_assert(!std::is_same_v<void, decltype(addr)>);
- }
- },
- std::get<InAddrAny>(*ret));
- }
-}
-
-void Table::refresh()
-{
- gws4.clear();
- gws6.clear();
- try
- {
- rtmsg msg{};
- netlink::performRequest(NETLINK_ROUTE, RTM_GETROUTE, NLM_F_DUMP, msg,
- [&](const nlmsghdr& hdr, std::string_view msg) {
- parseRoute(gws4, gws6, hdr, msg);
- });
- }
- catch (const std::exception& e)
- {
- log<level::ERR>("Reading routes failed", entry("ERROR=%s", e.what()));
- commit<InternalFailure>();
- }
-}
-} // namespace route
-} // namespace network
-} // namespace phosphor
diff --git a/src/routing_table.hpp b/src/routing_table.hpp
deleted file mode 100644
index 3650c80..0000000
--- a/src/routing_table.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#pragma once
-#include "types.hpp"
-
-#include <unordered_map>
-
-namespace phosphor
-{
-namespace network
-{
-namespace route
-{
-class Table
-{
- public:
- /** @brief Rebuilds the routing table from the kernel */
- void refresh();
-
- /**
- * @brief gets the default v4 gateway.
- *
- * @returns the default v4 gateway list.
- */
- inline const auto& getDefaultGateway() const
- {
- return gws4;
- }
-
- /**
- * @brief gets the default v6 gateway.
- *
- * @returns the default v6 gateway list.
- */
- inline const auto& getDefaultGateway6() const
- {
- return gws6;
- };
-
- private:
- std::unordered_map<unsigned, in_addr> gws4;
- std::unordered_map<unsigned, in6_addr> gws6;
-};
-
-} // namespace route
-} // namespace network
-} // namespace phosphor