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

Fix key generation in removeDecapTunnel #2322

Merged
merged 1 commit into from
Jun 13, 2022
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
23 changes: 16 additions & 7 deletions orchagent/tunneldecaporch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
{
tunnel_id = tunnelTable[key].tunnel_id;
}

if (op == SET_COMMAND)
{

Expand Down Expand Up @@ -240,11 +240,11 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
++it;
continue;
}

//create new tunnel if it doesn't exists already
if (valid && !exists)
{

if (addDecapTunnel(key, tunnel_type, ip_addresses, p_src_ip, dscp_mode, ecn_mode, encap_ecn_mode, ttl_mode,
dscp_to_tc_map_id, tc_to_pg_map_id))
{
Expand Down Expand Up @@ -427,7 +427,7 @@ bool TunnelDecapOrch::addDecapTunnel(
attr.value.oid = tc_to_pg_map_id;
tunnel_attrs.push_back(attr);
}

// write attributes to ASIC_DB
sai_object_id_t tunnel_id;
status = sai_tunnel_api->create_tunnel(&tunnel_id, gSwitchId, (uint32_t)tunnel_attrs.size(), tunnel_attrs.data());
Expand Down Expand Up @@ -669,8 +669,8 @@ bool TunnelDecapOrch::setTunnelAttribute(string field, sai_object_id_t value, sa
{
// TC remapping.
attr.id = SAI_TUNNEL_ATTR_DECAP_QOS_DSCP_TO_TC_MAP;
attr.value.oid = value;
attr.value.oid = value;

}
else if (field == decap_tc_to_pg_field_name)
{
Expand Down Expand Up @@ -763,7 +763,16 @@ bool TunnelDecapOrch::removeDecapTunnel(string table_name, string key)
for (auto it = tunnel_info->tunnel_term_info.begin(); it != tunnel_info->tunnel_term_info.end(); ++it)
{
TunnelTermEntry tunnel_entry_info = *it;
string term_key = tunnel_entry_info.src_ip + '-' + tunnel_entry_info.dst_ip;
string term_key;
swss::IpAddress src_ip(tunnel_entry_info.src_ip);
if (!src_ip.isZero())
{
term_key = src_ip.to_string() + '-' + tunnel_entry_info.dst_ip;
}
else
{
term_key = tunnel_entry_info.dst_ip;
}
if (!removeDecapTunnelTermEntry(tunnel_entry_info.tunnel_term_id, term_key))
{
return false;
Expand Down