]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Add knowledge about RA and RFC 5549 to `show zebra`
authorDonald Sharp <sharpd@nvidia.com>
Fri, 4 Feb 2022 13:04:23 +0000 (08:04 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 4 Feb 2022 15:29:38 +0000 (10:29 -0500)
Add to `show zebra` whether or not RA is compiled into FRR
and whether or not BGP is using RFC 5549 at the moment.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/rtadv.c
zebra/rtadv.h
zebra/zebra_vty.c

index 350b97cc5de5039abe6a3b0c1b375d11286e3ff0..83b141cd7ae5eed7a489c06612a7e1247a1e6a3a 100644 (file)
@@ -47,6 +47,8 @@
 
 extern struct zebra_privs_t zserv_privs;
 
+static uint32_t interfaces_configured_for_ra_from_bgp;
+
 #if defined(HAVE_RTADV)
 
 #ifndef VTYSH_EXTRACT_PL
@@ -1282,6 +1284,9 @@ static void zebra_interface_radv_set(ZAPI_HANDLER_ARGS, int enable)
 
        zif = ifp->info;
        if (enable) {
+               if (!CHECK_FLAG(zif->rtadv.ra_configured, BGP_RA_CONFIGURED))
+                       interfaces_configured_for_ra_from_bgp++;
+
                SET_FLAG(zif->rtadv.ra_configured, BGP_RA_CONFIGURED);
                ipv6_nd_suppress_ra_set(ifp, RA_ENABLE);
                if (ra_interval
@@ -1290,6 +1295,9 @@ static void zebra_interface_radv_set(ZAPI_HANDLER_ARGS, int enable)
                                   VTY_RA_INTERVAL_CONFIGURED))
                        zif->rtadv.MaxRtrAdvInterval = ra_interval * 1000;
        } else {
+               if (CHECK_FLAG(zif->rtadv.ra_configured, BGP_RA_CONFIGURED))
+                       interfaces_configured_for_ra_from_bgp--;
+
                UNSET_FLAG(zif->rtadv.ra_configured, BGP_RA_CONFIGURED);
                if (!CHECK_FLAG(zif->rtadv.ra_configured,
                                VTY_RA_INTERVAL_CONFIGURED))
@@ -2766,6 +2774,8 @@ void rtadv_vrf_terminate(struct zebra_vrf *zvrf)
 
 void rtadv_cmd_init(void)
 {
+       interfaces_configured_for_ra_from_bgp = 0;
+
        hook_register(zebra_if_extra_info, nd_dump_vty);
        hook_register(zebra_if_config_wr, rtadv_config_write);
 
@@ -2865,6 +2875,11 @@ static int if_leave_all_router(int sock, struct interface *ifp)
        return 0;
 }
 
+bool rtadv_compiled_in(void)
+{
+       return true;
+}
+
 #else
 void rtadv_vrf_init(struct zebra_vrf *zvrf)
 {
@@ -2920,4 +2935,14 @@ void zebra_interface_radv_enable(ZAPI_HANDLER_ARGS)
        return;
 }
 
+bool rtadv_compiled_in(void)
+{
+       return false;
+}
+
 #endif /* HAVE_RTADV */
+
+uint32_t rtadv_get_interfaces_configured_from_bgp(void)
+{
+       return interfaces_configured_for_ra_from_bgp;
+}
index 7b71ee45a217e00028a33f607b1504d6e7e89897..a95174b22b0e58b7c16f7fb5d60136eef2578c1d 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _ZEBRA_RTADV_H
 #define _ZEBRA_RTADV_H
 
+#include "zebra.h"
 #include "vty.h"
 #include "zebra/interface.h"
 
@@ -161,6 +162,8 @@ extern void zebra_interface_radv_disable(ZAPI_HANDLER_ARGS);
 extern void zebra_interface_radv_enable(ZAPI_HANDLER_ARGS);
 extern void rtadv_add_prefix(struct zebra_if *zif, const struct prefix_ipv6 *p);
 extern void rtadv_delete_prefix(struct zebra_if *zif, const struct prefix *p);
+extern uint32_t rtadv_get_interfaces_configured_from_bgp(void);
+extern bool rtadv_compiled_in(void);
 
 #ifdef __cplusplus
 }
index ba0cb5c96436e72b376a11977342b40361dc6e60..6726efe1dfa12779741c5f596a0158e09a5e2203 100644 (file)
@@ -61,6 +61,7 @@
 #include "zebra/kernel_netlink.h"
 #include "zebra/table_manager.h"
 #include "zebra/zebra_script.h"
+#include "zebra/rtadv.h"
 
 extern int allow_delete;
 
@@ -3994,6 +3995,14 @@ DEFUN (show_zebra,
        else
                vty_out(vty, "Asic offload is not being used\n");
 
+       if (rtadv_compiled_in()) {
+               vty_out(vty, "Router Advertisements are compiled with FRR\n");
+               if (rtadv_get_interfaces_configured_from_bgp())
+                       vty_out(vty, "RFC 5549 is being used by BGP\n");
+       } else
+               vty_out(vty,
+                       "Router Advertisements are not compiled with FRR\n");
+
        vty_out(vty, "Kernel %ssupport Nexthop Groups\n",
                zrouter.supports_nhgs ? "does " : "does not ");