]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Allow zebra to gracefully handle rtadv when not configured
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 14 May 2020 13:58:36 +0000 (09:58 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 21 May 2020 11:42:04 +0000 (07:42 -0400)
Currently zebra when you compile without router advertisements
will just say something like `cannot handle message 42`.  Which
is not terribly useful to an end user.

Add some smarts to the zapi message handling to just do nothing
and output a debug if someone has it turned on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/rtadv.c
zebra/zapi_msg.c

index 403649960552b36fbd5d28f98f72689a656fedf6..fa0a682d075e1b3e86aaa27acdeee6e1fbb2eca2 100644 (file)
@@ -2677,4 +2677,28 @@ void rtadv_stop_ra_all(void)
        /* Empty.*/;
 }
 
+/*
+ * If the end user does not have RADV enabled we should
+ * handle this better
+ */
+void zebra_interface_radv_disable(ZAPI_HANDLER_ARGS)
+{
+       if (IS_ZEBRA_DEBUG_PACKET)
+               zlog_debug(
+                       "Received %s command, but ZEBRA is not compiled with Router Advertisements on",
+                       zserv_command_string(hdr->command));
+
+       return;
+}
+
+void zebra_interface_radv_enable(ZAPI_HANDLER_ARGS)
+{
+       if (IS_ZEBRA_DEBUG_PACKET)
+               zlog_debug(
+                       "Received %s command, but ZEBRA is not compiled with Router Advertisements on",
+                       zserv_command_string(hdr->command));
+
+       return;
+}
+
 #endif /* HAVE_RTADV */
index 5db455528411fdccdb73c2903a1c27ac49d462bd..ffe5ca48455c18eccfcc4636a092e707daf7599f 100644 (file)
@@ -2829,13 +2829,8 @@ void (*const zserv_handlers[])(ZAPI_HANDLER_ARGS) = {
        [ZEBRA_VRF_UNREGISTER] = zread_vrf_unregister,
        [ZEBRA_VRF_LABEL] = zread_vrf_label,
        [ZEBRA_BFD_CLIENT_REGISTER] = zebra_ptm_bfd_client_register,
-#if defined(HAVE_RTADV)
        [ZEBRA_INTERFACE_ENABLE_RADV] = zebra_interface_radv_enable,
        [ZEBRA_INTERFACE_DISABLE_RADV] = zebra_interface_radv_disable,
-#else
-       [ZEBRA_INTERFACE_ENABLE_RADV] = NULL,
-       [ZEBRA_INTERFACE_DISABLE_RADV] = NULL,
-#endif
        [ZEBRA_MPLS_LABELS_ADD] = zread_mpls_labels_add,
        [ZEBRA_MPLS_LABELS_DELETE] = zread_mpls_labels_delete,
        [ZEBRA_MPLS_LABELS_REPLACE] = zread_mpls_labels_replace,