From ff42dd64fabc23c2b407a5894486d74f13dd8286 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 14 Nov 2025 09:45:47 +0200 Subject: [PATCH] bgpd: Load resolver_init() not only when BMP is enabled This fixes the issue when BMP module is not loaded and we try to use `debug resolver`. $ vtysh -c "debug resolver" % [BGP] Unknown command: debug resolver Signed-off-by: Donatas Abraitis --- bgpd/bgp_bmp.c | 1 - bgpd/bgp_main.c | 2 ++ bgpd/bgpd.h | 1 + bgpd/subdir.am | 4 +++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index 1b9fdc49b497..a8f18786001f 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -3418,7 +3418,6 @@ static int bgp_bmp_init(struct event_loop *tm) install_element(VIEW_NODE, &show_bmp_cmd); - resolver_init(tm); return 0; } diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index d032444a7d9c..b2b35ff4f466 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -528,6 +528,8 @@ int main(int argc, char **argv) /* BGP related initialization. */ bgp_init((unsigned short)instance); + resolver_init(bm->master); + if (list_isempty(bm->addresses)) { snprintf(bgpd_di.startinfo, sizeof(bgpd_di.startinfo), ", bgp@:%d", bm->port); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 0a2432e41b37..a186451a6ca5 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -17,6 +17,7 @@ #include "srv6.h" #include "iana_afi.h" #include "asn.h" +#include "resolver.h" PREDECL_LIST(zebra_announce); PREDECL_LIST(zebra_l2_vni); diff --git a/bgpd/subdir.am b/bgpd/subdir.am index 07a9df979c7c..e30035885aea 100644 --- a/bgpd/subdir.am +++ b/bgpd/subdir.am @@ -195,6 +195,9 @@ bgpd_bgp_btoa_SOURCES = bgpd/bgp_btoa.c # RFPLDADD is set in bgpd/rfp-example/librfp/subdir.am bgpd_bgpd_LDADD = bgpd/libbgp.a $(RFPLDADD) lib/libfrr.la $(LIBYANG_LIBS) $(LIBCAP) $(LIBM) $(UST_LIBS) +if CARES +bgpd_bgpd_LDADD += lib/libfrrcares.la +endif bgpd_bgp_btoa_LDADD = bgpd/libbgp.a $(RFPLDADD) lib/libfrr.la $(LIBYANG_LIBS) $(LIBCAP) $(LIBM) $(UST_LIBS) bgpd_bgpd_snmp_la_SOURCES = bgpd/bgp_snmp_bgp4.c bgpd/bgp_snmp_bgp4v2.c bgpd/bgp_snmp.c bgpd/bgp_mplsvpn_snmp.c @@ -208,7 +211,6 @@ bgpd_bgpd_rpki_la_LDFLAGS = $(MODULE_LDFLAGS) bgpd_bgpd_rpki_la_LIBADD = $(RTRLIB_LIBS) bgpd_bgpd_bmp_la_SOURCES = bgpd/bgp_bmp.c -bgpd_bgpd_bmp_la_LIBADD = lib/libfrrcares.la bgpd_bgpd_bmp_la_LDFLAGS = $(MODULE_LDFLAGS) clippy_scan += \