From 58934f6c0a84bf2563d8526ac8a5dd6d92f5dbb0 Mon Sep 17 00:00:00 2001 From: Utpal Pintoo Date: Mon, 13 Sep 2021 00:05:59 -0700 Subject: [PATCH] Allow IPv4 link-local nexthops Signed-off-by: Utpal Kant Pintoo utpal.pintoo@broadcom.com --- orchagent/neighorch.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/orchagent/neighorch.cpp b/orchagent/neighorch.cpp index e3f9a4175e..b85d8effaf 100644 --- a/orchagent/neighorch.cpp +++ b/orchagent/neighorch.cpp @@ -671,19 +671,6 @@ void NeighOrch::doTask(Consumer &consumer) IpAddress ip_address(key.substr(found+1)); - /* Verify Ipv4 LinkLocal and skip neighbor entry added for RFC5549 */ - if ((ip_address.getAddrScope() == IpAddress::LINK_SCOPE) && (ip_address.isV4())) - { - /* Check if this prefix is not a configured ip, if so allow */ - IpPrefix ipll_prefix(ip_address.getV4Addr(), 16); - if (!m_intfsOrch->isPrefixSubnet (ipll_prefix, alias)) - { - SWSS_LOG_NOTICE("Skip IPv4LL neighbor %s, Intf:%s op: %s ", ip_address.to_string().c_str(), alias.c_str(), op.c_str()); - it = consumer.m_toSync.erase(it); - continue; - } - } - NeighborEntry neighbor_entry = { ip_address, alias }; if (op == SET_COMMAND) @@ -793,6 +780,18 @@ bool NeighOrch::addNeighbor(const NeighborEntry &neighborEntry, const MacAddress memcpy(neighbor_attr.value.mac, macAddress.getMac(), 6); neighbor_attrs.push_back(neighbor_attr); + if ((ip_address.getAddrScope() == IpAddress::LINK_SCOPE) && (ip_address.isV4())) + { + /* Check if this prefix is a configured ip, if not allow */ + IpPrefix ipll_prefix(ip_address.getV4Addr(), 16); + if (!m_intfsOrch->isPrefixSubnet (ipll_prefix, alias)) + { + neighbor_attr.id = SAI_NEIGHBOR_ENTRY_ATTR_NO_HOST_ROUTE; + neighbor_attr.value.booldata = 1; + neighbor_attrs.push_back(neighbor_attr); + } + } + MuxOrch* mux_orch = gDirectory.get(); bool hw_config = isHwConfigured(neighborEntry);