summaryrefslogtreecommitdiffstats
path: root/bgpd/rfapi/rfapi.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bgpd/rfapi/rfapi.c83
1 files changed, 30 insertions, 53 deletions
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index ff7137b..382af05 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -46,11 +46,6 @@
#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}};
@@ -371,20 +366,19 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
for (bpi = (bn ? bgp_dest_get_bgp_path_info(bn) : NULL); bpi;
bpi = bpi->next) {
-
vnc_zlog_debug_verbose(
"%s: trying bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p, local_pref=%" PRIu64,
__func__, bpi, bpi->peer, bpi->type, bpi->sub_type,
- (bpi->extra ? bpi->extra->vnc.export.rfapi_handle
+ (bpi->extra ? bpi->extra->vnc->vnc.export.rfapi_handle
: NULL),
CHECK_FLAG(bpi->attr->flag,
ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)
- ? bpi->attr->local_pref : 0));
-
- if (bpi->peer == peer && bpi->type == type
- && bpi->sub_type == sub_type && bpi->extra
- && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
+ ? bpi->attr->local_pref
+ : 0));
+ if (bpi->peer == peer && bpi->type == type &&
+ bpi->sub_type == sub_type && bpi->extra &&
+ bpi->extra->vnc->vnc.export.rfapi_handle == (void *)rfd) {
vnc_zlog_debug_verbose("%s: matched it", __func__);
break;
@@ -397,8 +391,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
* route. Leave the route itself in place.
* TBD add return code reporting of success/failure
*/
- if (!bpi || !bpi->extra
- || !bpi->extra->vnc.export.local_nexthops) {
+ if (!bpi || !bpi->extra ||
+ !bpi->extra->vnc->vnc.export.local_nexthops) {
/*
* no local nexthops
*/
@@ -414,16 +408,16 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
struct listnode *node;
struct rfapi_nexthop *pLnh = NULL;
- for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc.export.local_nexthops,
+ for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc->vnc.export
+ .local_nexthops,
node, pLnh)) {
-
if (prefix_same(&pLnh->addr, &lnh->addr)) {
break;
}
}
if (pLnh) {
- listnode_delete(bpi->extra->vnc.export.local_nexthops,
+ listnode_delete(bpi->extra->vnc->vnc.export.local_nexthops,
pLnh);
/* silly rabbit, listnode_delete doesn't invoke
@@ -464,8 +458,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
/*
* Delete local_nexthops list
*/
- if (bpi->extra && bpi->extra->vnc.export.local_nexthops)
- list_delete(&bpi->extra->vnc.export.local_nexthops);
+ if (bpi->extra && bpi->extra->vnc->vnc.export.local_nexthops)
+ list_delete(&bpi->extra->vnc->vnc.export.local_nexthops);
bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
bgp_path_info_delete(bn, bpi);
@@ -907,11 +901,10 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
*/
for (bpi = bgp_dest_get_bgp_path_info(bn); bpi; bpi = bpi->next) {
/* probably only need to check
- * bpi->extra->vnc.export.rfapi_handle */
- if (bpi->peer == rfd->peer && bpi->type == type
- && bpi->sub_type == sub_type && bpi->extra
- && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
-
+ * bpi->extra->vnc->vnc.export.rfapi_handle */
+ if (bpi->peer == rfd->peer && bpi->type == type &&
+ bpi->sub_type == sub_type && bpi->extra &&
+ bpi->extra->vnc->vnc.export.rfapi_handle == (void *)rfd) {
break;
}
}
@@ -923,11 +916,11 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
* what is advertised via BGP
*/
if (lnh) {
- if (!bpi->extra->vnc.export.local_nexthops) {
+ if (!bpi->extra->vnc->vnc.export.local_nexthops) {
/* TBD make arrangements to free when needed */
- bpi->extra->vnc.export.local_nexthops =
+ bpi->extra->vnc->vnc.export.local_nexthops =
list_new();
- bpi->extra->vnc.export.local_nexthops->del =
+ bpi->extra->vnc->vnc.export.local_nexthops->del =
rfapi_nexthop_free;
}
@@ -937,10 +930,9 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
struct listnode *node;
struct rfapi_nexthop *pLnh = NULL;
- for (ALL_LIST_ELEMENTS_RO(
- bpi->extra->vnc.export.local_nexthops,
- node, pLnh)) {
-
+ for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc->vnc.export
+ .local_nexthops,
+ node, pLnh)) {
if (prefix_same(&pLnh->addr, &lnh->addr)) {
break;
}
@@ -951,9 +943,9 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
*/
if (!pLnh) {
pLnh = rfapi_nexthop_new(lnh);
- listnode_add(
- bpi->extra->vnc.export.local_nexthops,
- pLnh);
+ listnode_add(bpi->extra->vnc->vnc.export
+ .local_nexthops,
+ pLnh);
}
}
@@ -1025,7 +1017,9 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
/* save backref to rfapi handle */
bgp_path_info_extra_get(new);
- new->extra->vnc.export.rfapi_handle = (void *)rfd;
+ new->extra->vnc = XCALLOC(MTYPE_BGP_ROUTE_EXTRA_VNC,
+ sizeof(struct bgp_path_info_extra_vnc));
+ new->extra->vnc->vnc.export.rfapi_handle = (void *)rfd;
encode_label(label_val, &new->extra->label[0]);
/* debug */
@@ -2091,24 +2085,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;