Skip to content

Commit

Permalink
[loopback]: skip route pointing to loopback interface (sonic-net#1570)
Browse files Browse the repository at this point in the history
if we assign the loopback interface with non full-masked route, then we could
receive a route from fpmsyncd. we need to skip it otherwise, it will be queued
in orchagent.

    Dec 26 19:45:40.063448 vlab-01 INFO swss#orchagent: :- addRoute: Failed to get next hop ::@loopback0 for fc00:1::/64

Signed-off-by: Guohan Lu <lguohan@gmail.com>
  • Loading branch information
lguohan authored Dec 27, 2020
1 parent 41fd2c4 commit 321291a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
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

0 comments on commit 321291a

Please sign in to comment.