From 0884f1644b19dd6e70a48a6c29fd5d201b264d6d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 23 Feb 2023 14:22:33 -0500 Subject: lib, bgpd: bmp was not specifying l2vpn afi The l2vpn afi was not being properly displayed when a show run was being issued. Add a afi2str_lower function and use it. Fixes: #12867 Signed-off-by: Donald Sharp --- lib/prefix.c | 17 +++++++++++++++++ lib/prefix.h | 1 + 2 files changed, 18 insertions(+) (limited to 'lib') diff --git a/lib/prefix.c b/lib/prefix.c index b3d81aa24..a6aae08a6 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -123,6 +123,23 @@ afi_t family2afi(int family) return 0; } +const char *afi2str_lower(afi_t afi) +{ + switch (afi) { + case AFI_IP: + return "ipv4"; + case AFI_IP6: + return "ipv6"; + case AFI_L2VPN: + return "l2vpn"; + case AFI_MAX: + case AFI_UNSPEC: + return "bad-value"; + } + + assert(!"Reached end of function we should never reach"); +} + const char *afi2str(afi_t afi) { switch (afi) { diff --git a/lib/prefix.h b/lib/prefix.h index a6435be1b..9c5728370 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -383,6 +383,7 @@ extern afi_t family2afi(int); extern const char *family2str(int family); extern const char *safi2str(safi_t safi); extern const char *afi2str(afi_t afi); +extern const char *afi2str_lower(afi_t afi); static inline afi_t prefix_afi(union prefixconstptr pu) { -- cgit v1.2.3