zebra: Add knowledge about RA and RFC 5549 to show zebra

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>
This commit is contained in:
Donald Sharp 2022-02-04 08:04:23 -05:00
parent 281686819d
commit 954e1a2bc9
3 changed files with 37 additions and 0 deletions

View 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;
}

View 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
}

View 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 ");