Skip to content

Commit

Permalink
Ignore IPv6 link-local and multicast entries as Vnet routes (sonic-ne…
Browse files Browse the repository at this point in the history
  • Loading branch information
prsunny authored Aug 14, 2020
1 parent 879f45b commit 4945285
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fpmsyncd/routesync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down
8 changes: 8 additions & 0 deletions tests/test_vnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,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"
Expand Down

0 comments on commit 4945285

Please sign in to comment.