Skip to content

Commit 321291a

Browse files
authored
[loopback]: skip route pointing to loopback interface (#1570)
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 <[email protected]>
1 parent 41fd2c4 commit 321291a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

orchagent/intfsorch.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const int intfsorch_pri = 35;
3838
#define RIF_FLEX_STAT_COUNTER_POLL_MSECS "1000"
3939
#define UPDATE_MAPS_SEC 1
4040

41-
#define LOOPBACK_PREFIX "Loopback"
4241

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

60-
/* Initialize DB connectors */
59+
/* Initialize DB connectors */
6160
m_counter_db = shared_ptr<DBConnector>(new DBConnector("COUNTERS_DB", 0));
6261
m_flex_db = shared_ptr<DBConnector>(new DBConnector("FLEX_COUNTER_DB", 0));
6362
m_asic_db = shared_ptr<DBConnector>(new DBConnector("ASIC_DB", 0));
@@ -576,7 +575,7 @@ void IntfsOrch::doTask(Consumer &consumer)
576575
SWSS_LOG_ERROR("Invalid mac argument %s to %s()", value.c_str(), e.what());
577576
continue;
578577
}
579-
}
578+
}
580579
else if (field == "nat_zone")
581580
{
582581
try

orchagent/routeorch.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,13 @@ void RouteOrch::doTask(Consumer& consumer)
557557

558558
for (auto alias : alsv)
559559
{
560-
if (alias == "eth0" || alias == "lo" || alias == "docker0")
560+
/* skip route to management, docker, loopback
561+
* TODO: for route to loopback interface, the proper
562+
* way is to create loopback interface and then create
563+
* route pointing to it, so that we can traps packets to
564+
* CPU */
565+
if (alias == "eth0" || alias == "docker0" ||
566+
alias == "lo" || !alias.compare(0, strlen(LOOPBACK_PREFIX), LOOPBACK_PREFIX))
561567
{
562568
excp_intfs_flag = true;
563569
break;
@@ -1231,7 +1237,7 @@ bool RouteOrch::addRoute(RouteBulkContext& ctx, const NextHopGroupKey &nextHops)
12311237
&& vrf_id == gVirtualRouterId)
12321238
{
12331239
/* Only support the default vrf for Fine Grained ECMP */
1234-
SWSS_LOG_INFO("Reroute %s:%s to fgNhgOrch", ipPrefix.to_string().c_str(),
1240+
SWSS_LOG_INFO("Reroute %s:%s to fgNhgOrch", ipPrefix.to_string().c_str(),
12351241
nextHops.to_string().c_str());
12361242
return m_fgNhgOrch->addRoute(vrf_id, ipPrefix, nextHops);
12371243
}

orchagent/routeorch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
/* Length of the Interface Id value in EUI64 format */
2222
#define EUI64_INTF_ID_LEN 8
2323

24+
#define LOOPBACK_PREFIX "Loopback"
25+
2426
typedef std::map<NextHopKey, sai_object_id_t> NextHopGroupMembers;
2527

2628
struct NextHopGroupEntry

0 commit comments

Comments
 (0)