From e748c7a42abeaa7d56eb5c16537894017ede6366 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 14 May 2020 09:58:36 -0400 Subject: [PATCH] zebra: Allow zebra to gracefully handle rtadv when not configured 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 --- zebra/rtadv.c | 24 ++++++++++++++++++++++++ zebra/zapi_msg.c | 5 ----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 4036499605..fa0a682d07 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -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 */ diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 5db4555284..ffe5ca4845 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -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, -- 2.39.5