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

[routeorch]: Need to set drop route next hop ID to NULL #261

Merged
merged 1 commit into from
Jul 21, 2017
Merged
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
33 changes: 24 additions & 9 deletions orchagent/routeorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ RouteOrch::RouteOrch(DBConnector *db, string tableName, NeighOrch *neighOrch) :
status = sai_route_api->create_route_entry(&unicast_route_entry, 1, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to create v4 default route with packet action drop");
throw runtime_error("Failed to create v4 default route with packet action drop");
SWSS_LOG_ERROR("Failed to create IPv4 default route with packet action drop");
throw runtime_error("Failed to create IPv4 default route with packet action drop");
}

/* Add default IPv4 route into the m_syncdRoutes */
Expand All @@ -87,8 +87,8 @@ RouteOrch::RouteOrch(DBConnector *db, string tableName, NeighOrch *neighOrch) :
status = sai_route_api->create_route_entry(&unicast_route_entry, 1, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to create v6 default route with packet action drop");
throw runtime_error("Failed to create v6 default route with packet action drop");
SWSS_LOG_ERROR("Failed to create IPv6 default route with packet action drop");
throw runtime_error("Failed to create IPv6 default route with packet action drop");
}

/* Add default IPv6 route into the m_syncdRoutes */
Expand Down Expand Up @@ -455,14 +455,13 @@ bool RouteOrch::addNextHopGroup(IpAddresses ipAddresses)

if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to create next hop group nh:%s\n",
ipAddresses.to_string().c_str());
SWSS_LOG_ERROR("Failed to create next hop group %s, rv:%d",
ipAddresses.to_string().c_str(), status);
return false;
}

m_nextHopGroupCount ++;
SWSS_LOG_NOTICE("Create next hop group nhgid:%lx nh:%s \n",
next_hop_group_id, ipAddresses.to_string().c_str());
SWSS_LOG_NOTICE("Create next hop group %s", ipAddresses.to_string().c_str());

NextHopGroupEntry next_hop_group_entry;
next_hop_group_entry.next_hop_group_id = next_hop_group_id;
Expand Down Expand Up @@ -748,9 +747,25 @@ bool RouteOrch::removeRoute(IpPrefix ipPrefix)
sai_status_t status = sai_route_api->set_route_entry_attribute(&route_entry, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set route %s to drop", ipPrefix.to_string().c_str());
SWSS_LOG_ERROR("Failed to set route %s packet action to drop, rv:%d",
ipPrefix.to_string().c_str(), status);
return false;
}

SWSS_LOG_INFO("Set route %s packet action to drop", ipPrefix.to_string().c_str());

attr.id = SAI_ROUTE_ATTR_NEXT_HOP_ID;
attr.value.oid = SAI_NULL_OBJECT_ID;

status = sai_route_api->set_route_attribute(&route_entry, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set route %s next hop ID to NULL, rv:%d",
ipPrefix.to_string().c_str(), status);
return false;
}

SWSS_LOG_INFO("Set route %s next hop ID to NULL", ipPrefix.to_string().c_str());
}
else
{
Expand Down