diff --git a/orchagent/neighorch.cpp b/orchagent/neighorch.cpp index f4168418008..1d26d1eb2a3 100644 --- a/orchagent/neighorch.cpp +++ b/orchagent/neighorch.cpp @@ -30,6 +30,13 @@ bool NeighOrch::addNextHop(IpAddress ipAddress, string alias) { SWSS_LOG_ENTER(); + if (hasNextHop(ipAddress)) + { + SWSS_LOG_ERROR("Next hop IP %s already exists", + ipAddress.to_string().c_str()); + return false; + } + Port p; if (!gPortsOrch->getPort(alias, p)) { @@ -38,7 +45,6 @@ bool NeighOrch::addNextHop(IpAddress ipAddress, string alias) return false; } - assert(!hasNextHop(ipAddress)); sai_object_id_t rif_id = m_intfsOrch->getRouterIntfsId(alias); vector next_hop_attrs;