Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[loopback]: skip route pointing to loopback interface #1570

Merged
merged 1 commit into from
Dec 27, 2020
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 orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const int intfsorch_pri = 35;
#define RIF_FLEX_STAT_COUNTER_POLL_MSECS "1000"
#define UPDATE_MAPS_SEC 1

#define LOOPBACK_PREFIX "Loopback"

static const vector<sai_router_interface_stat_t> rifStatIds =
{
Expand All @@ -57,7 +56,7 @@ IntfsOrch::IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch) :
{
SWSS_LOG_ENTER();

/* Initialize DB connectors */
/* Initialize DB connectors */
m_counter_db = shared_ptr<DBConnector>(new DBConnector("COUNTERS_DB", 0));
m_flex_db = shared_ptr<DBConnector>(new DBConnector("FLEX_COUNTER_DB", 0));
m_asic_db = shared_ptr<DBConnector>(new DBConnector("ASIC_DB", 0));
Expand Down Expand Up @@ -576,7 +575,7 @@ void IntfsOrch::doTask(Consumer &consumer)
SWSS_LOG_ERROR("Invalid mac argument %s to %s()", value.c_str(), e.what());
continue;
}
}
}
else if (field == "nat_zone")
{
try
Expand Down
10 changes: 8 additions & 2 deletions orchagent/routeorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,13 @@ void RouteOrch::doTask(Consumer& consumer)

for (auto alias : alsv)
{
if (alias == "eth0" || alias == "lo" || alias == "docker0")
/* skip route to management, docker, loopback
* TODO: for route to loopback interface, the proper
* way is to create loopback interface and then create
* route pointing to it, so that we can traps packets to
* CPU */
if (alias == "eth0" || alias == "docker0" ||
alias == "lo" || !alias.compare(0, strlen(LOOPBACK_PREFIX), LOOPBACK_PREFIX))
{
excp_intfs_flag = true;
break;
Expand Down Expand Up @@ -1231,7 +1237,7 @@ bool RouteOrch::addRoute(RouteBulkContext& ctx, const NextHopGroupKey &nextHops)
&& vrf_id == gVirtualRouterId)
{
/* Only support the default vrf for Fine Grained ECMP */
SWSS_LOG_INFO("Reroute %s:%s to fgNhgOrch", ipPrefix.to_string().c_str(),
SWSS_LOG_INFO("Reroute %s:%s to fgNhgOrch", ipPrefix.to_string().c_str(),
nextHops.to_string().c_str());
return m_fgNhgOrch->addRoute(vrf_id, ipPrefix, nextHops);
}
Expand Down
2 changes: 2 additions & 0 deletions orchagent/routeorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
/* Length of the Interface Id value in EUI64 format */
#define EUI64_INTF_ID_LEN 8

#define LOOPBACK_PREFIX "Loopback"

typedef std::map<NextHopKey, sai_object_id_t> NextHopGroupMembers;

struct NextHopGroupEntry
Expand Down