Skip to content

Commit

Permalink
Fix bug in remove tunnel term
Browse files Browse the repository at this point in the history
Signed-off-by: bingwang <bingwang@microsoft.com>
  • Loading branch information
bingwang-ms committed May 9, 2022
1 parent 9ad4f7b commit 47914af
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ sai_object_id_t DscpToTcMapHandler::addQosItem(const vector<sai_attribute_t> &at
}
SWSS_LOG_DEBUG("created QosMap object:%" PRIx64, sai_object);

applyDscpToTcMapToSwitch(SAI_SWITCH_ATTR_QOS_DSCP_TO_TC_MAP, sai_object);
//applyDscpToTcMapToSwitch(SAI_SWITCH_ATTR_QOS_DSCP_TO_TC_MAP, sai_object);

return sai_object;
}
Expand Down
30 changes: 27 additions & 3 deletions orchagent/tunneldecaporch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,23 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
}
if (exists)
{
setIpAttribute(key, ip_addresses, tunnelTable.find(key)->second.tunnel_id);
bool is_p2p_tunnel = false;
for (auto term : tunnelTable[key].tunnel_term_info)
{
if (term.term_type == TUNNEL_TERM_TYPE_P2P)
{
is_p2p_tunnel = true;
break;
}
}
if (is_p2p_tunnel)
{
SWSS_LOG_ERROR("cannot modify dst ip for existing tunnel with P2P terminator");
}
else
{
setIpAttribute(key, ip_addresses, tunnelTable.find(key)->second.tunnel_id);
}
}
}
else if (fvField(i) == "src_ip")
Expand Down Expand Up @@ -557,7 +573,7 @@ bool TunnelDecapOrch::addDecapTunnelTermEntries(string tunnelKey, swss::IpAddres
// pop the last element for the next loop
tunnel_table_entry_attrs.pop_back();

SWSS_LOG_NOTICE("Created tunnel entry for ip: %s", dst_ip.c_str());
SWSS_LOG_NOTICE("Created tunnel entry for ip: %s", key.c_str());
}

}
Expand Down Expand Up @@ -761,7 +777,15 @@ bool TunnelDecapOrch::removeDecapTunnel(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;
if (swss::IpAddress(tunnel_entry_info.src_ip).isZero())
{
term_key = tunnel_entry_info.dst_ip;
}
else
{
term_key = tunnel_entry_info.src_ip + '-' + tunnel_entry_info.dst_ip;
}
if (!removeDecapTunnelTermEntry(tunnel_entry_info.tunnel_term_id, term_key))
{
return false;
Expand Down

0 comments on commit 47914af

Please sign in to comment.