vrrp: prevent segfault in multicast join due to missing LL Addr 06/32906/2
authorJon Loeliger <jdl@netgate.com>
Fri, 25 Jun 2021 15:24:57 +0000 (11:24 -0400)
committerNeale Ranns <neale@graphiant.com>
Sat, 26 Jun 2021 07:39:10 +0000 (07:39 +0000)
If an IPv6 Link Layer Address is missing from an interface,
treat it as a down interface.  While this fails to send a
VRRP multicast group join, it also prevents a seg fault.

Type: fix
Fixes: 39e9428b90bc74d1bb15fc17759c8ef6ad712418
Signed-off-by: Jon Loeliger <jdl@netgate.com>
Change-Id: Iebf69bb30604a96de6587655eb872aa818158a56

src/plugins/vrrp/vrrp_packet.c

index 8daee50..b470dde 100644 (file)
@@ -691,6 +691,11 @@ vrrp_vr_multicast_group_join (vrrp_vr_t * vr)
   if (!vnet_sw_interface_is_up (vnm, vr->config.sw_if_index))
     return 0;
 
+  is_ipv6 = vrrp_vr_is_ipv6 (vr);
+
+  if (is_ipv6 && ip6_link_is_enabled (vr->config.sw_if_index) == 0)
+    return 0;
+
   if (vlib_buffer_alloc (vm, &bi, n_buffers) != n_buffers)
     {
       clib_warning ("Buffer allocation failed for %U", format_vrrp_vr_key,
@@ -698,8 +703,6 @@ vrrp_vr_multicast_group_join (vrrp_vr_t * vr)
       return -1;
     }
 
-  is_ipv6 = vrrp_vr_is_ipv6 (vr);
-
   b = vlib_get_buffer (vm, bi);
 
   b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;