Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions include/network/interfacemanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <functional>
#include <optional>
#include <string>
#include <vector>

#include <sys/socket.h>

Expand Down Expand Up @@ -203,7 +204,7 @@ class InterfaceManager : public sm::networkmanager::InterfaceManagerItf,
* @param[out] routes routes.
* @return Error.
*/
Error GetRouteList(Array<RouteInfo>& routes) const;
Error GetRouteList(std::vector<RouteInfo>& routes) const;

/**
* Adds link.
Expand Down Expand Up @@ -248,8 +249,6 @@ class InterfaceManager : public sm::networkmanager::InterfaceManagerItf,
using LinkDeleter = std::function<void(rtnl_link*)>;
using UniqueLink = std::unique_ptr<rtnl_link, LinkDeleter>;

static constexpr size_t cMaxRouteCount = 20;

RetWithError<int> GetMasterInterfaceIndex() const;
RetWithError<UniqueNetlinkSocket> CreateNetlinkSocket() const;
RetWithError<UniqueLink> CreateLink() const;
Expand Down
8 changes: 3 additions & 5 deletions src/network/interfacemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ Error InterfaceManager::SetMasterLink(const String& ifname, const String& master
return ErrorEnum::eNone;
}

Error InterfaceManager::GetRouteList(Array<RouteInfo>& routes) const
Error InterfaceManager::GetRouteList(std::vector<RouteInfo>& routes) const
{
LOG_DBG() << "List routes";

Expand Down Expand Up @@ -475,9 +475,7 @@ Error InterfaceManager::GetRouteList(Array<RouteInfo>& routes) const
}
}

if (err = routes.PushBack(info); !err.IsNone()) {
return AOS_ERROR_WRAP(err);
}
routes.push_back(std::move(info));
}

return ErrorEnum::eNone;
Expand Down Expand Up @@ -574,7 +572,7 @@ RetWithError<int> InterfaceManager::GetMasterInterfaceIndex() const
{
LOG_DBG() << "Get master interface index";

StaticArray<RouteInfo, cMaxRouteCount> routes;
std::vector<RouteInfo> routes;

if (auto err = GetRouteList(routes); !err.IsNone()) {
return {-1, err};
Expand Down