linux-cp: ignore neighbors if ip addr is multicast 23/35523/4
authorAlexander Chernavin <[email protected]>
Thu, 21 Oct 2021 08:29:11 +0000 (08:29 +0000)
committerMatthew Smith <[email protected]>
Fri, 4 Mar 2022 15:58:42 +0000 (15:58 +0000)
Type: improvement

When dump of neighbors is requested, the replies will also include
neighbor entries for IPv6 multicast addresses:

  GigabitEthernet0/8/0  S           ff02::16  33:33:00:00:00:16
  GigabitEthernet0/8/0  S  ff02::1:ff76:7135  33:33:ff:76:71:35
  GigabitEthernet0/8/0  S            ff02::2  33:33:00:00:00:02

Such entries are not reported in netlink notification messages and
VPP is unlikely to use these.

With this change, ignore neighbor entries when the IP address is a
multicast address.

Signed-off-by: Alexander Chernavin <[email protected]>
Change-Id: Ic712aa4904f1d559f31fd89ff4541268e2340f84

src/plugins/linux-cp/lcp_router.c

index 6392e2a..7542aa0 100644 (file)
@@ -557,6 +557,14 @@ lcp_router_neigh_del (struct rtnl_neigh *rn)
 
       lcp_router_mk_addr (rtnl_neigh_get_dst (rn), &nh);
 
+      if (ip46_address_is_multicast (&ip_addr_46 (&nh)))
+       {
+         LCP_ROUTER_DBG ("ignore neighbor del: %U %U", format_ip_address, &nh,
+                         format_vnet_sw_if_index_name, vnet_get_main (),
+                         sw_if_index);
+         return;
+       }
+
       rv = ip_neighbor_del (&nh, sw_if_index);
 
       if (rv)
@@ -597,6 +605,15 @@ lcp_router_neigh_add (struct rtnl_neigh *rn)
       int state;
 
       lcp_router_mk_addr (rtnl_neigh_get_dst (rn), &nh);
+
+      if (ip46_address_is_multicast (&ip_addr_46 (&nh)))
+       {
+         LCP_ROUTER_DBG ("ignore neighbor add: %U %U", format_ip_address, &nh,
+                         format_vnet_sw_if_index_name, vnet_get_main (),
+                         sw_if_index);
+         return;
+       }
+
       ll = rtnl_neigh_get_lladdr (rn);
       state = rtnl_neigh_get_state (rn);