]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: rfapi was not using internal zlog_backtrace()
authorDonald Sharp <sharpd@nvidia.com>
Thu, 4 Jan 2024 19:18:16 +0000 (14:18 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 4 Jan 2024 19:18:16 +0000 (14:18 -0500)
The rfapi code was not using the zlog_backtrace()
functionality.  Let's just convert over to using
the proper functionality that we have built in now.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/rfapi/rfapi.c
bgpd/rfapi/rfapi_import.c
bgpd/rfapi/rfapi_import.h

index ff7137bdd90824766da49e7cd9bf1acb08a9591b..a2c86d1eae9d1b7b8f2d517155828b9d1ffb1ce8 100644 (file)
 #include "bgpd/rfapi/rfapi_encap_tlv.h"
 #include "bgpd/rfapi/vnc_debug.h"
 
-#ifdef HAVE_GLIBC_BACKTRACE
-/* for backtrace and friends */
-#include <execinfo.h>
-#endif /* HAVE_GLIBC_BACKTRACE */
-
 #define DEBUG_CLEANUP 0
 
 struct ethaddr rfapi_ethaddr0 = {{0}};
@@ -2091,24 +2086,7 @@ int rfapi_close(void *handle)
        vnc_zlog_debug_verbose("%s: rfd=%p", __func__, rfd);
 
 #ifdef RFAPI_WHO_IS_CALLING_ME
-#ifdef HAVE_GLIBC_BACKTRACE
-#define RFAPI_DEBUG_BACKTRACE_NENTRIES 5
-       {
-               void *buf[RFAPI_DEBUG_BACKTRACE_NENTRIES];
-               char **syms;
-               int i;
-               size_t size;
-
-               size = backtrace(buf, RFAPI_DEBUG_BACKTRACE_NENTRIES);
-               syms = backtrace_symbols(buf, size);
-               for (i = 0; i < size && i < RFAPI_DEBUG_BACKTRACE_NENTRIES;
-                    ++i) {
-                       vnc_zlog_debug_verbose("backtrace[%2d]: %s", i,
-                                              syms[i]);
-               }
-               free(syms);
-       }
-#endif
+       zlog_backtrace(LOG_INFO);
 #endif
 
        bgp = rfd->bgp;
index a93e186f8d82e26470bea119b9fcb5b07eb4314d..f9789adad259d8a9073e9539c618ff982818fb15 100644 (file)
 #include "bgpd/rfapi/rfapi_encap_tlv.h"
 #include "bgpd/rfapi/vnc_debug.h"
 
-#ifdef HAVE_GLIBC_BACKTRACE
-/* for backtrace and friends */
-#include <execinfo.h>
-#endif /* HAVE_GLIBC_BACKTRACE */
-
 #undef DEBUG_MONITOR_MOVE_SHORTER
 #undef DEBUG_RETURNED_NHL
 #undef DEBUG_ROUTE_COUNTERS
@@ -77,32 +72,6 @@ struct rfapi_withdraw {
        int lockoffset;
 };
 
-/*
- * DEBUG FUNCTION
- * It's evil and fiendish. It's compiler-dependent.
- * ? Might need LDFLAGS -rdynamic to produce all function names
- */
-void rfapiDebugBacktrace(void)
-{
-#ifdef HAVE_GLIBC_BACKTRACE
-#define RFAPI_DEBUG_BACKTRACE_NENTRIES 200
-       void *buf[RFAPI_DEBUG_BACKTRACE_NENTRIES];
-       char **syms;
-       size_t i;
-       size_t size;
-
-       size = backtrace(buf, RFAPI_DEBUG_BACKTRACE_NENTRIES);
-       syms = backtrace_symbols(buf, size);
-
-       for (i = 0; i < size && i < RFAPI_DEBUG_BACKTRACE_NENTRIES; ++i) {
-               vnc_zlog_debug_verbose("backtrace[%2zu]: %s", i, syms[i]);
-       }
-
-       free(syms);
-#else
-#endif
-}
-
 /*
  * DEBUG FUNCTION
  * Count remote routes and compare with actively-maintained values.
@@ -1709,7 +1678,7 @@ struct rfapi_next_hop_entry *rfapiRouteNode2NextHopList(
 
 #ifdef DEBUG_RETURNED_NHL
        vnc_zlog_debug_verbose("%s: called with node pfx=%rRN", __func__, rn);
-       rfapiDebugBacktrace();
+       zlog_backtrace(LOG_INFO);
 #endif
 
        rfapiQprefix2Rprefix(p, &rprefix);
index dd06afe7e26aaff2f43eac9c11a1a9dde3b537d2..1a37e1c2dbfea474a66c89365c45d1602bcb97b6 100644 (file)
@@ -57,8 +57,6 @@ struct rfapi_import_table {
 
 extern uint8_t rfapiRfpCost(struct attr *attr);
 
-extern void rfapiDebugBacktrace(void);
-
 extern void rfapiCheckRouteCount(void);
 
 /*