From 413141b42b79cacdea82eb3f5f3da93d031e42b0 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Thu, 13 Aug 2020 21:23:45 -0700 Subject: [PATCH] Ignore IPv6 link-local and multicast entries as Vnet routes (#1401) --- fpmsyncd/routesync.cpp | 9 +++++++++ tests/test_vnet.py | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/fpmsyncd/routesync.cpp b/fpmsyncd/routesync.cpp index 2250d26d1a54..df9f4c09f7bb 100644 --- a/fpmsyncd/routesync.cpp +++ b/fpmsyncd/routesync.cpp @@ -216,6 +216,15 @@ void RouteSync::onVnetRouteMsg(int nlmsg_type, struct nl_object *obj, string vne string vnet_dip = vnet + string(":") + destipprefix; SWSS_LOG_DEBUG("Receive new vnet route message %s", vnet_dip.c_str()); + /* Ignore IPv6 link-local and mc addresses as Vnet routes */ + auto family = rtnl_route_get_family(route_obj); + if (family == AF_INET6 && + (IN6_IS_ADDR_LINKLOCAL(nl_addr_get_binary_addr(dip)) || IN6_IS_ADDR_MULTICAST(nl_addr_get_binary_addr(dip)))) + { + SWSS_LOG_INFO("Ignore linklocal vnet routes %d for %s", nlmsg_type, vnet_dip.c_str()); + return; + } + if (nlmsg_type == RTM_DELROUTE) { /* Duplicated delete as we do not know if it is a VXLAN tunnel route*/ diff --git a/tests/test_vnet.py b/tests/test_vnet.py index 7b695943c777..e4cf9a983d52 100644 --- a/tests/test_vnet.py +++ b/tests/test_vnet.py @@ -536,6 +536,14 @@ def check_vxlan_tunnel_entry(self, dvs, tunnel_name, vnet_name, vni_id): def check_vnet_entry(self, dvs, name, peer_list=[]): asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0) + app_db = swsscommon.DBConnector(swsscommon.APPL_DB, dvs.redis_sock, 0) + + #Assert if there are linklocal entries + tbl = swsscommon.Table(app_db, "VNET_ROUTE_TUNNEL_TABLE") + route_entries = tbl.getKeys() + assert "ff00::/8" not in route_entries + assert "fe80::/64" not in route_entries + #Check virtual router objects assert how_many_entries_exist(asic_db, self.ASIC_VRF_TABLE) == (len(self.vnet_vr_ids) + 1),\ "The VR objects are not created"