From: Donald Sharp Date: Fri, 13 May 2022 14:25:13 +0000 (-0400) Subject: zebra: Add encap and group type decoding to nexthop dump X-Git-Tag: base_8.3~66^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c30c6070279b57025102859a30355f5cc68602f5;p=matthieu%2Ffrr.git zebra: Add encap and group type decoding to nexthop dump Add the ability to give data about the nexthop group type and encap type so that it is human readable. Signed-off-by: Donald Sharp --- diff --git a/zebra/debug_nl.c b/zebra/debug_nl.c index b7d12bf537..98b3a9ed50 100644 --- a/zebra/debug_nl.c +++ b/zebra/debug_nl.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -1234,6 +1235,42 @@ next_rta: goto next_rta; } +static const char *lwt_type2str(uint16_t type) +{ + switch (type) { + case LWTUNNEL_ENCAP_NONE: + return "NONE"; + case LWTUNNEL_ENCAP_MPLS: + return "MPLS"; + case LWTUNNEL_ENCAP_IP: + return "IPv4"; + case LWTUNNEL_ENCAP_ILA: + return "ILA"; + case LWTUNNEL_ENCAP_IP6: + return "IPv6"; + case LWTUNNEL_ENCAP_SEG6: + return "SEG6"; + case LWTUNNEL_ENCAP_BPF: + return "BPF"; + case LWTUNNEL_ENCAP_SEG6_LOCAL: + return "SEG6_LOCAL"; + default: + return "UNKNOWN"; + } +} + +static const char *nhg_type2str(uint16_t type) +{ + switch (type) { + case NEXTHOP_GRP_TYPE_MPATH: + return "MULTIPATH"; + case NEXTHOP_GRP_TYPE_RES: + return "RESILIENT MULTIPATH"; + default: + return "UNKNOWN"; + } +} + static void nlnh_dump(struct nhmsg *nhm, size_t msglen) { struct rtattr *rta; @@ -1275,9 +1312,12 @@ next_rta: nhgrp[i].weight); break; case NHA_ENCAP_TYPE: + u16v = *(uint16_t *)RTA_DATA(rta); + zlog_debug(" %s", lwt_type2str(u16v)); + break; case NHA_GROUP_TYPE: u16v = *(uint16_t *)RTA_DATA(rta); - zlog_debug(" %d", u16v); + zlog_debug(" %s", nhg_type2str(u16v)); break; case NHA_BLACKHOLE: /* NOTHING */