diff --git a/COMMUNITY.md b/COMMUNITY.md index 0cc8e8d1ce..7d08ed58dc 100644 --- a/COMMUNITY.md +++ b/COMMUNITY.md @@ -261,40 +261,6 @@ Please don’t reformat existing files (or only sections modified by your changes), even if they don’t follow the standard. This makes it very hard to highlight the changes -### Changing / Deprecate an existing exported interface - -If changing an exported interface, please try to deprecate the interface in an -orderly manner. If at all possible, try to retain the old deprecated interface -as is, or functionally equivalent. Make a note of when the interface was -deprecated and guard the deprecated interface definitions in the header file, -i.e.: - -``` -/* Deprecated: 20050406 */ -#if !defined(QUAGGA_NO_DEPRECATED_INTERFACES) -#warning "Using deprecated (interface(s)|function(s))" -... -#endif /* QUAGGA_NO_DEPRECATED_INTERFACES */ -``` - -This is to ensure that the core Quagga sources do not use the deprecated -interfaces (you should update Quagga sources to use new interfaces, if -applicable), while allowing external sources to continue to build. Deprecated -interfaces should be excised in the next unstable cycle. - -Note: If you wish, you can test for GCC and use a function marked with the -`deprecated` attribute. However, you must provide the warning for other -compilers. If changing or removing a command definition, ensure that you -properly deprecate it - use the `_DEPRECATED` form of the appropriate `DEFUN` -macro. This is critical. Even if the command can no longer function, you MUST -still implement it as a do-nothing stub. - -Failure to follow this causes grief for systems administrators, as an upgrade -may cause daemons to fail to start because of unrecognised commands. Deprecated -commands should be excised in the next unstable cycle. A list of deprecated -commands should be collated for each release. - - ### Compile-Time conditional code Many users access PROJECT via binary packages from 3rd party sources; @@ -324,3 +290,14 @@ frobnicate (); Note that the former approach requires ensuring that `SOME_SYMBOL` will be defined (watch your `AC_DEFINE`s). + +### Debug-Guards in code + +Debugs are an important methodology to allow developers to fix issues +found in the code after it has been released. The caveat here is +that the developer must remember that people will be using the code +at scale and in ways that can be unexpected for the original implementor. +As such debugs MUST be guarded in such a way that they can be turned off. +This PROJECT has the ability to turn on/off debugs from the CLI and it is +expected that the developer will use this convention to allow control +of their debugs. \ No newline at end of file diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index c528fcdcde..9a49051a96 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -151,28 +151,6 @@ bgp_md5_unset (struct peer *peer) return bgp_md5_set_password (peer, NULL); } -/* Update BGP socket send buffer size */ -static void -bgp_update_sock_send_buffer_size (int fd) -{ - int size = BGP_SOCKET_SNDBUF_SIZE; - int optval; - socklen_t optlen = sizeof(optval); - - if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &optval, &optlen) < 0) - { - zlog_err("getsockopt of SO_SNDBUF failed %s\n", safe_strerror(errno)); - return; - } - if (optval < size) - { - if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) < 0) - { - zlog_err("Couldn't increase send buffer: %s\n", safe_strerror(errno)); - } - } -} - int bgp_set_socket_ttl (struct peer *peer, int bgp_sock) { @@ -341,7 +319,7 @@ bgp_accept (struct thread *thread) } /* Set socket send buffer size */ - bgp_update_sock_send_buffer_size(bgp_sock); + setsockopt_so_sendbuf (bgp_sock, BGP_SOCKET_SNDBUF_SIZE); /* Check remote IP address */ peer1 = peer_lookup (bgp, &su); @@ -604,7 +582,7 @@ bgp_connect (struct peer *peer) set_nonblocking (peer->fd); /* Set socket send buffer size */ - bgp_update_sock_send_buffer_size(peer->fd); + setsockopt_so_sendbuf (peer->fd, BGP_SOCKET_SNDBUF_SIZE); if (bgp_set_socket_ttl (peer, peer->fd) < 0) return -1; diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index fa62f7051b..52c5267bf5 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -45,6 +45,7 @@ #include "bgpd/rfapi/vnc_export_bgp_p.h" #include "bgpd/rfapi/rfapi_vty.h" #include "bgpd/rfapi/vnc_import_bgp.h" +#include "bgpd/rfapi/vnc_debug.h" #if ENABLE_BGP_VNC @@ -184,12 +185,12 @@ bgp_rfapi_cfg_match_group ( char buf[BUFSIZ]; prefix2str (vn, buf, BUFSIZ); - zlog_debug ("%s: vn prefix: %s", __func__, buf); + vnc_zlog_debug_verbose ("%s: vn prefix: %s", __func__, buf); prefix2str (un, buf, BUFSIZ); - zlog_debug ("%s: un prefix: %s", __func__, buf); + vnc_zlog_debug_verbose ("%s: un prefix: %s", __func__, buf); - zlog_debug ("%s: rn_vn=%p, rn_un=%p, rfg_vn=%p, rfg_un=%p", + vnc_zlog_debug_verbose ("%s: rn_vn=%p, rn_un=%p, rfg_vn=%p, rfg_un=%p", __func__, rn_vn, rn_un, rfg_vn, rfg_un); } #endif @@ -216,7 +217,7 @@ bgp_rfapi_cfg_match_group ( return rfg; } } - zlog_debug ("%s: shouldn't happen, returning NULL when un and vn match", + vnc_zlog_debug_verbose ("%s: shouldn't happen, returning NULL when un and vn match", __func__); return NULL; /* shouldn't happen */ } @@ -774,7 +775,7 @@ vnc_redistribute_prechange (struct bgp *bgp) afi_t afi; int type; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); memset (redist_was_enabled, 0, sizeof (redist_was_enabled)); /* @@ -794,7 +795,7 @@ vnc_redistribute_prechange (struct bgp *bgp) } } } - zlog_debug ("%s: return", __func__); + vnc_zlog_debug_verbose ("%s: return", __func__); } static void @@ -803,7 +804,7 @@ vnc_redistribute_postchange (struct bgp *bgp) afi_t afi; int type; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); /* * If we turned off redistribution above, turn it back on. Doing so * will tell zebra to resend the routes to us @@ -818,7 +819,7 @@ vnc_redistribute_postchange (struct bgp *bgp) } } } - zlog_debug ("%s: return", __func__); + vnc_zlog_debug_verbose ("%s: return", __func__); } DEFUN (vnc_redistribute_rh_roo_localadmin, @@ -1797,12 +1798,12 @@ DEFUN (vnc_export_nvegroup, listnode_add (bgp->rfapi_cfg->rfg_export_direct_bgp_l, rfgn); - zlog_debug ("%s: testing rfg_new", __func__); + vnc_zlog_debug_verbose ("%s: testing rfg_new", __func__); if (rfg_new) { - zlog_debug ("%s: testing bgp grp mode enabled", __func__); + vnc_zlog_debug_verbose ("%s: testing bgp grp mode enabled", __func__); if (VNC_EXPORT_BGP_GRP_ENABLED (bgp->rfapi_cfg)) - zlog_debug ("%s: calling vnc_direct_bgp_add_group", __func__); + vnc_zlog_debug_verbose ("%s: calling vnc_direct_bgp_add_group", __func__); vnc_direct_bgp_add_group (bgp, rfg_new); } @@ -1883,7 +1884,7 @@ DEFUN (vnc_no_export_nvegroup, if (rfgn->name && !strcmp (rfgn->name, argv[6]->arg)) { - zlog_debug ("%s: matched \"%s\"", __func__, rfgn->name); + vnc_zlog_debug_verbose ("%s: matched \"%s\"", __func__, rfgn->name); if (rfgn->rfg) vnc_direct_bgp_del_group (bgp, rfgn->rfg); free (rfgn->name); @@ -1900,7 +1901,7 @@ DEFUN (vnc_no_export_nvegroup, node, nnode, rfgn)) { - zlog_debug ("does rfg \"%s\" match?", rfgn->name); + vnc_zlog_debug_verbose ("does rfg \"%s\" match?", rfgn->name); if (rfgn->name && !strcmp (rfgn->name, argv[6]->arg)) { if (rfgn->rfg) @@ -2417,13 +2418,13 @@ vnc_prefix_list_update (struct bgp *bgp) if (!bgp) { - zlog_debug ("%s: No BGP process is configured", __func__); + vnc_zlog_debug_verbose ("%s: No BGP process is configured", __func__); return; } if (!(hc = bgp->rfapi_cfg)) { - zlog_debug ("%s: rfapi not configured", __func__); + vnc_zlog_debug_verbose ("%s: rfapi not configured", __func__); return; } @@ -2505,17 +2506,17 @@ vnc_routemap_update (struct bgp *bgp, const char *unused) struct rfapi_cfg *hc; int i; - zlog_debug ("%s(arg=%s)", __func__, unused); + vnc_zlog_debug_verbose ("%s(arg=%s)", __func__, unused); if (!bgp) { - zlog_debug ("%s: No BGP process is configured", __func__); + vnc_zlog_debug_verbose ("%s: No BGP process is configured", __func__); return; } if (!(hc = bgp->rfapi_cfg)) { - zlog_debug ("%s: rfapi not configured", __func__); + vnc_zlog_debug_verbose ("%s: rfapi not configured", __func__); return; } @@ -2580,7 +2581,7 @@ vnc_routemap_update (struct bgp *bgp, const char *unused) vnc_redistribute_prechange (bgp); vnc_redistribute_postchange (bgp); - zlog_debug ("%s done", __func__); + vnc_zlog_debug_verbose ("%s done", __func__); } static void @@ -2590,14 +2591,14 @@ vnc_routemap_event (route_map_event_t type, /* ignored */ struct listnode *mnode, *mnnode; struct bgp *bgp; - zlog_debug ("%s(event type=%d)", __func__, type); + vnc_zlog_debug_verbose ("%s(event type=%d)", __func__, type); if (bm->bgp == NULL) /* may be called during cleanup */ return; for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp)) vnc_routemap_update (bgp, rmap_name); - zlog_debug ("%s: done", __func__); + vnc_zlog_debug_verbose ("%s: done", __func__); } /*------------------------------------------------------------------------- @@ -2700,7 +2701,7 @@ DEFUN (vnc_nve_group, node, nnode, rfgn)) { - zlog_debug ("%s: ezport zebra: checking if \"%s\" == \"%s\"", + vnc_zlog_debug_verbose ("%s: ezport zebra: checking if \"%s\" == \"%s\"", __func__, rfgn->name, rfg->name); if (!strcmp (rfgn->name, rfg->name)) { @@ -3223,7 +3224,7 @@ DEFUN (vnc_nve_group_rt_both, if (is_export_zebra) { - zlog_debug ("%s: is_export_zebra", __func__); + vnc_zlog_debug_verbose ("%s: is_export_zebra", __func__); vnc_zebra_del_group (bgp, rfg); } diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 40e59f18e6..e74b370f43 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -409,14 +409,14 @@ del_vnc_route ( } bn = bgp_afi_node_get (bgp->rib[afi][safi], afi, safi, p, prd); - zlog_debug + vnc_zlog_debug_verbose ("%s: peer=%p, prefix=%s, prd=%s afi=%d, safi=%d bn=%p, bn->info=%p", __func__, peer, buf, buf2, afi, safi, bn, (bn ? bn->info : NULL)); for (bi = (bn ? bn->info : NULL); bi; bi = bi->next) { - zlog_debug + vnc_zlog_debug_verbose ("%s: trying bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p", __func__, bi, bi->peer, bi->type, bi->sub_type, (bi->extra ? bi->extra->vnc.export.rfapi_handle : NULL)); @@ -427,7 +427,7 @@ del_vnc_route ( bi->extra && bi->extra->vnc.export.rfapi_handle == (void *) rfd) { - zlog_debug ("%s: matched it", __func__); + vnc_zlog_debug_verbose ("%s: matched it", __func__); break; } @@ -445,7 +445,7 @@ del_vnc_route ( /* * no local nexthops */ - zlog_debug ("%s: lnh list already empty at prefix %s", + vnc_zlog_debug_verbose ("%s: lnh list already empty at prefix %s", __func__, buf); goto done; } @@ -475,7 +475,7 @@ del_vnc_route ( } else { - zlog_debug ("%s: desired lnh not found %s", __func__, buf); + vnc_zlog_debug_verbose ("%s: desired lnh not found %s", __func__, buf); } goto done; } @@ -494,7 +494,7 @@ del_vnc_route ( prefix2str (p, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */ - zlog_debug ("%s: Found route (safi=%d) to delete at prefix %s", + vnc_zlog_debug_verbose ("%s: Found route (safi=%d) to delete at prefix %s", __func__, safi, buf); if (safi == SAFI_MPLS_VPN) @@ -529,7 +529,7 @@ del_vnc_route ( } else { - zlog_debug ("%s: Couldn't find route (safi=%d) at prefix %s", + vnc_zlog_debug_verbose ("%s: Couldn't find route (safi=%d) at prefix %s", __func__, safi, buf); } done: @@ -657,7 +657,7 @@ add_vnc_route ( * Encap mode not enabled. UN addresses will be communicated * via VNC Tunnel subtlv instead. */ - zlog_debug ("%s: encap mode not enabled, not adding SAFI_ENCAP route", + vnc_zlog_debug_verbose ("%s: encap mode not enabled, not adding SAFI_ENCAP route", __func__); return; } @@ -668,7 +668,7 @@ add_vnc_route ( if (rfapiRaddr2Qprefix (nexthop, &pfx_buf)) { - zlog_debug + vnc_zlog_debug_verbose ("%s: can't set pfx to vn addr, not adding SAFI_MPLS_VPN route", __func__); return; @@ -702,7 +702,7 @@ add_vnc_route ( afi = family2afi (p->family); assert (afi == AFI_IP || afi == AFI_IP6); - zlog_debug ("%s: afi=%s, safi=%s", __func__, afi2str (afi), + vnc_zlog_debug_verbose ("%s: afi=%s, safi=%s", __func__, afi2str (afi), safi2str (safi)); /* Make default attribute. Produces already-interned attr.aspath */ @@ -763,7 +763,7 @@ add_vnc_route ( if (safi == SAFI_ENCAP) { /* Encap SAFI not used with MPLS */ - zlog_debug ("%s: mpls tunnel type, encap safi omitted", __func__); + vnc_zlog_debug_verbose ("%s: mpls tunnel type, encap safi omitted", __func__); aspath_unintern (&attr.aspath); /* Unintern original. */ bgp_attr_extra_free (&attr); return; @@ -820,7 +820,7 @@ add_vnc_route ( lt = htonl (*lifetime); memcpy (encaptlv->value, <, 4); attr.extra->vnc_subtlvs = encaptlv; - zlog_debug ("%s: set Encap Attr Prefix Lifetime to %d", + vnc_zlog_debug_verbose ("%s: set Encap Attr Prefix Lifetime to %d", __func__, *lifetime); } @@ -936,7 +936,7 @@ add_vnc_route ( ecommunity_free (&attr.extra->ecommunity); attr.extra->ecommunity = NULL; } - zlog_debug ("%s: attr.extra->ecommunity=%p", __func__, + vnc_zlog_debug_verbose ("%s: attr.extra->ecommunity=%p", __func__, attr.extra->ecommunity); @@ -1088,7 +1088,7 @@ add_vnc_route ( bgp_attr_unintern (&new_attr); bgp_unlock_node (bn); - zlog_info ("%s: Found route (safi=%d) at prefix %s, no change", + vnc_zlog_debug_any ("%s: Found route (safi=%d) at prefix %s, no change", __func__, safi, buf); goto done; @@ -1145,7 +1145,7 @@ add_vnc_route ( bgp_process (bgp, bn, afi, safi); bgp_unlock_node (bn); - zlog_info ("%s: Found route (safi=%d) at prefix %s, changed attr", + vnc_zlog_debug_any ("%s: Found route (safi=%d) at prefix %s, changed attr", __func__, safi, buf); goto done; @@ -1167,8 +1167,12 @@ add_vnc_route ( encode_label (label_val, new->extra->tag); /* debug */ - zlog_debug ("%s: printing BI", __func__); - rfapiPrintBi (NULL, new); + + if (VNC_DEBUG(VERBOSE)) + { + vnc_zlog_debug_verbose ("%s: printing BI", __func__); + rfapiPrintBi (NULL, new); + } bgp_aggregate_increment (bgp, p, new, afi, safi); bgp_info_add (bn, new); @@ -1192,7 +1196,7 @@ add_vnc_route ( bgp_unlock_node (bn); bgp_process (bgp, bn, afi, safi); - zlog_info ("%s: Added route (safi=%s) at prefix %s (bn=%p, prd=%s)", + vnc_zlog_debug_any ("%s: Added route (safi=%s) at prefix %s (bn=%p, prd=%s)", __func__, safi2str (safi), buf, bn, buf2); done: @@ -1200,7 +1204,7 @@ done: rfapiProcessUpdate (rfd->peer, rfd, p, prd, new_attr, afi, safi, type, sub_type, &label_val); - zlog_debug ("%s: looped back import route (safi=%d)", __func__, safi); + vnc_zlog_debug_verbose ("%s: looped back import route (safi=%d)", __func__, safi); } uint32_t @@ -1604,23 +1608,23 @@ rfapi_query_inner ( /* preemptive */ if (!bgp) { - zlog_debug ("%s: No BGP instance, returning ENXIO", __func__); + vnc_zlog_debug_verbose ("%s: No BGP instance, returning ENXIO", __func__); return ENXIO; } if (!bgp->rfapi) { - zlog_debug ("%s: No RFAPI instance, returning ENXIO", __func__); + vnc_zlog_debug_verbose ("%s: No RFAPI instance, returning ENXIO", __func__); return ENXIO; } if (bgp->rfapi->flags & RFAPI_INCALLBACK) { - zlog_debug ("%s: Called during calback, returning EDEADLK", __func__); + vnc_zlog_debug_verbose ("%s: Called during calback, returning EDEADLK", __func__); return EDEADLK; } if (!is_valid_rfd (rfd)) { - zlog_debug ("%s: invalid handle, returning EBADF", __func__); + vnc_zlog_debug_verbose ("%s: invalid handle, returning EBADF", __func__); return EBADF; } @@ -1667,7 +1671,7 @@ rfapi_query_inner ( prefix2str (&p, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */ - zlog_debug ("%s(rfd=%p, target=%s, ppNextHop=%p)", + vnc_zlog_debug_verbose ("%s(rfd=%p, target=%s, ppNextHop=%p)", __func__, rfd, buf, ppNextHopEntry); } @@ -1753,7 +1757,7 @@ rfapi_query_inner ( if (RFAPI_0_PREFIX (&p)) { - zlog_debug ("%s: 0-prefix", __func__); + vnc_zlog_debug_verbose ("%s: 0-prefix", __func__); /* * Generate nexthop list for caller @@ -1784,7 +1788,7 @@ rfapi_query_inner ( if (!rn->info) { route_unlock_node (rn); - zlog_debug ("%s: VPN route not found, returning ENOENT", __func__); + vnc_zlog_debug_verbose ("%s: VPN route not found, returning ENOENT", __func__); return ENOENT; } @@ -1835,7 +1839,7 @@ done: if (!pNHE) { - zlog_debug ("%s: NO NHEs, returning ENOENT", __func__); + vnc_zlog_debug_verbose ("%s: NO NHEs, returning ENOENT", __func__); return ENOENT; } @@ -1856,7 +1860,7 @@ done: rfapi_free_next_hop_list (pNHE); } - zlog_debug ("%s: success", __func__); + vnc_zlog_debug_verbose ("%s: success", __func__); return 0; } @@ -1998,7 +2002,7 @@ rfapi_open ( { char buf[2][INET_ADDRSTRLEN]; - zlog_debug ("%s: VN=%s UN=%s", __func__, + vnc_zlog_debug_verbose ("%s: VN=%s UN=%s", __func__, rfapiRfapiIpAddr2Str (vn, buf[0], INET_ADDRSTRLEN), rfapiRfapiIpAddr2Str (un, buf[1], INET_ADDRSTRLEN)); } @@ -2135,7 +2139,7 @@ rfapi_open ( rfapiRfapiIpAddr2Str (vn, buf_vn, BUFSIZ); rfapiRfapiIpAddr2Str (un, buf_un, BUFSIZ); - zlog_debug ("%s: new HD with VN=%s UN=%s cookie=%p", + vnc_zlog_debug_verbose ("%s: new HD with VN=%s UN=%s cookie=%p", __func__, buf_vn, buf_un, userdata); } @@ -2290,7 +2294,7 @@ rfapi_close_inner (struct rfapi_descriptor *rfd, struct bgp *bgp) */ if (rfd->peer) { - zlog_debug ("%s: calling peer_delete(%p), #%d", + vnc_zlog_debug_verbose ("%s: calling peer_delete(%p), #%d", __func__, rfd->peer, rfd->peer->lock); peer_delete (rfd->peer); } @@ -2308,7 +2312,7 @@ rfapi_close (void *handle) struct bgp *bgp; struct rfapi *h; - zlog_debug ("%s: rfd=%p", __func__, rfd); + vnc_zlog_debug_verbose ("%s: rfd=%p", __func__, rfd); #if RFAPI_WHO_IS_CALLING_ME #ifdef HAVE_GLIBC_BACKTRACE @@ -2323,7 +2327,7 @@ rfapi_close (void *handle) syms = backtrace_symbols (buf, size); for (i = 0; i < size && i < RFAPI_DEBUG_BACKTRACE_NENTRIES; ++i) { - zlog_debug ("backtrace[%2d]: %s", i, syms[i]); + vnc_zlog_debug_verbose ("backtrace[%2d]: %s", i, syms[i]); } free (syms); } @@ -2350,7 +2354,7 @@ rfapi_close (void *handle) if (!CHECK_FLAG (rfd->flags, RFAPI_HD_FLAG_CLOSING_ADMINISTRATIVELY)) { work_queue_add (h->deferred_close_q, handle); - zlog_debug ("%s: added handle %p to deferred close queue", + vnc_zlog_debug_verbose ("%s: added handle %p to deferred close queue", __func__, handle); } return 0; @@ -2359,11 +2363,11 @@ rfapi_close (void *handle) if (CHECK_FLAG (rfd->flags, RFAPI_HD_FLAG_CLOSING_ADMINISTRATIVELY)) { - zlog_debug ("%s administrative close rfd=%p", __func__, rfd); + vnc_zlog_debug_verbose ("%s administrative close rfd=%p", __func__, rfd); if (h && h->rfp_methods.close_cb) { - zlog_debug ("%s calling close callback rfd=%p", __func__, rfd); + vnc_zlog_debug_verbose ("%s calling close callback rfd=%p", __func__, rfd); /* * call the callback fairly early so that it can still lookup un/vn @@ -2575,7 +2579,7 @@ rfapi_register ( prefix2str (&p, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */ - zlog_debug + vnc_zlog_debug_verbose ("%s(rfd=%p, pfx=%s, lifetime=%d, opts_un=%p, opts_vn=%p, action=%s)", __func__, rfd, buf, lifetime, options_un, options_vn, action_str); } @@ -2588,12 +2592,12 @@ rfapi_register ( bgp = rfd->bgp; if (!bgp) { - zlog_debug ("%s: no BGP instance: returning ENXIO", __func__); + vnc_zlog_debug_verbose ("%s: no BGP instance: returning ENXIO", __func__); return ENXIO; } if (!bgp->rfapi) { - zlog_debug ("%s: no RFAPI instance: returning ENXIO", __func__); + vnc_zlog_debug_verbose ("%s: no RFAPI instance: returning ENXIO", __func__); return ENXIO; } if (!rfd->rfg) @@ -2602,7 +2606,7 @@ rfapi_register ( { ++bgp->rfapi->stat.count_registrations_failed; } - zlog_debug ("%s: rfd=%p, no RF GRP instance: returning ESTALE", + vnc_zlog_debug_verbose ("%s: rfd=%p, no RF GRP instance: returning ESTALE", __func__, rfd); return ESTALE; } @@ -2613,7 +2617,7 @@ rfapi_register ( { ++bgp->rfapi->stat.count_registrations_failed; } - zlog_debug ("%s: in callback: returning EDEADLK", __func__); + vnc_zlog_debug_verbose ("%s: in callback: returning EDEADLK", __func__); return EDEADLK; } @@ -2623,7 +2627,7 @@ rfapi_register ( { ++bgp->rfapi->stat.count_registrations_failed; } - zlog_debug ("%s: invalid handle: returning EBADF", __func__); + vnc_zlog_debug_verbose ("%s: invalid handle: returning EBADF", __func__); return EBADF; } @@ -2647,7 +2651,7 @@ rfapi_register ( { if (!pfx_mac) { - zlog_debug ("%s: missing mac addr that is required for host 0 pfx", + vnc_zlog_debug_verbose ("%s: missing mac addr that is required for host 0 pfx", __func__); if (RFAPI_REGISTER_ADD == action) { @@ -2657,7 +2661,7 @@ rfapi_register ( } if (rfapiRaddr2Qprefix (&rfd->vn_addr, &pfx_vn_buf)) { - zlog_debug ("%s: handle has bad vn_addr: returning EBADF", + vnc_zlog_debug_verbose ("%s: handle has bad vn_addr: returning EBADF", __func__); if (RFAPI_REGISTER_ADD == action) { @@ -2804,14 +2808,14 @@ rfapi_register ( adv_tunnel = 1; } - zlog_debug ("%s: adv_tunnel = %d", __func__, adv_tunnel); + vnc_zlog_debug_verbose ("%s: adv_tunnel = %d", __func__, adv_tunnel); if (adv_tunnel) { - zlog_debug ("%s: announcing tunnel route", __func__); + vnc_zlog_debug_verbose ("%s: announcing tunnel route", __func__); rfapiTunnelRouteAnnounce (bgp, rfd, &rfd->max_prefix_lifetime); } - zlog_debug ("%s: calling add_vnc_route", __func__); + vnc_zlog_debug_verbose ("%s: calling add_vnc_route", __func__); local_pref = rfp_cost_to_localpref (prefix->cost); @@ -2873,7 +2877,7 @@ rfapi_register ( ecommunity_free (&rtlist); /* sets rtlist = NULL */ } - zlog_debug ("%s: success", __func__); + vnc_zlog_debug_verbose ("%s: success", __func__); return 0; } @@ -3997,11 +4001,11 @@ rfapi_delete (struct bgp *bgp) int rfapi_set_autord_from_vn (struct prefix_rd *rd, struct rfapi_ip_addr *vn) { - zlog_debug ("%s: auto-assigning RD", __func__); + vnc_zlog_debug_verbose ("%s: auto-assigning RD", __func__); if (vn->addr_family != AF_INET && vn->addr_family != AF_INET6) { - zlog_debug ("%s: can't auto-assign RD, VN addr family is not IPv4" + vnc_zlog_debug_verbose ("%s: can't auto-assign RD, VN addr family is not IPv4" "|v6" , __func__); return EAFNOSUPPORT; @@ -4022,7 +4026,7 @@ rfapi_set_autord_from_vn (struct prefix_rd *rd, struct rfapi_ip_addr *vn) buf[0] = 0; prefix_rd2str (rd, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; - zlog_debug ("%s: auto-RD is set to %s", __func__, buf); + vnc_zlog_debug_verbose ("%s: auto-RD is set to %s", __func__, buf); } return 0; } @@ -4095,7 +4099,7 @@ rfapi_rfp_get_or_init_group_config_default ( if (rfc->default_rfp_cfg == NULL && size > 0) { rfc->default_rfp_cfg = XCALLOC (MTYPE_RFAPI_RFP_GROUP_CFG, size); - zlog_debug ("%s: allocated, size=%d", __func__, size); + vnc_zlog_debug_verbose ("%s: allocated, size=%d", __func__, size); } return rfc->default_rfp_cfg; @@ -4120,7 +4124,7 @@ rfapi_rfp_get_or_init_group_config_nve ( if (rfg->rfp_cfg == NULL && size > 0) { rfg->rfp_cfg = XCALLOC (MTYPE_RFAPI_RFP_GROUP_CFG, size); - zlog_debug ("%s: allocated, size=%d", __func__, size); + vnc_zlog_debug_verbose ("%s: allocated, size=%d", __func__, size); } return rfg->rfp_cfg; @@ -4144,7 +4148,7 @@ rfapi_rfp_get_or_init_group_config_l2 ( if (rfg->rfp_cfg == NULL && size > 0) { rfg->rfp_cfg = XCALLOC (MTYPE_RFAPI_RFP_GROUP_CFG, size); - zlog_debug ("%s: allocated, size=%d", __func__, size); + vnc_zlog_debug_verbose ("%s: allocated, size=%d", __func__, size); } return rfg->rfp_cfg; @@ -4382,7 +4386,7 @@ rfapi_rfp_get_l2_group_config_ptr_lni ( (search_cb == NULL || !search_cb (criteria, rfg->rfp_cfg))) { if (rfg->rfp_cfg == NULL) - zlog_debug ("%s: returning rfp group config for lni=0", __func__); + vnc_zlog_debug_verbose ("%s: returning rfp group config for lni=0", __func__); return rfg->rfp_cfg; } } diff --git a/bgpd/rfapi/rfapi_ap.c b/bgpd/rfapi/rfapi_ap.c index b0d5ab35c9..4b8eb9511b 100644 --- a/bgpd/rfapi/rfapi_ap.c +++ b/bgpd/rfapi/rfapi_ap.c @@ -56,6 +56,7 @@ #include "bgpd/rfapi/rfapi_rib.h" #include "bgpd/rfapi/rfapi_ap.h" +#include "bgpd/rfapi/vnc_debug.h" /* * Per-NVE Advertised prefixes @@ -240,7 +241,7 @@ rfapiApWithdrawAll (struct bgp *bgp, struct rfapi_descriptor *rfd) /* * Bad: it means we can't delete the route */ - zlog_debug ("%s: BAD: handle has bad vn_addr: skipping", + vnc_zlog_debug_verbose ("%s: BAD: handle has bad vn_addr: skipping", __func__); continue; } @@ -264,12 +265,12 @@ rfapiApAdjustLifetimeStats ( int find_max = 0; int find_min = 0; - zlog_debug ("%s: rfd=%p, pOldLife=%p, pNewLife=%p", + vnc_zlog_debug_verbose ("%s: rfd=%p, pOldLife=%p, pNewLife=%p", __func__, rfd, old_lifetime, new_lifetime); if (old_lifetime) - zlog_debug ("%s: OldLife=%d", __func__, *old_lifetime); + vnc_zlog_debug_verbose ("%s: OldLife=%d", __func__, *old_lifetime); if (new_lifetime) - zlog_debug ("%s: NewLife=%d", __func__, *new_lifetime); + vnc_zlog_debug_verbose ("%s: NewLife=%d", __func__, *new_lifetime); if (new_lifetime) { @@ -407,7 +408,7 @@ rfapiApAdjustLifetimeStats ( struct rfapi_adb *adb; int rc; - zlog_debug ("%s: walking to find new min/max", __func__); + vnc_zlog_debug_verbose ("%s: walking to find new min/max", __func__); cursor = NULL; for (rc = skiplist_next (rfd->advertised.ipN_by_prefix, @@ -454,7 +455,7 @@ rfapiApAdjustLifetimeStats ( rfd->min_prefix_lifetime = min; } - zlog_debug ("%s: returning advertise=%d, min=%d, max=%d", + vnc_zlog_debug_verbose ("%s: returning advertise=%d, min=%d, max=%d", __func__, advertise, rfd->min_prefix_lifetime, rfd->max_prefix_lifetime); diff --git a/bgpd/rfapi/rfapi_descriptor_rfp_utils.c b/bgpd/rfapi/rfapi_descriptor_rfp_utils.c index b2a8689881..8106186d97 100644 --- a/bgpd/rfapi/rfapi_descriptor_rfp_utils.c +++ b/bgpd/rfapi/rfapi_descriptor_rfp_utils.c @@ -34,6 +34,7 @@ #include "bgpd/rfapi/rfapi.h" #include "bgpd/rfapi/rfapi_private.h" #include "bgpd/rfapi/rfapi_descriptor_rfp_utils.h" +#include "bgpd/rfapi/vnc_debug.h" void * @@ -41,7 +42,7 @@ rfapi_create_generic (struct rfapi_ip_addr *vn, struct rfapi_ip_addr *un) { struct rfapi_descriptor *rfd; rfd = XCALLOC (MTYPE_RFAPI_DESC, sizeof (struct rfapi_descriptor)); - zlog_debug ("%s: rfd=%p", __func__, rfd); + vnc_zlog_debug_verbose ("%s: rfd=%p", __func__, rfd); rfd->vn_addr = *vn; rfd->un_addr = *un; return (void *) rfd; diff --git a/bgpd/rfapi/rfapi_encap_tlv.c b/bgpd/rfapi/rfapi_encap_tlv.c index 0a5962ccb6..d8713a26b2 100644 --- a/bgpd/rfapi/rfapi_encap_tlv.c +++ b/bgpd/rfapi/rfapi_encap_tlv.c @@ -36,6 +36,7 @@ #include "bgpd/rfapi/rfapi_monitor.h" #include "bgpd/rfapi/rfapi_vty.h" #include "bgpd/rfapi/bgp_rfapi_cfg.h" +#include "bgpd/rfapi/vnc_debug.h" static void rfapi_add_endpoint_address_to_subtlv ( @@ -249,7 +250,7 @@ rfapi_encap_tlv_to_un_option (struct attr *attr) break; default: - zlog_debug ("%s: unknown tunnel type %d", + vnc_zlog_debug_verbose ("%s: unknown tunnel type %d", __func__, attre->encap_tunneltype); rc = -1; break; diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 77da4f9eed..0b46702bb0 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -113,7 +113,7 @@ rfapiDebugBacktrace (void) for (i = 0; i < size && i < RFAPI_DEBUG_BACKTRACE_NENTRIES; ++i) { - zlog_debug ("backtrace[%2lu]: %s", i, syms[i]); + vnc_zlog_debug_verbose ("backtrace[%2lu]: %s", i, syms[i]); } free (syms); @@ -191,19 +191,19 @@ rfapiCheckRouteCount () if (it->holddown_count[afi] != holddown_count) { - zlog_debug ("%s: it->holddown_count %d != holddown_count %d", + vnc_zlog_debug_verbose ("%s: it->holddown_count %d != holddown_count %d", __func__, it->holddown_count[afi], holddown_count); assert (0); } if (it->remote_count[afi] != remote_count) { - zlog_debug ("%s: it->remote_count %d != remote_count %d", + vnc_zlog_debug_verbose ("%s: it->remote_count %d != remote_count %d", __func__, it->remote_count[afi], remote_count); assert (0); } if (it->imported_count[afi] != imported_count) { - zlog_debug ("%s: it->imported_count %d != imported_count %d", + vnc_zlog_debug_verbose ("%s: it->imported_count %d != imported_count %d", __func__, it->imported_count[afi], imported_count); assert (0); } @@ -280,7 +280,7 @@ rfapiCheckRefcount (struct route_node *rn, safi_t safi, int lockoffset) if (count_bi + count_monitor + lockoffset != rn->lock) { - zlog_debug + vnc_zlog_debug_verbose ("%s: count_bi=%d, count_monitor=%d, lockoffset=%d, rn->lock=%d", __func__, count_bi, count_monitor, lockoffset, rn->lock); assert (0); @@ -299,7 +299,7 @@ rfapi_deferred_close_workfunc (struct work_queue *q, void *data) assert (!(h->flags & RFAPI_INCALLBACK)); rfapi_close (rfd); - zlog_debug ("%s: completed deferred close on handle %p", __func__, rfd); + vnc_zlog_debug_verbose ("%s: completed deferred close on handle %p", __func__, rfd); return WQ_SUCCESS; } @@ -499,7 +499,7 @@ rfapiGetUnAddrOfVpnBi (struct bgp_info *bi, struct prefix *p) if (p) p->family = 0; #if DEBUG_ENCAP_MONITOR - zlog_debug ("%s: bi->extra->vnc.import.un_family is 0, no UN addr", + vnc_zlog_debug_verbose ("%s: bi->extra->vnc.import.un_family is 0, no UN addr", __func__); #endif break; @@ -561,7 +561,7 @@ rfapiBgpInfoFree (struct bgp_info *goner) if (goner->peer) { - zlog_debug ("%s: calling peer_unlock(%p), #%d", + vnc_zlog_debug_verbose ("%s: calling peer_unlock(%p), #%d", __func__, goner->peer, goner->peer->lock); peer_unlock (goner->peer); } @@ -676,7 +676,7 @@ rfapiMonitorMoveShorter (struct route_node *original_vpn_node, int lockoffset) prefix2str (&original_vpn_node->p, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; - zlog_debug ("%s: called with node pfx=%s", __func__, buf); + vnc_zlog_debug_verbose ("%s: called with node pfx=%s", __func__, buf); } #endif @@ -692,7 +692,7 @@ rfapiMonitorMoveShorter (struct route_node *original_vpn_node, int lockoffset) if (!rfapiGetUnAddrOfVpnBi (bi, &pfx)) { #if DEBUG_MONITOR_MOVE_SHORTER - zlog_debug ("%s: have valid UN at original node, no change", + vnc_zlog_debug_verbose ("%s: have valid UN at original node, no change", __func__); #endif return NULL; @@ -822,7 +822,7 @@ rfapiMonitorMoveShorter (struct route_node *original_vpn_node, int lockoffset) prefix2str (&par->p, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; - zlog_debug ("%s: moved to node pfx=%s", __func__, buf); + vnc_zlog_debug_verbose ("%s: moved to node pfx=%s", __func__, buf); } #endif @@ -856,7 +856,7 @@ rfapiMonitorMoveLonger (struct route_node *new_vpn_node) if (!bi) { - zlog_debug ("%s: no valid routes at node %p, so not attempting moves", + vnc_zlog_debug_verbose ("%s: no valid routes at node %p, so not attempting moves", __func__, new_vpn_node); return; } @@ -872,7 +872,7 @@ rfapiMonitorMoveLonger (struct route_node *new_vpn_node) if (!par) { - zlog_debug ("%s: no parent nodes with monitors, done", __func__); + vnc_zlog_debug_verbose ("%s: no parent nodes with monitors, done", __func__); return; } @@ -1089,7 +1089,7 @@ rfapiEcommunitiesIntersect (struct ecommunity *e1, struct ecommunity *e2) char *s1, *s2; s1 = ecommunity_ecom2str (e1, ECOMMUNITY_FORMAT_DISPLAY); s2 = ecommunity_ecom2str (e2, ECOMMUNITY_FORMAT_DISPLAY); - zlog_debug ("%s: e1[%s], e2[%s]", __func__, s1, s2); + vnc_zlog_debug_verbose ("%s: e1[%s], e2[%s]", __func__, s1, s2); XFREE (MTYPE_ECOMMUNITY_STR, s1); XFREE (MTYPE_ECOMMUNITY_STR, s2); } @@ -1350,7 +1350,7 @@ rfapiRouteInfo2NextHopEntry ( int have_vnc_tunnel_un = 0; #if DEBUG_ENCAP_MONITOR - zlog_debug ("%s: entry, bi %p, rn %p", __func__, bi, rn); + vnc_zlog_debug_verbose ("%s: entry, bi %p, rn %p", __func__, bi, rn); #endif new = XCALLOC (MTYPE_RFAPI_NEXTHOP, sizeof (struct rfapi_next_hop_entry)); @@ -1501,7 +1501,7 @@ rfapiRouteInfo2NextHopEntry ( new->un_options = rfapi_encap_tlv_to_un_option (bi->attr); #if DEBUG_ENCAP_MONITOR - zlog_debug ("%s: line %d: have_vnc_tunnel_un=%d", + vnc_zlog_debug_verbose ("%s: line %d: have_vnc_tunnel_un=%d", __func__, __LINE__, have_vnc_tunnel_un); #endif @@ -1561,7 +1561,7 @@ rfapiDumpNode (struct route_node *rn) { struct bgp_info *bi; - zlog_debug ("%s: rn=%p", __func__, rn); + vnc_zlog_debug_verbose ("%s: rn=%p", __func__, rn); for (bi = rn->info; bi; bi = bi->next) { struct prefix pfx; @@ -1578,7 +1578,7 @@ rfapiDumpNode (struct route_node *rn) nr = 0; } - zlog_debug (" bi=%p, nr=%d, flags=0x%x, extra=%p, ctrc=%d", + vnc_zlog_debug_verbose (" bi=%p, nr=%d, flags=0x%x, extra=%p, ctrc=%d", bi, nr, bi->flags, bi->extra, ctrc); } } @@ -1622,7 +1622,7 @@ rfapiNhlAddNodeRoutes ( if (removed && !CHECK_FLAG (bi->flags, BGP_INFO_REMOVED)) { #if DEBUG_RETURNED_NHL - zlog_debug ("%s: want holddown, this route not holddown, skip", + vnc_zlog_debug_verbose ("%s: want holddown, this route not holddown, skip", __func__); #endif continue; @@ -1662,7 +1662,7 @@ rfapiNhlAddNodeRoutes ( prefix2str (&pfx_vn, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; /* guarantee NUL-terminated */ - zlog_debug ("%s: already put VN/nexthop %s, skip", __func__, buf); + vnc_zlog_debug_verbose ("%s: already put VN/nexthop %s, skip", __func__, buf); #endif continue; } @@ -1670,7 +1670,7 @@ rfapiNhlAddNodeRoutes ( if (rfapiGetUnAddrOfVpnBi (bi, &pfx_un)) { #if DEBUG_ENCAP_MONITOR - zlog_debug ("%s: failed to get UN address of this VPN bi", + vnc_zlog_debug_verbose ("%s: failed to get UN address of this VPN bi", __func__); #endif continue; @@ -1832,7 +1832,7 @@ rfapiRouteNode2NextHopList ( prefix2str (&rn->p, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; - zlog_debug ("%s: called with node pfx=%s", __func__, buf); + vnc_zlog_debug_verbose ("%s: called with node pfx=%s", __func__, buf); } rfapiDebugBacktrace (); #endif @@ -1854,7 +1854,7 @@ rfapiRouteNode2NextHopList ( { count += rfapiNhlAddSubtree (rn, lifetime, &answer, &last, NULL, exclude_vnaddr, rfd_rib_table, pfx_target_original); - zlog_debug ("%s: %d nexthops, answer=%p", __func__, count, answer); + vnc_zlog_debug_verbose ("%s: %d nexthops, answer=%p", __func__, count, answer); #if DEBUG_RETURNED_NHL rfapiPrintNhl (NULL, answer); #endif @@ -1911,7 +1911,7 @@ rfapiRouteNode2NextHopList ( exclude_vnaddr, rfd_rib_table, pfx_target_original); } - zlog_debug ("%s: %d nexthops, answer=%p", __func__, count, answer); + vnc_zlog_debug_verbose ("%s: %d nexthops, answer=%p", __func__, count, answer); #if DEBUG_RETURNED_NHL rfapiPrintNhl (NULL, answer); #endif @@ -1960,7 +1960,7 @@ rfapiRouteTable2NextHopList ( } } - zlog_debug ("%s: returning %d routes", __func__, count); + vnc_zlog_debug_verbose ("%s: returning %d routes", __func__, count); return biglist; } @@ -1984,14 +1984,14 @@ rfapiEthRouteNode2NextHopList ( NULL, rib_rn, pfx_target_original); #if DEBUG_ENCAP_MONITOR - zlog_debug ("%s: node %p: %d non-holddown routes", __func__, rn, count); + vnc_zlog_debug_verbose ("%s: node %p: %d non-holddown routes", __func__, rn, count); #endif if (!count) { count = rfapiNhlAddNodeRoutes (rn, rprefix, lifetime, 1, &answer, &last, exclude_vnaddr, rib_rn, pfx_target_original); - zlog_debug ("%s: node %p: %d holddown routes", __func__, rn, count); + vnc_zlog_debug_verbose ("%s: node %p: %d holddown routes", __func__, rn, count); } if (rib_rn) @@ -2055,7 +2055,7 @@ rfapiEthRouteTable2NextHopList ( } } - zlog_debug ("%s: returning %d routes", __func__, count); + vnc_zlog_debug_verbose ("%s: returning %d routes", __func__, count); return biglist; } @@ -2078,8 +2078,8 @@ rfapiBgpInfoAttachSorted ( if (VNC_DEBUG(IMPORT_BI_ATTACH)) { - zlog_debug ("%s: info_new->peer=%p", __func__, info_new->peer); - zlog_debug ("%s: info_new->peer->su_remote=%p", __func__, + vnc_zlog_debug_verbose ("%s: info_new->peer=%p", __func__, info_new->peer); + vnc_zlog_debug_verbose ("%s: info_new->peer->su_remote=%p", __func__, info_new->peer->su_remote); } @@ -2093,7 +2093,7 @@ rfapiBgpInfoAttachSorted ( break; } } - zlog_debug ("%s: prev=%p, next=%p", __func__, prev, next); + vnc_zlog_debug_verbose ("%s: prev=%p, next=%p", __func__, prev, next); if (prev) { prev->next = info_new; @@ -2222,7 +2222,7 @@ rfapiItBiIndexAdd ( { char buf[BUFSIZ]; prefix_rd2str (&bi->extra->vnc.import.rd, buf, BUFSIZ); - zlog_debug ("%s: bi %p, peer %p, rd %s", __func__, bi, bi->peer, buf); + vnc_zlog_debug_verbose ("%s: bi %p, peer %p, rd %s", __func__, bi, bi->peer, buf); } sl = RFAPI_RDINDEX_W_ALLOC (rn); @@ -2277,7 +2277,7 @@ rfapiItBiIndexDump (struct route_node *rn) buf_aux_pfx[BUFSIZ - 1] = 0; } - zlog_debug ("bi %p, peer %p, rd %s, aux_prefix %s", k, k->peer, buf, + vnc_zlog_debug_verbose ("bi %p, peer %p, rd %s, aux_prefix %s", k, k->peer, buf, buf_aux_pfx); } } @@ -2315,7 +2315,7 @@ rfapiItBiIndexSearch ( buf_aux_pfx[BUFSIZ - 1] = 0; } - zlog_debug ("%s want prd=%s, peer=%p, aux_prefix=%s", + vnc_zlog_debug_verbose ("%s want prd=%s, peer=%p, aux_prefix=%s", __func__, buf, peer, buf_aux_pfx); rfapiItBiIndexDump (rn); } @@ -2325,7 +2325,7 @@ rfapiItBiIndexSearch ( if (sl->count < 3) { #if DEBUG_BI_SEARCH - zlog_debug ("%s: short list algorithm", __func__); + vnc_zlog_debug_verbose ("%s: short list algorithm", __func__); #endif /* if short list, linear search might be faster */ for (bi_result = rn->info; bi_result; bi_result = bi_result->next) @@ -2334,7 +2334,7 @@ rfapiItBiIndexSearch ( { char buf[BUFSIZ]; prefix_rd2str (&bi_result->extra->vnc.import.rd, buf, BUFSIZ); - zlog_debug ("%s: bi has prd=%s, peer=%p", __func__, + vnc_zlog_debug_verbose ("%s: bi has prd=%s, peer=%p", __func__, buf, bi_result->peer); } #endif @@ -2344,7 +2344,7 @@ rfapiItBiIndexSearch ( { #if DEBUG_BI_SEARCH - zlog_debug ("%s: peer and RD same, doing aux_prefix check", + vnc_zlog_debug_verbose ("%s: peer and RD same, doing aux_prefix check", __func__); #endif if (!aux_prefix || @@ -2353,7 +2353,7 @@ rfapiItBiIndexSearch ( { #if DEBUG_BI_SEARCH - zlog_debug ("%s: match", __func__); + vnc_zlog_debug_verbose ("%s: match", __func__); #endif break; } @@ -2382,13 +2382,13 @@ rfapiItBiIndexSearch ( if (rc) { #if DEBUG_BI_SEARCH - zlog_debug ("%s: no match", __func__); + vnc_zlog_debug_verbose ("%s: no match", __func__); #endif return NULL; } #if DEBUG_BI_SEARCH - zlog_debug ("%s: matched bi=%p", __func__, bi_result); + vnc_zlog_debug_verbose ("%s: matched bi=%p", __func__, bi_result); #endif return bi_result; @@ -2405,7 +2405,7 @@ rfapiItBiIndexDel ( { char buf[BUFSIZ]; prefix_rd2str (&bi->extra->vnc.import.rd, buf, BUFSIZ); - zlog_debug ("%s: bi %p, peer %p, rd %s", __func__, bi, bi->peer, buf); + vnc_zlog_debug_verbose ("%s: bi %p, peer %p, rd %s", __func__, bi, bi->peer, buf); } sl = RFAPI_RDINDEX (rn); @@ -2459,7 +2459,7 @@ rfapiMonitorEncapAdd ( /* for easy lookup when deleting vpn route */ vpn_bi->extra->vnc.import.hme = m; - zlog_debug + vnc_zlog_debug_verbose ("%s: it=%p, vpn_bi=%p, afi=%d, encap rn=%p, setting vpn_bi->extra->vnc.import.hme=%p", __func__, import_table, vpn_bi, afi, rn, m); @@ -2472,7 +2472,7 @@ rfapiMonitorEncapDelete (struct bgp_info *vpn_bi) /* * Remove encap monitor */ - zlog_debug ("%s: vpn_bi=%p", __func__, vpn_bi); + vnc_zlog_debug_verbose ("%s: vpn_bi=%p", __func__, vpn_bi); if (vpn_bi->extra) { struct rfapi_monitor_encap *hme = vpn_bi->extra->vnc.import.hme; @@ -2480,7 +2480,7 @@ rfapiMonitorEncapDelete (struct bgp_info *vpn_bi) if (hme) { - zlog_debug ("%s: hme=%p", __func__, hme); + vnc_zlog_debug_verbose ("%s: hme=%p", __func__, hme); /* Refcount checking takes too long here */ //RFAPI_CHECK_REFCOUNT(hme->rn, SAFI_ENCAP, 0); @@ -2527,7 +2527,7 @@ rfapiWithdrawTimerVPN (struct thread *t) { char buf[BUFSIZ]; - zlog_debug ("%s: removing bi %p at prefix %s/%d", + vnc_zlog_debug_verbose ("%s: removing bi %p at prefix %s/%d", __func__, bi, rfapi_ntop (wcb->node->p.family, &wcb->node->p.u.prefix, buf, @@ -2576,7 +2576,7 @@ rfapiWithdrawTimerVPN (struct thread *t) } } - zlog_debug ("%s: has_valid_duplicate=%d", __func__, + vnc_zlog_debug_verbose ("%s: has_valid_duplicate=%d", __func__, has_valid_duplicate); if (!has_valid_duplicate) @@ -2593,7 +2593,7 @@ rfapiWithdrawTimerVPN (struct thread *t) */ if (!RFAPI_MONITOR_VPN (wcb->node)) { - zlog_debug ("%s: no VPN monitors at this node", __func__); + vnc_zlog_debug_verbose ("%s: no VPN monitors at this node", __func__); goto done; } @@ -2666,7 +2666,7 @@ rfapiNexthop2Prefix (struct attr *attr, struct prefix *p) break; default: - zlog_debug ("%s: Family is unknown = %d", + vnc_zlog_debug_verbose ("%s: Family is unknown = %d", __func__, p->family); } } @@ -2691,7 +2691,7 @@ rfapiAttrNexthopAddrDifferent (struct prefix *p1, struct prefix *p2) { if (!p1 || !p2) { - zlog_debug ("%s: p1 or p2 is NULL", __func__); + vnc_zlog_debug_verbose ("%s: p1 or p2 is NULL", __func__); return 1; } @@ -2751,10 +2751,10 @@ rfapiCopyUnEncap2VPN (struct bgp_info *encap_bi, struct bgp_info *vpn_bi) /* * instrumentation to debug segfault of 091127 */ - zlog_debug ("%s: vpn_bi=%p", __func__, vpn_bi); + vnc_zlog_debug_verbose ("%s: vpn_bi=%p", __func__, vpn_bi); if (vpn_bi) { - zlog_debug ("%s: vpn_bi->extra=%p", __func__, vpn_bi->extra); + vnc_zlog_debug_verbose ("%s: vpn_bi->extra=%p", __func__, vpn_bi->extra); } vpn_bi->extra->vnc.import.un_family = AF_INET; @@ -2941,12 +2941,12 @@ rfapiBiStartWithdrawTimer ( * should already have a timer set up to * delete it. */ - zlog_debug ("%s: already being withdrawn, do nothing", __func__); + vnc_zlog_debug_verbose ("%s: already being withdrawn, do nothing", __func__); return; } rfapiGetVncLifetime (bi->attr, &lifetime); - zlog_debug ("%s: VNC lifetime is %u", __func__, lifetime); + vnc_zlog_debug_verbose ("%s: VNC lifetime is %u", __func__, lifetime); /* * withdrawn routes get to hang around for a while @@ -2955,7 +2955,7 @@ rfapiBiStartWithdrawTimer ( /* set timer to remove the route later */ lifetime = rfapiGetHolddownFromLifetime (lifetime); - zlog_debug ("%s: using timeout %u", __func__, lifetime); + vnc_zlog_debug_verbose ("%s: using timeout %u", __func__, lifetime); /* * Stash import_table, node, and info for use by timer @@ -2967,10 +2967,13 @@ rfapiBiStartWithdrawTimer ( wcb->info = bi; wcb->import_table = import_table; - zlog_debug - ("%s: wcb values: node=%p, info=%p, import_table=%p (bi follows)", - __func__, wcb->node, wcb->info, wcb->import_table); - rfapiPrintBi (NULL, bi); + if (VNC_DEBUG(VERBOSE)) + { + vnc_zlog_debug_verbose + ("%s: wcb values: node=%p, info=%p, import_table=%p (bi follows)", + __func__, wcb->node, wcb->info, wcb->import_table); + rfapiPrintBi (NULL, bi); + } assert (bi->extra); @@ -3059,7 +3062,7 @@ rfapiGetNexthop (struct attr *attr, struct prefix *prefix) prefix->u.prefix6 = attr->extra->mp_nexthop_global; break; default: - zlog_debug ("%s: unknown attr->extra->mp_nexthop_len %d", __func__, + vnc_zlog_debug_verbose ("%s: unknown attr->extra->mp_nexthop_len %d", __func__, attr->extra->mp_nexthop_len); return EINVAL; } @@ -3117,7 +3120,7 @@ rfapiBgpInfoFilteredImportEncap ( break; } - zlog_debug ("%s: entry: %s: prefix %s/%d", __func__, + vnc_zlog_debug_verbose ("%s: entry: %s: prefix %s/%d", __func__, action_str, inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ), p->prefixlen); @@ -3134,14 +3137,14 @@ rfapiBgpInfoFilteredImportEncap ( if (!attr || !attr->extra || !attr->extra->ecommunity) { - zlog_debug ("%s: attr, extra, or ecommunity missing, not importing", + vnc_zlog_debug_verbose ("%s: attr, extra, or ecommunity missing, not importing", __func__); return; } #if RFAPI_REQUIRE_ENCAP_BEEC if (!rfapiEcommunitiesMatchBeec (attr->extra->ecommunity)) { - zlog_debug ("%s: it=%p: no match for BGP Encapsulation ecommunity", + vnc_zlog_debug_verbose ("%s: it=%p: no match for BGP Encapsulation ecommunity", __func__, import_table); return; } @@ -3150,7 +3153,7 @@ rfapiBgpInfoFilteredImportEncap ( attr->extra->ecommunity)) { - zlog_debug ("%s: it=%p: no ecommunity intersection", + vnc_zlog_debug_verbose ("%s: it=%p: no ecommunity intersection", __func__, import_table); return; } @@ -3161,7 +3164,7 @@ rfapiBgpInfoFilteredImportEncap ( memset (&un_prefix, 0, sizeof (un_prefix)); /* keep valgrind happy */ if (rfapiGetNexthop (attr, &un_prefix)) { - zlog_debug ("%s: missing nexthop address", __func__); + vnc_zlog_debug_verbose ("%s: missing nexthop address", __func__); return; } } @@ -3188,7 +3191,7 @@ rfapiBgpInfoFilteredImportEncap ( rn = route_node_lookup (rt, p); #if DEBUG_ENCAP_MONITOR - zlog_debug ("%s: initial encap lookup (it=%p) rn=%p", + vnc_zlog_debug_verbose ("%s: initial encap lookup (it=%p) rn=%p", __func__, import_table, rn); #endif @@ -3215,7 +3218,7 @@ rfapiBgpInfoFilteredImportEncap ( * Does this bgp_info refer to the same route * as we are trying to add? */ - zlog_debug ("%s: comparing BI %p", __func__, bi); + vnc_zlog_debug_verbose ("%s: comparing BI %p", __func__, bi); /* @@ -3226,14 +3229,14 @@ rfapiBgpInfoFilteredImportEncap ( */ if (!bi->extra) { - zlog_debug ("%s: no bi->extra", __func__); + vnc_zlog_debug_verbose ("%s: no bi->extra", __func__); continue; } if (prefix_cmp ((struct prefix *) &bi->extra->vnc.import.rd, (struct prefix *) prd)) { - zlog_debug ("%s: prd does not match", __func__); + vnc_zlog_debug_verbose ("%s: prd does not match", __func__); continue; } @@ -3242,18 +3245,18 @@ rfapiBgpInfoFilteredImportEncap ( */ if (bi->peer != peer) { - zlog_debug ("%s: peer does not match", __func__); + vnc_zlog_debug_verbose ("%s: peer does not match", __func__); continue; } - zlog_debug ("%s: found matching bi", __func__); + vnc_zlog_debug_verbose ("%s: found matching bi", __func__); /* Same route. Delete this bi, replace with new one */ if (action == FIF_ACTION_WITHDRAW) { - zlog_debug ("%s: withdrawing at prefix %s/%d", + vnc_zlog_debug_verbose ("%s: withdrawing at prefix %s/%d", __func__, inet_ntop (rn->p.family, &rn->p.u.prefix, buf, BUFSIZ), rn->p.prefixlen); @@ -3265,7 +3268,7 @@ rfapiBgpInfoFilteredImportEncap ( } else { - zlog_debug ("%s: %s at prefix %s/%d", + vnc_zlog_debug_verbose ("%s: %s at prefix %s/%d", __func__, ((action == FIF_ACTION_KILL) ? "killing" : "replacing"), @@ -3339,7 +3342,7 @@ rfapiBgpInfoFilteredImportEncap ( rn = route_node_get (rt, p); } - zlog_debug ("%s: (afi=%d, rn=%p) inserting at prefix %s/%d", + vnc_zlog_debug_verbose ("%s: (afi=%d, rn=%p) inserting at prefix %s/%d", __func__, afi, rn, @@ -3377,7 +3380,7 @@ rfapiBgpInfoFilteredImportEncap ( if (!un_match) continue; - zlog_debug ("%s: removing holddown bi matching NVE of new route", + vnc_zlog_debug_verbose ("%s: removing holddown bi matching NVE of new route", __func__); if (bi->extra->vnc.import.timer) { @@ -3425,7 +3428,7 @@ rfapiBgpInfoFilteredImportEncap ( * iterate over the set of monitors at this ENCAP node. */ #if DEBUG_ENCAP_MONITOR - zlog_debug ("%s: examining monitors at rn=%p", __func__, rn); + vnc_zlog_debug_verbose ("%s: examining monitors at rn=%p", __func__, rn); #endif for (m = RFAPI_MONITOR_ENCAP (rn); m; m = m->next) { @@ -3598,7 +3601,7 @@ rfapiBgpInfoFilteredImportVPN ( if (import_table == bgp->rfapi->it_ce) is_it_ce = 1; - zlog_debug ("%s: entry: %s%s: prefix %s/%d: it %p, afi %s", __func__, + vnc_zlog_debug_verbose ("%s: entry: %s%s: prefix %s/%d: it %p, afi %s", __func__, (is_it_ce ? "CE-IT " : ""), action_str, rfapi_ntop (p->family, &p->u.prefix, buf, BUFSIZ), @@ -3616,7 +3619,7 @@ rfapiBgpInfoFilteredImportVPN ( if (!attr || !attr->extra || !attr->extra->ecommunity) { - zlog_debug ("%s: attr, extra, or ecommunity missing, not importing", + vnc_zlog_debug_verbose ("%s: attr, extra, or ecommunity missing, not importing", __func__); return; } @@ -3625,7 +3628,7 @@ rfapiBgpInfoFilteredImportVPN ( attr->extra->ecommunity)) { - zlog_debug ("%s: it=%p: no ecommunity intersection", + vnc_zlog_debug_verbose ("%s: it=%p: no ecommunity intersection", __func__, import_table); return; } @@ -3634,7 +3637,7 @@ rfapiBgpInfoFilteredImportVPN ( if (rfapiGetNexthop (attr, &vn_prefix)) { /* missing nexthop address would be a bad, bad thing */ - zlog_debug ("%s: missing nexthop", __func__); + vnc_zlog_debug_verbose ("%s: missing nexthop", __func__); return; } } @@ -3664,7 +3667,7 @@ rfapiBgpInfoFilteredImportVPN ( */ rn = route_node_lookup (rt, p); - zlog_debug ("%s: rn=%p", __func__, rn); + vnc_zlog_debug_verbose ("%s: rn=%p", __func__, rn); if (rn) { @@ -3694,7 +3697,7 @@ rfapiBgpInfoFilteredImportVPN ( */ assert (bi->type == type); - zlog_debug ("%s: found matching bi", __func__); + vnc_zlog_debug_verbose ("%s: found matching bi", __func__); /* * In the special CE table, withdrawals occur without holddown @@ -3711,7 +3714,7 @@ rfapiBgpInfoFilteredImportVPN ( int washolddown = CHECK_FLAG (bi->flags, BGP_INFO_REMOVED); - zlog_debug ("%s: withdrawing at prefix %s/%d%s", + vnc_zlog_debug_verbose ("%s: withdrawing at prefix %s/%d%s", __func__, rfapi_ntop (rn->p.family, &rn->p.u.prefix, buf, BUFSIZ), rn->p.prefixlen, @@ -3731,7 +3734,7 @@ rfapiBgpInfoFilteredImportVPN ( } else { - zlog_debug ("%s: %s at prefix %s/%d", + vnc_zlog_debug_verbose ("%s: %s at prefix %s/%d", __func__, ((action == FIF_ACTION_KILL) ? "killing" : "replacing"), @@ -3825,7 +3828,7 @@ rfapiBgpInfoFilteredImportVPN ( prefix2str (&vn_prefix, buf, sizeof (buf)); buf[BUFSIZ - 1] = 0; /* Not a big deal, just means VPN route got here first */ - zlog_debug ("%s: no encap route for vn addr %s", __func__, buf); + vnc_zlog_debug_verbose ("%s: no encap route for vn addr %s", __func__, buf); info_new->extra->vnc.import.un_family = 0; } @@ -3850,11 +3853,11 @@ rfapiBgpInfoFilteredImportVPN ( if ((AFI_ETHER == afi) && aux_prefix) { - zlog_debug ("%s: setting BI's aux_prefix", __func__); + vnc_zlog_debug_verbose ("%s: setting BI's aux_prefix", __func__); info_new->extra->vnc.import.aux_prefix = *aux_prefix; } - zlog_debug ("%s: inserting bi %p at prefix %s/%d #%d", + vnc_zlog_debug_verbose ("%s: inserting bi %p at prefix %s/%d #%d", __func__, info_new, rfapi_ntop (rn->p.family, &rn->p.u.prefix, buf, BUFSIZ), @@ -3875,8 +3878,11 @@ rfapiBgpInfoFilteredImportVPN ( if (import_table == bgp->rfapi->it_ce) vnc_direct_bgp_add_route_ce (bgp, rn, info_new); - zlog_debug ("%s: showing IT node", __func__); - rfapiShowItNode (NULL, rn); /* debug */ + if (VNC_DEBUG(VERBOSE)) + { + vnc_zlog_debug_verbose ("%s: showing IT node", __func__); + rfapiShowItNode (NULL, rn); /* debug */ + } rfapiMonitorEncapAdd (import_table, &vn_prefix, rn, info_new); @@ -3970,7 +3976,7 @@ rfapiBgpInfoFilteredImportVPN ( if (!un_match & !remote_peer_match) continue; - zlog_debug ("%s: removing holddown bi matching NVE of new route", + vnc_zlog_debug_verbose ("%s: removing holddown bi matching NVE of new route", __func__); if (bi->extra->vnc.import.timer) { @@ -4100,7 +4106,7 @@ rfapiProcessUpdate ( */ rc = rfapiEcommunityGetLNI (attr->extra->ecommunity, &lni); - zlog_debug + vnc_zlog_debug_verbose ("%s: rfapiEcommunityGetLNI returned %d, lni=%d, attr=%p, attr->extra=%p", __func__, rc, lni, attr, attr->extra); if (attr && attr->extra && !rc) @@ -4226,7 +4232,7 @@ rfapiProcessWithdraw ( { #if DEBUG_L2_EXTRA - zlog_debug + vnc_zlog_debug_verbose ("%s: calling rfapiBgpInfoFilteredImportVPN(it=%p, afi=AFI_ETHER)", __func__, it); #endif @@ -4608,7 +4614,7 @@ rfapiImportTableRefAdd (struct bgp *bgp, struct ecommunity *rt_import_list) break; } - zlog_debug ("%s: matched it=%p", __func__, it); + vnc_zlog_debug_verbose ("%s: matched it=%p", __func__, it); if (!it) { @@ -4696,7 +4702,7 @@ rfapiDeleteRemotePrefixesIt ( buf_pfx[1] = 0; } - zlog_debug ("%s: entry, p=%s, delete_active=%d, delete_holddown=%d", + vnc_zlog_debug_verbose ("%s: entry, p=%s, delete_active=%d, delete_holddown=%d", __func__, buf_pfx, delete_active, delete_holddown); } #endif @@ -4716,7 +4722,7 @@ rfapiDeleteRemotePrefixesIt ( if (!rt) continue; - zlog_debug ("%s: scanning rt for afi=%d", __func__, afi); + vnc_zlog_debug_verbose ("%s: scanning rt for afi=%d", __func__, afi); for (rn = route_top (rt); rn; rn = route_next (rn)) { @@ -4730,7 +4736,7 @@ rfapiDeleteRemotePrefixesIt ( prefix2str (p, p1line, BUFSIZ); prefix2str (&rn->p, p2line, BUFSIZ); - zlog_debug ("%s: want %s, have %s", __func__, p1line, p2line); + vnc_zlog_debug_any ("%s: want %s, have %s", __func__, p1line, p2line); } if (p && prefix_cmp (p, &rn->p)) @@ -4739,7 +4745,7 @@ rfapiDeleteRemotePrefixesIt ( { char buf_pfx[BUFSIZ]; prefix2str (&rn->p, buf_pfx, BUFSIZ); - zlog_debug ("%s: rn pfx=%s", __func__, buf_pfx); + vnc_zlog_debug_verbose ("%s: rn pfx=%s", __func__, buf_pfx); } /* TBD is this valid for afi == AFI_ETHER? */ @@ -4755,7 +4761,7 @@ rfapiDeleteRemotePrefixesIt ( int qct_valid = 0; int is_active = 0; - zlog_debug ("%s: examining bi %p", __func__, bi); + vnc_zlog_debug_verbose ("%s: examining bi %p", __func__, bi); if (bi->attr) { @@ -4767,7 +4773,7 @@ rfapiDeleteRemotePrefixesIt ( if (!qpt_valid || !prefix_match (vn, &qpt)) { #if DEBUG_L2_EXTRA - zlog_debug + vnc_zlog_debug_verbose ("%s: continue at vn && !qpt_valid || !prefix_match(vn, &qpt)", __func__); #endif @@ -4783,7 +4789,7 @@ rfapiDeleteRemotePrefixesIt ( if (!qct_valid || !prefix_match (un, &qct)) { #if DEBUG_L2_EXTRA - zlog_debug + vnc_zlog_debug_verbose ("%s: continue at un && !qct_valid || !prefix_match(un, &qct)", __func__); #endif @@ -4824,7 +4830,7 @@ rfapiDeleteRemotePrefixesIt ( is_active = 1; } - zlog_debug + vnc_zlog_debug_verbose ("%s: deleting bi %p (qct_valid=%d, qpt_valid=%d, delete_holddown=%d, delete_active=%d)", __func__, bi, qct_valid, qpt_valid, delete_holddown, delete_active); @@ -4867,7 +4873,7 @@ rfapiDeleteRemotePrefixesIt ( it->holddown_count[afi] += 1; rfapiExpireVpnNow (it, rn, bi, 1); - zlog_debug ("%s: incrementing count (is_active=%d)", + vnc_zlog_debug_verbose ("%s: incrementing count (is_active=%d)", __func__, is_active); if (is_active) @@ -4947,7 +4953,7 @@ rfapiDeleteRemotePrefixes ( for (it = h->imports; it; it = it->next) { - zlog_debug + vnc_zlog_debug_verbose ("%s: calling rfapiDeleteRemotePrefixesIt() on (IP) import %p", __func__, it); @@ -4982,7 +4988,7 @@ rfapiDeleteRemotePrefixes ( rc = skiplist_next (h->import_mac, NULL, (void **) &it, &cursor)) { - zlog_debug + vnc_zlog_debug_verbose ("%s: calling rfapiDeleteRemotePrefixesIt() on import_mac %p", __func__, it); diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c index 216b45eec8..c051b9b3e0 100644 --- a/bgpd/rfapi/rfapi_monitor.c +++ b/bgpd/rfapi/rfapi_monitor.c @@ -49,6 +49,7 @@ #include "bgpd/rfapi/rfapi_monitor.h" #include "bgpd/rfapi/rfapi_vty.h" #include "bgpd/rfapi/rfapi_rib.h" +#include "bgpd/rfapi/vnc_debug.h" #define DEBUG_L2_EXTRA 0 #define DEBUG_DUP_CHECK 0 @@ -92,7 +93,7 @@ rfapiMonitorEthSlCheck( sl = RFAPI_MONITOR_ETH(rn); if (sl || sl_saved) { - zlog_debug("%s[%s%s]: rn=%p, rn->lock=%d, old sl=%p, new sl=%p", + vnc_zlog_debug_verbose("%s[%s%s]: rn=%p, rn->lock=%d, old sl=%p, new sl=%p", __func__, (tag1? tag1: ""), (tag2? tag2: ""), rn, rn->lock, sl_saved, sl); sl_saved = sl; @@ -450,7 +451,7 @@ rfapiMonitorAttachImport (struct rfapi_descriptor *rfd, m->next = rfd->import_table->vpn0_queries[afi]; rfd->import_table->vpn0_queries[afi] = m; - zlog_debug ("%s: attached monitor %p to vpn0 list", __func__, m); + vnc_zlog_debug_verbose ("%s: attached monitor %p to vpn0 list", __func__, m); return NULL; } @@ -462,7 +463,7 @@ rfapiMonitorAttachImport (struct rfapi_descriptor *rfd, m->next = RFAPI_MONITOR_VPN (rn); RFAPI_MONITOR_VPN_W_ALLOC (rn) = m; RFAPI_CHECK_REFCOUNT (rn, SAFI_MPLS_VPN, 0); - zlog_debug ("%s: attached monitor %p to rn %p", __func__, m, rn); + vnc_zlog_debug_verbose ("%s: attached monitor %p to rn %p", __func__, m, rn); return rn; } @@ -707,7 +708,7 @@ rfapiMonitorDelHd (struct rfapi_descriptor *rfd) struct bgp *bgp; int count = 0; - zlog_debug ("%s: entry rfd=%p", __func__, rfd); + vnc_zlog_debug_verbose ("%s: entry rfd=%p", __func__, rfd); bgp = bgp_get_default (); @@ -758,7 +759,7 @@ rfapiMonitorDelHd (struct rfapi_descriptor *rfd) else { #if DEBUG_L2_EXTRA - zlog_debug + vnc_zlog_debug_verbose ("%s: callbacks disabled, not attempting to detach mon_eth %p", __func__, mon_eth); #endif @@ -776,7 +777,7 @@ rfapiMonitorDelHd (struct rfapi_descriptor *rfd) rc = skiplist_delete (rfd->mon_eth, mon_eth, mon_eth); assert (!rc); - zlog_debug ("%s: freeing mon_eth %p", __func__, mon_eth); + vnc_zlog_debug_verbose ("%s: freeing mon_eth %p", __func__, mon_eth); XFREE (MTYPE_RFAPI_MONITOR_ETH, mon_eth); ++count; @@ -847,7 +848,7 @@ rfapiMonitorTimerRestart (struct rfapi_monitor_vpn *m) { char buf[BUFSIZ]; - zlog_debug ("%s: target %s life %u", __func__, + vnc_zlog_debug_verbose ("%s: target %s life %u", __func__, rfapi_ntop (m->p.family, m->p.u.val, buf, BUFSIZ), m->rfd->response_lifetime); } @@ -936,7 +937,7 @@ rfapiMonitorItNodeChanged ( #if DEBUG_L2_EXTRA prefix2str (&it_node->p, buf_prefix, BUFSIZ); - zlog_debug ("%s: it=%p, it_node=%p, it_node->prefix=%s", + vnc_zlog_debug_verbose ("%s: it=%p, it_node=%p, it_node->prefix=%s", __func__, import_table, it_node, buf_prefix); #endif @@ -1021,7 +1022,7 @@ rfapiMonitorItNodeChanged ( prefix2str (&m->node->p, buf_attach_pfx, BUFSIZ); prefix2str (&m->p, buf_target_pfx, BUFSIZ); - zlog_debug + vnc_zlog_debug_verbose ("%s: update rfd %p attached to pfx %s (targ=%s)", __func__, m->rfd, buf_attach_pfx, buf_target_pfx); } @@ -1048,13 +1049,13 @@ rfapiMonitorItNodeChanged ( struct rfapi_monitor_eth *e; #if DEBUG_L2_EXTRA - zlog_debug ("%s: checking L2 all-routes monitors", __func__); + vnc_zlog_debug_verbose ("%s: checking L2 all-routes monitors", __func__); #endif for (e = import_table->eth0_queries; e; e = e->next) { #if DEBUG_L2_EXTRA - zlog_debug ("%s: checking eth0 mon=%p", __func__, e); + vnc_zlog_debug_verbose ("%s: checking eth0 mon=%p", __func__, e); #endif if (skiplist_search (nves_seen, e->rfd, NULL)) { @@ -1067,7 +1068,7 @@ rfapiMonitorItNodeChanged ( * update its RIB */ #if DEBUG_L2_EXTRA - zlog_debug ("%s: found L2 all-routes monitor %p", __func__, e); + vnc_zlog_debug_verbose ("%s: found L2 all-routes monitor %p", __func__, e); #endif rfapiRibUpdatePendingNode (bgp, e->rfd, import_table, it_node, e->rfd->response_lifetime); @@ -1127,7 +1128,7 @@ rfapiMonitorMovedUp ( */ if (!new_node->parent && !new_node->info) { - zlog_debug ("%s: new monitor at 0/0 and no routes, no updates", + vnc_zlog_debug_verbose ("%s: new monitor at 0/0 and no routes, no updates", __func__); return; } @@ -1178,7 +1179,7 @@ rfapiMonitorEthTimerRestart (struct rfapi_monitor_eth *m) { char buf[BUFSIZ]; - zlog_debug ("%s: target %s life %u", __func__, + vnc_zlog_debug_verbose ("%s: target %s life %u", __func__, rfapiEthAddr2Str (&m->macaddr, buf, BUFSIZ), m->rfd->response_lifetime); } @@ -1221,7 +1222,7 @@ rfapiMonitorEthAttachImport ( struct skiplist *sl; int rc; - zlog_debug ("%s: it=%p", __func__, it); + vnc_zlog_debug_verbose ("%s: it=%p", __func__, it); rfapiMonitorCheckAttachAllowed (); @@ -1233,7 +1234,7 @@ rfapiMonitorEthAttachImport ( mon->next = it->eth0_queries; it->eth0_queries = mon; #if DEBUG_L2_EXTRA - zlog_debug ("%s: attached monitor %p to eth0 list", __func__, mon); + vnc_zlog_debug_verbose ("%s: attached monitor %p to eth0 list", __func__, mon); #endif return; } @@ -1241,7 +1242,7 @@ rfapiMonitorEthAttachImport ( if (rn == NULL) { #if DEBUG_L2_EXTRA - zlog_debug ("%s: rn is null!", __func__); + vnc_zlog_debug_verbose ("%s: rn is null!", __func__); #endif return; } @@ -1257,7 +1258,7 @@ rfapiMonitorEthAttachImport ( } #if DEBUG_L2_EXTRA - zlog_debug ("%s: rn=%p, rn->lock=%d, sl=%p, attaching eth mon %p", + vnc_zlog_debug_verbose ("%s: rn=%p, rn->lock=%d, sl=%p, attaching eth mon %p", __func__, rn, rn->lock, sl, mon); #endif @@ -1349,7 +1350,7 @@ rfapiMonitorEthDetachImport ( } } #if DEBUG_L2_EXTRA - zlog_debug ("%s: it=%p, LNI=%d, detached eth0 mon %p", + vnc_zlog_debug_verbose ("%s: it=%p, LNI=%d, detached eth0 mon %p", __func__, it, mon->logical_net_id, mon); #endif return; @@ -1373,7 +1374,7 @@ rfapiMonitorEthDetachImport ( */ sl = RFAPI_MONITOR_ETH (rn); #if DEBUG_L2_EXTRA - zlog_debug ("%s: it=%p, rn=%p, rn->lock=%d, sl=%p, pfx=%s, LNI=%d, detaching eth mon %p", + vnc_zlog_debug_verbose ("%s: it=%p, rn=%p, rn->lock=%d, sl=%p, pfx=%s, LNI=%d, detaching eth mon %p", __func__, it, rn, rn->lock, sl, buf_prefix, mon->logical_net_id, mon); #endif assert (sl); @@ -1434,7 +1435,7 @@ rfapiMonitorEthAdd ( { char buf[BUFSIZ]; - zlog_debug ("%s: LNI=%d: rfd=%p, pfx=%s", + vnc_zlog_debug_verbose ("%s: LNI=%d: rfd=%p, pfx=%s", __func__, logical_net_id, rfd, rfapi_ntop (pfx_mac_buf.family, pfx_mac_buf.u.val, buf, BUFSIZ)); @@ -1451,7 +1452,7 @@ rfapiMonitorEthAdd ( * Found monitor - we have seen this query before * restart timer */ - zlog_debug ("%s: already present in rfd->mon_eth, not adding", + vnc_zlog_debug_verbose ("%s: already present in rfd->mon_eth, not adding", __func__); rfapiMonitorEthTimerRestart (val); return rn; @@ -1470,7 +1471,7 @@ rfapiMonitorEthAdd ( rc = skiplist_insert (rfd->mon_eth, val, val); #if DEBUG_L2_EXTRA - zlog_debug ("%s: inserted rfd=%p mon_eth=%p, rc=%d", __func__, rfd, val, + vnc_zlog_debug_verbose ("%s: inserted rfd=%p mon_eth=%p, rc=%d", __func__, rfd, val, rc); #endif @@ -1485,7 +1486,7 @@ rfapiMonitorEthAdd ( * callbacks turned off, so don't attach monitor to import table */ #if DEBUG_L2_EXTRA - zlog_debug + vnc_zlog_debug_verbose ("%s: callbacks turned off, not attaching mon_eth %p to import table", __func__, val); #endif @@ -1511,7 +1512,7 @@ rfapiMonitorEthDel ( struct rfapi_monitor_eth mon_buf; int rc; - zlog_debug ("%s: entry rfd=%p", __func__, rfd); + vnc_zlog_debug_verbose ("%s: entry rfd=%p", __func__, rfd); assert (rfd->mon_eth); @@ -1543,7 +1544,7 @@ rfapiMonitorEthDel ( assert (!rc); #if DEBUG_L2_EXTRA - zlog_debug ("%s: freeing mon_eth %p", __func__, val); + vnc_zlog_debug_verbose ("%s: freeing mon_eth %p", __func__, val); #endif XFREE (MTYPE_RFAPI_MONITOR_ETH, val); @@ -1573,7 +1574,7 @@ rfapiMonitorCallbacksOff (struct bgp *bgp) bgp->rfapi_cfg->flags |= BGP_VNC_CONFIG_CALLBACK_DISABLE; #if DEBUG_L2_EXTRA - zlog_debug ("%s: turned off callbacks", __func__); + vnc_zlog_debug_verbose ("%s: turned off callbacks", __func__); #endif if (h == NULL) @@ -1656,7 +1657,7 @@ rfapiMonitorCallbacksOff (struct bgp *bgp) for (e = it->eth0_queries; e; e = enext) { #if DEBUG_L2_EXTRA - zlog_debug ("%s: detaching eth0 mon %p", __func__, e); + vnc_zlog_debug_verbose ("%s: detaching eth0 mon %p", __func__, e); #endif enext = e->next; e->next = NULL; /* gratuitous safeness */ @@ -1684,7 +1685,7 @@ rfapiMonitorCallbacksOn (struct bgp *bgp) } bgp->rfapi_cfg->flags &= ~BGP_VNC_CONFIG_CALLBACK_DISABLE; #if DEBUG_L2_EXTRA - zlog_debug ("%s: turned on callbacks", __func__); + vnc_zlog_debug_verbose ("%s: turned on callbacks", __func__); #endif if (bgp->rfapi == NULL) return; diff --git a/bgpd/rfapi/rfapi_nve_addr.c b/bgpd/rfapi/rfapi_nve_addr.c index ad34ff26c8..e00ff30312 100644 --- a/bgpd/rfapi/rfapi_nve_addr.c +++ b/bgpd/rfapi/rfapi_nve_addr.c @@ -38,6 +38,7 @@ #include "bgpd/rfapi/rfapi_private.h" #include "bgpd/rfapi/rfapi_nve_addr.h" #include "bgpd/rfapi/rfapi_vty.h" +#include "bgpd/rfapi/vnc_debug.h" #define DEBUG_NVE_ADDR 0 @@ -54,7 +55,7 @@ logdifferent (const char *tag, rfapiNveAddr2Str (a, a_str, BUFSIZ); rfapiNveAddr2Str (b, b_str, BUFSIZ); - zlog_debug ("%s: [%s] [%s]", tag, a_str, b_str); + vnc_zlog_debug_verbose ("%s: [%s] [%s]", tag, a_str, b_str); } #endif @@ -69,14 +70,14 @@ rfapi_nve_addr_cmp (void *k1, void *k2) if (!a || !b) { #if DEBUG_NVE_ADDR - zlog_debug ("%s: missing address a=%p b=%p", __func__, a, b); + vnc_zlog_debug_verbose ("%s: missing address a=%p b=%p", __func__, a, b); #endif return (a - b); } if (a->un.addr_family != b->un.addr_family) { #if DEBUG_NVE_ADDR - zlog_debug ("diff: UN addr fam a->un.af=%d, b->un.af=%d", + vnc_zlog_debug_verbose ("diff: UN addr fam a->un.af=%d, b->un.af=%d", a->un.addr_family, b->un.addr_family); #endif return (a->un.addr_family - b->un.addr_family); @@ -110,7 +111,7 @@ rfapi_nve_addr_cmp (void *k1, void *k2) if (a->vn.addr_family != b->vn.addr_family) { #if DEBUG_NVE_ADDR - zlog_debug ("diff: pT addr fam a->vn.af=%d, b->vn.af=%d", + vnc_zlog_debug_verbose ("diff: pT addr fam a->vn.af=%d, b->vn.af=%d", a->vn.addr_family, b->vn.addr_family); #endif return (a->vn.addr_family - b->vn.addr_family); diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index 896b5f50a8..daedbeedef 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -50,6 +50,7 @@ #include "bgpd/rfapi/rfapi_rib.h" #include "bgpd/rfapi/rfapi_monitor.h" #include "bgpd/rfapi/rfapi_encap_tlv.h" +#include "bgpd/rfapi/vnc_debug.h" #define DEBUG_PROCESS_PENDING_NODE 0 #define DEBUG_PENDING_DELETE_ROUTE 0 @@ -208,7 +209,7 @@ rfapiRibCheckCounts ( { if (pfx_active != rfd->rib_prefix_count) { - zlog_debug ("%s: rfd %p actual pfx count %u != running %u", + vnc_zlog_debug_verbose ("%s: rfd %p actual pfx count %u != running %u", __func__, rfd, pfx_active, rfd->rib_prefix_count); assert (0); } @@ -219,7 +220,7 @@ rfapiRibCheckCounts ( { if (t_pfx_active != bgp->rfapi->rib_prefix_count_total) { - zlog_debug ("%s: actual total pfx count %u != running %u", + vnc_zlog_debug_verbose ("%s: actual total pfx count %u != running %u", __func__, t_pfx_active, bgp->rfapi->rib_prefix_count_total); assert (0); @@ -397,7 +398,7 @@ rfapiRibStartTimer ( } prefix2str (&rn->p, buf_prefix, BUFSIZ); - zlog_debug ("%s: rfd %p pfx %s life %u", __func__, rfd, buf_prefix, + vnc_zlog_debug_verbose ("%s: rfd %p pfx %s life %u", __func__, rfd, buf_prefix, ri->lifetime); ri->timer = thread_add_timer (bm->master, rfapiRibExpireTimer, tcb, ri->lifetime); @@ -501,7 +502,7 @@ rfapiRibClear (struct rfapi_descriptor *rfd) afi_t afi; #if DEBUG_L2_EXTRA - zlog_debug ("%s: rfd=%p", __func__, rfd); + vnc_zlog_debug_verbose ("%s: rfd=%p", __func__, rfd); #endif for (afi = AFI_IP; afi < AFI_MAX; ++afi) @@ -890,7 +891,7 @@ process_pending_node ( assert (pn); prefix2str (&pn->p, buf_prefix, BUFSIZ); - zlog_debug ("%s: afi=%d, %s pn->info=%p", + vnc_zlog_debug_verbose ("%s: afi=%d, %s pn->info=%p", __func__, afi, buf_prefix, pn->info); if (AFI_ETHER != afi) @@ -934,7 +935,7 @@ process_pending_node ( */ if (lPendCost == (struct list *) 1) { - zlog_debug ("%s: lPendCost=1 => delete all", __func__); + vnc_zlog_debug_verbose ("%s: lPendCost=1 => delete all", __func__); if (slRibPt && !skiplist_empty (slRibPt)) { delete_list = list_new (); @@ -945,7 +946,7 @@ process_pending_node ( char buf2[BUFSIZ]; listnode_add (delete_list, ri); - zlog_debug ("%s: after listnode_add, delete_list->count=%d", + vnc_zlog_debug_verbose ("%s: after listnode_add, delete_list->count=%d", __func__, delete_list->count); rfapiFreeBgpTeaOptionChain (ri->tea_options); ri->tea_options = NULL; @@ -962,7 +963,7 @@ process_pending_node ( prefix2str (&ri->rk.vn, buf, BUFSIZ); prefix2str (&ri->un, buf2, BUFSIZ); - zlog_debug + vnc_zlog_debug_verbose ("%s: put dl pfx=%s vn=%s un=%s cost=%d life=%d vn_options=%p", __func__, buf_prefix, buf, buf2, ri->cost, ri->lifetime, ri->vn_options); @@ -1011,7 +1012,7 @@ process_pending_node ( return; } - zlog_debug ("%s: lPendCost->count=%d, slRibPt->count=%d", + vnc_zlog_debug_verbose ("%s: lPendCost->count=%d, slRibPt->count=%d", __func__, (lPendCost ? (int) lPendCost->count : -1), (slRibPt ? (int) slRibPt->count : -1)); @@ -1056,7 +1057,7 @@ process_pending_node ( #if DEBUG_PROCESS_PENDING_NODE /* deleted from slRibPt below, after we're done iterating */ - zlog_debug + vnc_zlog_debug_verbose ("%s: slRibPt ri %p not matched in pending list, delete", __func__, ori); #endif @@ -1081,7 +1082,7 @@ process_pending_node ( } } #if DEBUG_PROCESS_PENDING_NODE - zlog_debug ("%s: slRibPt ri %p matched in pending list, %s", + vnc_zlog_debug_verbose ("%s: slRibPt ri %p matched in pending list, %s", __func__, ori, (same ? "same info" : "different info")); #endif @@ -1094,7 +1095,7 @@ process_pending_node ( { for (ALL_LIST_ELEMENTS_RO (delete_list, node, ri)) { - zlog_debug ("%s: deleting ri %p from slRibPt", __func__, ri); + vnc_zlog_debug_verbose ("%s: deleting ri %p from slRibPt", __func__, ri); assert (!skiplist_delete (slRibPt, &ri->rk, NULL)); } if (skiplist_empty (slRibPt)) @@ -1138,7 +1139,7 @@ process_pending_node ( rfapiFreeRfapiUnOptionChain (ori->un_options); ori->un_options = rfapiUnOptionsDup (ri->un_options); - zlog_debug + vnc_zlog_debug_verbose ("%s: matched lPendCost item %p in slRibPt, rewrote", __func__, ri); @@ -1173,7 +1174,7 @@ process_pending_node ( buf_rd[0] = 0; #endif - zlog_debug ("%s: nomatch lPendCost item %p in slRibPt, added (rd=%s)", + vnc_zlog_debug_verbose ("%s: nomatch lPendCost item %p in slRibPt, added (rd=%s)", __func__, ri, buf_rd); } @@ -1201,8 +1202,8 @@ callback: char buf[BUFSIZ]; char buf2[BUFSIZ]; - zlog_debug ("%s: lPendCost->count now %d", __func__, lPendCost->count); - zlog_debug ("%s: For prefix %s (a)", __func__, buf_prefix); + vnc_zlog_debug_verbose ("%s: lPendCost->count now %d", __func__, lPendCost->count); + vnc_zlog_debug_verbose ("%s: For prefix %s (a)", __func__, buf_prefix); printedprefix = 1; for (ALL_LIST_ELEMENTS (lPendCost, node, nnode, ri)) @@ -1267,7 +1268,7 @@ callback: rfapiRfapiIpAddr2Str (&new->vn_address, buf, BUFSIZ); rfapiRfapiIpAddr2Str (&new->un_address, buf2, BUFSIZ); - zlog_debug ("%s: add vn=%s un=%s cost=%d life=%d", __func__, + vnc_zlog_debug_verbose ("%s: add vn=%s un=%s cost=%d life=%d", __func__, buf, buf2, new->prefix.cost, new->lifetime); } } @@ -1282,10 +1283,10 @@ callback: if (!printedprefix) { - zlog_debug ("%s: For prefix %s (d)", __func__, buf_prefix); + vnc_zlog_debug_verbose ("%s: For prefix %s (d)", __func__, buf_prefix); printedprefix = 1; } - zlog_debug ("%s: delete_list has %d elements", + vnc_zlog_debug_verbose ("%s: delete_list has %d elements", __func__, delete_list->count); RFAPI_RIB_CHECK_COUNTS (0, delete_list->count); @@ -1342,7 +1343,7 @@ callback: rfapiRfapiIpAddr2Str (&new->vn_address, buf, BUFSIZ); rfapiRfapiIpAddr2Str (&new->un_address, buf2, BUFSIZ); - zlog_debug ("%s: DEL vn=%s un=%s cost=%d life=%d", __func__, + vnc_zlog_debug_verbose ("%s: DEL vn=%s un=%s cost=%d life=%d", __func__, buf, buf2, new->prefix.cost, new->lifetime); RFAPI_RIB_CHECK_COUNTS (0, delete_list->count); @@ -1401,7 +1402,7 @@ callback: { char buf_rd[BUFSIZ]; prefix_rd2str(&ri->rk.rd, buf_rd, sizeof(buf_rd)); - zlog_debug("%s: move route to recently deleted list, rd=%s", + vnc_zlog_debug_verbose("%s: move route to recently deleted list, rd=%s", __func__, buf_rd); } #endif @@ -1422,7 +1423,7 @@ callback: } else { - zlog_debug ("%s: response removal disabled, omitting removals", + vnc_zlog_debug_verbose ("%s: response removal disabled, omitting removals", __func__); } @@ -1490,7 +1491,7 @@ rib_do_callback_onepass (struct rfapi_descriptor *rfd, afi_t afi) struct route_node *rn; #if DEBUG_L2_EXTRA - zlog_debug ("%s: rfd=%p, afi=%d", __func__, rfd, afi); + vnc_zlog_debug_verbose ("%s: rfd=%p, afi=%d", __func__, rfd, afi); #endif if (!rfd->rib_pending[afi]) @@ -1508,7 +1509,7 @@ rib_do_callback_onepass (struct rfapi_descriptor *rfd, afi_t afi) rfapi_response_cb_t *f; #if DEBUG_NHL - zlog_debug ("%s: response callback NHL follows:", __func__); + vnc_zlog_debug_verbose ("%s: response callback NHL follows:", __func__); rfapiPrintNhl (NULL, head); #endif @@ -1518,7 +1519,7 @@ rib_do_callback_onepass (struct rfapi_descriptor *rfd, afi_t afi) f = bgp->rfapi->rfp_methods.response_cb; bgp->rfapi->flags |= RFAPI_INCALLBACK; - zlog_debug ("%s: invoking updated response callback", __func__); + vnc_zlog_debug_verbose ("%s: invoking updated response callback", __func__); (*f) (head, rfd->cookie); bgp->rfapi->flags &= ~RFAPI_INCALLBACK; ++bgp->rfapi->response_updated_count; @@ -1602,24 +1603,24 @@ rfapiRibUpdatePendingNode ( int count = 0; char buf[BUFSIZ]; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); if (CHECK_FLAG (bgp->rfapi_cfg->flags, BGP_VNC_CONFIG_CALLBACK_DISABLE)) return; - zlog_debug ("%s: callbacks are not disabled", __func__); + vnc_zlog_debug_verbose ("%s: callbacks are not disabled", __func__); RFAPI_RIB_CHECK_COUNTS (1, 0); prefix = &it_node->p; afi = family2afi (prefix->family); prefix2str (prefix, buf, BUFSIZ); - zlog_debug ("%s: prefix=%s", __func__, buf); + vnc_zlog_debug_verbose ("%s: prefix=%s", __func__, buf); pn = route_node_get (rfd->rib_pending[afi], prefix); assert (pn); - zlog_debug ("%s: pn->info=%p, pn->aggregate=%p", __func__, pn->info, + vnc_zlog_debug_verbose ("%s: pn->info=%p, pn->aggregate=%p", __func__, pn->info, pn->aggregate); if (pn->aggregate) @@ -1835,7 +1836,7 @@ rfapiRibFTDFilterRecentPrefix( char buf_pfx[BUFSIZ]; prefix2str(&it_rn->p, buf_pfx, BUFSIZ); - zlog_debug("%s: prefix %s", __func__, buf_pfx); + vnc_zlog_debug_verbose("%s: prefix %s", __func__, buf_pfx); } #endif @@ -1845,7 +1846,7 @@ rfapiRibFTDFilterRecentPrefix( if (prefix_match (&it_rn->p, pfx_target_original)) { #if DEBUG_FTD_FILTER_RECENT - zlog_debug("%s: prefix covers target, allowed", __func__); + vnc_zlog_debug_verbose("%s: prefix covers target, allowed", __func__); #endif return 0; } @@ -1859,7 +1860,7 @@ rfapiRibFTDFilterRecentPrefix( route_unlock_node (trn); #if DEBUG_FTD_FILTER_RECENT - zlog_debug("%s: last sent time %lu, last allowed time %lu", + vnc_zlog_debug_verbose("%s: last sent time %lu, last allowed time %lu", __func__, prefix_time, rfd->ftd_last_allowed_time); #endif @@ -1893,7 +1894,7 @@ rfapiRibPreload ( struct rfapi_next_hop_entry *tail = NULL; time_t new_last_sent_time; - zlog_debug ("%s: loading response=%p, use_eth_resolution=%d", + vnc_zlog_debug_verbose ("%s: loading response=%p, use_eth_resolution=%d", __func__, response, use_eth_resolution); new_last_sent_time = rfapi_time (NULL); @@ -1919,7 +1920,7 @@ rfapiRibPreload ( /* * weird, shouldn't happen */ - zlog_debug + vnc_zlog_debug_verbose ("%s: got nhp->lifetime == RFAPI_REMOVE_RESPONSE_LIFETIME", __func__); continue; @@ -1949,7 +1950,7 @@ rfapiRibPreload ( /* * not supposed to happen */ - zlog_debug ("%s: missing L2 info", __func__); + vnc_zlog_debug_verbose ("%s: missing L2 info", __func__); continue; } @@ -2019,11 +2020,11 @@ rfapiRibPreload ( { } - zlog_debug ("%s: rk.vn=%s rk.aux_prefix=%s", + vnc_zlog_debug_verbose ("%s: rk.vn=%s rk.aux_prefix=%s", __func__, str_vn, (rk.aux_prefix.family ? str_aux_prefix : "-")); } - zlog_debug ("%s: RIB skiplist for this prefix follows", __func__); + vnc_zlog_debug_verbose ("%s: RIB skiplist for this prefix follows", __func__); rfapiRibShowRibSl (NULL, &rn->p, (struct skiplist *) rn->info); #endif @@ -2039,7 +2040,7 @@ rfapiRibPreload ( ri->vn_options = NULL; #if DEBUG_NHL - zlog_debug ("%s: found in RIB", __func__); + vnc_zlog_debug_verbose ("%s: found in RIB", __func__); #endif /* @@ -2051,7 +2052,7 @@ rfapiRibPreload ( { #if DEBUG_NHL - zlog_debug ("%s: allowed due to counter/timestamp diff", + vnc_zlog_debug_verbose ("%s: allowed due to counter/timestamp diff", __func__); #endif allowed = 1; @@ -2062,7 +2063,7 @@ rfapiRibPreload ( { #if DEBUG_NHL - zlog_debug ("%s: allowed due to not yet in RIB", __func__); + vnc_zlog_debug_verbose ("%s: allowed due to not yet in RIB", __func__); #endif /* not found: add new route to RIB */ ri = rfapi_info_new (); @@ -2110,7 +2111,7 @@ rfapiRibPreload ( prefix2str (&pfx, str_pfx, BUFSIZ); prefix2str (&rk.vn, str_pfx_vn, BUFSIZ); - zlog_debug + vnc_zlog_debug_verbose ("%s: added pfx=%s nh[vn]=%s, cost=%u, lifetime=%u, allowed=%d", __func__, str_pfx, str_pfx_vn, nhp->prefix.cost, nhp->lifetime, allowed); @@ -2155,7 +2156,7 @@ rfapiRibPendingDeleteRoute ( char buf[BUFSIZ]; prefix2str (&it_node->p, buf, BUFSIZ); - zlog_debug ("%s: entry, it=%p, afi=%d, it_node=%p, pfx=%s", + vnc_zlog_debug_verbose ("%s: entry, it=%p, afi=%d, it_node=%p, pfx=%s", __func__, it, afi, it_node, buf); if (AFI_ETHER == afi) @@ -2176,7 +2177,7 @@ rfapiRibPendingDeleteRoute ( if ((sl = RFAPI_MONITOR_ETH (it_node))) { - zlog_debug ("%s: route-specific skiplist: %p", __func__, sl); + vnc_zlog_debug_verbose ("%s: route-specific skiplist: %p", __func__, sl); for (cursor = NULL, rc = skiplist_next (sl, NULL, (void **) &m, (void **) &cursor); !rc; @@ -2184,7 +2185,7 @@ rfapiRibPendingDeleteRoute ( { #if DEBUG_PENDING_DELETE_ROUTE - zlog_debug ("%s: eth monitor rfd=%p", __func__, m->rfd); + vnc_zlog_debug_verbose ("%s: eth monitor rfd=%p", __func__, m->rfd); #endif /* * If we have already sent a route with this prefix to this @@ -2205,7 +2206,7 @@ rfapiRibPendingDeleteRoute ( for (m = it->eth0_queries; m; m = m->next) { #if DEBUG_PENDING_DELETE_ROUTE - zlog_debug ("%s: eth0 monitor rfd=%p", __func__, m->rfd); + vnc_zlog_debug_verbose ("%s: eth0 monitor rfd=%p", __func__, m->rfd); #endif /* * If we have already sent a route with this prefix to this @@ -2229,13 +2230,13 @@ rfapiRibPendingDeleteRoute ( struct route_node *rn; - zlog_debug ("%s: comparing rfd(%p)->import_table=%p to it=%p", + vnc_zlog_debug_verbose ("%s: comparing rfd(%p)->import_table=%p to it=%p", __func__, rfd, rfd->import_table, it); if (rfd->import_table != it) continue; - zlog_debug ("%s: matched rfd %p", __func__, rfd); + vnc_zlog_debug_verbose ("%s: matched rfd %p", __func__, rfd); /* * If we have sent a response to this NVE with this prefix diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 2ee1adbccc..add18ecbfd 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -1070,7 +1070,7 @@ rfapiShowVncQueries (void *stream, struct prefix *pfx_match) ++queries_total; - zlog_debug ("%s: checking rfd=%p mon_eth=%p", __func__, rfd, + vnc_zlog_debug_verbose ("%s: checking rfd=%p mon_eth=%p", __func__, rfd, mon_eth); memset ((void *) &pfx_mac, 0, sizeof (struct prefix)); @@ -2455,7 +2455,7 @@ register_add ( ++opt_next; } - zlog_debug + vnc_zlog_debug_verbose ("%s: vn=%s, un=%s, prefix=%s, cost=%s, lifetime=%s, lnh=%s", __func__, arg_vn, arg_un, arg_prefix, (arg_cost ? arg_cost : "NULL"), @@ -2511,7 +2511,7 @@ register_add ( struct rfapi_next_hop_entry *tail = NULL; struct rfapi_vn_option *vn_opt_new; - zlog_debug ("%s: rfapi_register succeeded, returning 0", __func__); + vnc_zlog_debug_verbose ("%s: rfapi_register succeeded, returning 0", __func__); if (h->rfp_methods.local_cb) { @@ -2532,7 +2532,7 @@ register_add ( return 0; } - zlog_debug ("%s: rfapi_register failed", __func__); + vnc_zlog_debug_verbose ("%s: rfapi_register failed", __func__); vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "Registration failed.%s", VTY_NEWLINE); vty_out (vty, @@ -2541,7 +2541,7 @@ register_add ( return CMD_WARNING; fail: - zlog_debug ("%s: fail, rc=%d", __func__, rc); + vnc_zlog_debug_verbose ("%s: fail, rc=%d", __func__, rc); return rc; } @@ -3296,7 +3296,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) struct rfapi_cfg *rfapi_cfg; #if DEBUG_L2_EXTRA - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); #endif if (!bgp_default) @@ -3318,7 +3318,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) } #if DEBUG_L2_EXTRA - zlog_debug ("%s: starting descriptor loop", __func__); + vnc_zlog_debug_verbose ("%s: starting descriptor loop", __func__); #endif for (ALL_LIST_ELEMENTS_RO (&h->descriptors, node, rfd)) @@ -3330,7 +3330,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) struct nve_addr *hap; #if DEBUG_L2_EXTRA - zlog_debug ("%s: rfd=%p", __func__, rfd); + vnc_zlog_debug_verbose ("%s: rfd=%p", __func__, rfd); #endif /* @@ -3342,7 +3342,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) continue; #if DEBUG_L2_EXTRA - zlog_debug ("%s: un, vn match", __func__); + vnc_zlog_debug_verbose ("%s: un, vn match", __func__); #endif /* @@ -3385,7 +3385,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) if (!prefix_same (pPrefix, &adb->prefix_ip)) { #if DEBUG_L2_EXTRA - zlog_debug ("%s: adb=%p, prefix doesn't match, skipping", + vnc_zlog_debug_verbose ("%s: adb=%p, prefix doesn't match, skipping", __func__, adb); #endif continue; @@ -3398,7 +3398,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) adb->prefix_eth.u.prefix_eth.octet, ETHER_ADDR_LEN)) { #if DEBUG_L2_EXTRA - zlog_debug ("%s: adb=%p, macaddr doesn't match, skipping", + vnc_zlog_debug_verbose ("%s: adb=%p, macaddr doesn't match, skipping", __func__, adb); #endif continue; @@ -3410,7 +3410,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) if (cda->l2o.o.logical_net_id != adb->l2o.logical_net_id) { #if DEBUG_L2_EXTRA - zlog_debug ("%s: adb=%p, LNI doesn't match, skipping", + vnc_zlog_debug_verbose ("%s: adb=%p, LNI doesn't match, skipping", __func__, adb); #endif continue; @@ -3418,7 +3418,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) } #if DEBUG_L2_EXTRA - zlog_debug ("%s: ipN adding adb %p to delete list", __func__, + vnc_zlog_debug_verbose ("%s: ipN adding adb %p to delete list", __func__, adb); #endif @@ -3467,7 +3467,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) } #if DEBUG_L2_EXTRA - zlog_debug ("%s: ipN killing reg from adb %p ", __func__, adb); + vnc_zlog_debug_verbose ("%s: ipN killing reg from adb %p ", __func__, adb); #endif rc = rfapi_register (rfd, &rp, 0, NULL, pVn, RFAPI_REGISTER_KILL); @@ -3521,7 +3521,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) } } #if DEBUG_L2_EXTRA - zlog_debug ("%s: ip0 adding adb %p to delete list", + vnc_zlog_debug_verbose ("%s: ip0 adding adb %p to delete list", __func__, adb); #endif listnode_add (adb_delete_list, adb); @@ -3540,7 +3540,7 @@ rfapiDeleteLocalPrefixes (struct rfapi_local_reg_delete_arg *cda) vn.v.l2addr = adb->l2o; #if DEBUG_L2_EXTRA - zlog_debug ("%s: ip0 killing reg from adb %p ", + vnc_zlog_debug_verbose ("%s: ip0 killing reg from adb %p ", __func__, adb); #endif diff --git a/bgpd/rfapi/vnc_debug.c b/bgpd/rfapi/vnc_debug.c index f66be85c25..bf7a898f58 100644 --- a/bgpd/rfapi/vnc_debug.c +++ b/bgpd/rfapi/vnc_debug.c @@ -35,18 +35,19 @@ unsigned long conf_vnc_debug; unsigned long term_vnc_debug; struct vnc_debug { - unsigned long bit; - const char *name; + unsigned long bit; + const char *name; }; struct vnc_debug vncdebug[] = { - {VNC_DEBUG_RFAPI_QUERY, "rfapi-query"}, - {VNC_DEBUG_IMPORT_BI_ATTACH, "import-bi-attach"}, - {VNC_DEBUG_IMPORT_DEL_REMOTE, "import-del-remote"}, - {VNC_DEBUG_EXPORT_BGP_GETCE, "export-bgp-getce"}, - {VNC_DEBUG_EXPORT_BGP_DIRECT_ADD, "export-bgp-direct-add"}, - {VNC_DEBUG_IMPORT_BGP_ADD_ROUTE, "import-bgp-add-route"}, + {VNC_DEBUG_RFAPI_QUERY, "rfapi-query"}, + {VNC_DEBUG_IMPORT_BI_ATTACH, "import-bi-attach"}, + {VNC_DEBUG_IMPORT_DEL_REMOTE, "import-del-remote"}, + {VNC_DEBUG_EXPORT_BGP_GETCE, "export-bgp-getce"}, + {VNC_DEBUG_EXPORT_BGP_DIRECT_ADD, "export-bgp-direct-add"}, + {VNC_DEBUG_IMPORT_BGP_ADD_ROUTE, "import-bgp-add-route"}, + {VNC_DEBUG_VERBOSE, "verbose"}, }; #define VNC_STR "VNC information\n" @@ -56,13 +57,14 @@ struct vnc_debug vncdebug[] = ***********************************************************************/ DEFUN (debug_bgp_vnc, debug_bgp_vnc_cmd, - "debug bgp vnc ", + "debug bgp vnc ", DEBUG_STR BGP_STR VNC_STR "rfapi query handling\n" "import BI atachment\n" - "import delete remote routes\n") + "import delete remote routes\n" + "verbose logging\n") { size_t i; @@ -90,14 +92,15 @@ DEFUN (debug_bgp_vnc, DEFUN (no_debug_bgp_vnc, no_debug_bgp_vnc_cmd, - " bgp vnc ", + " bgp vnc ", NO_STR DEBUG_STR BGP_STR VNC_STR "rfapi query handling\n" "import BI atachment\n" - "import delete remote routes\n") + "import delete remote routes\n" + "verbose logging\n") { size_t i; diff --git a/bgpd/rfapi/vnc_debug.h b/bgpd/rfapi/vnc_debug.h index 9d4270651e..d16bceed93 100644 --- a/bgpd/rfapi/vnc_debug.h +++ b/bgpd/rfapi/vnc_debug.h @@ -38,8 +38,12 @@ extern unsigned long term_vnc_debug; #define VNC_DEBUG_EXPORT_BGP_GETCE 0x00000008 #define VNC_DEBUG_EXPORT_BGP_DIRECT_ADD 0x00000010 #define VNC_DEBUG_IMPORT_BGP_ADD_ROUTE 0x00000020 +#define VNC_DEBUG_VERBOSE 0x00000040 +#define VNC_DEBUG_ANY 0xFFFFFFFF -#define VNC_DEBUG(bit) (term_vnc_debug & (VNC_DEBUG_ ## bit)) +#define VNC_DEBUG(bit) (term_vnc_debug & (VNC_DEBUG_ ## bit)) +#define vnc_zlog_debug_verbose if (VNC_DEBUG(VERBOSE)) zlog_debug +#define vnc_zlog_debug_any if (VNC_DEBUG(ANY)) zlog_debug extern void vnc_debug_init (void); diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index 6434c3744d..bcfa145c67 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -152,7 +152,7 @@ getce (struct bgp *bgp, struct attr *attr, struct prefix *pfx_ce) if (VNC_DEBUG(EXPORT_BGP_GETCE)) { - zlog_debug ("%s: %02x %02x %02x %02x %02x %02x %02x %02x", + vnc_zlog_debug_any ("%s: %02x %02x %02x %02x %02x %02x %02x %02x", __func__, ecp[0], ecp[1], ecp[2], ecp[3], ecp[4], ecp[5], ecp[6], ecp[7]); @@ -213,7 +213,7 @@ vnc_direct_bgp_add_route_ce ( bi->sub_type != BGP_ROUTE_RFP && bi->sub_type != BGP_ROUTE_STATIC)) { - zlog_debug ("%s: wrong route type/sub_type for export, skipping", + vnc_zlog_debug_verbose ("%s: wrong route type/sub_type for export, skipping", __func__); return; } @@ -221,20 +221,20 @@ vnc_direct_bgp_add_route_ce ( /* check bgp redist flag for vnc direct ("vpn") routes */ if (!bgp->redist[afi][ZEBRA_ROUTE_VNC_DIRECT]) { - zlog_debug ("%s: bgp redistribution of VNC direct routes is off", + vnc_zlog_debug_verbose ("%s: bgp redistribution of VNC direct routes is off", __func__); return; } if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } if (!VNC_EXPORT_BGP_CE_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export-to-bgp ce mode not enabled, skipping", + vnc_zlog_debug_verbose ("%s: export-to-bgp ce mode not enabled, skipping", __func__); return; } @@ -247,7 +247,7 @@ vnc_direct_bgp_add_route_ce ( if (prefix_list_apply (bgp->rfapi_cfg->plist_export_bgp[afi], prefix) == PREFIX_DENY) { - zlog_debug ("%s: prefix list denied, skipping", __func__); + vnc_zlog_debug_verbose ("%s: prefix list denied, skipping", __func__); return; } } @@ -260,7 +260,7 @@ vnc_direct_bgp_add_route_ce ( */ if (getce (bgp, attr, &ce_nexthop)) { - zlog_debug ("%s: EC has no encoded CE, skipping", __func__); + vnc_zlog_debug_verbose ("%s: EC has no encoded CE, skipping", __func__); return; } @@ -285,7 +285,7 @@ vnc_direct_bgp_add_route_ce ( ubi->peer == peer && prefix_same (&unicast_nexthop, &ce_nexthop)) { - zlog_debug + vnc_zlog_debug_verbose ("%s: already have matching exported unicast route, skipping", __func__); return; @@ -329,7 +329,7 @@ vnc_direct_bgp_add_route_ce ( if (!prefix_same (&ce_nexthop, &post_routemap_nexthop)) { - zlog_debug + vnc_zlog_debug_verbose ("%s: route-map modification of nexthop not allowed, skipping", __func__); bgp_attr_unintern (&iattr); @@ -368,19 +368,19 @@ vnc_direct_bgp_del_route_ce ( /* check bgp redist flag for vnc direct ("vpn") routes */ if (!bgp->redist[afi][ZEBRA_ROUTE_VNC_DIRECT]) { - zlog_debug ("%s: bgp redistribution of VNC direct routes is off", + vnc_zlog_debug_verbose ("%s: bgp redistribution of VNC direct routes is off", __func__); return; } if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } if (!VNC_EXPORT_BGP_CE_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export-to-bgp ce mode not enabled, skipping", + vnc_zlog_debug_verbose ("%s: export-to-bgp ce mode not enabled, skipping", __func__); return; } @@ -392,7 +392,7 @@ vnc_direct_bgp_del_route_ce ( */ if (getce (bgp, bi->attr, &ce_nexthop)) { - zlog_debug ("%s: EC has no encoded CE, skipping", __func__); + vnc_zlog_debug_verbose ("%s: EC has no encoded CE, skipping", __func__); return; } @@ -413,7 +413,7 @@ vnc_direct_bgp_del_route_ce ( continue; if (prefix_same (&ce, &ce_nexthop)) { - zlog_debug ("%s: still have a route via CE, not deleting unicast", + vnc_zlog_debug_verbose ("%s: still have a route via CE, not deleting unicast", __func__); return; } @@ -437,7 +437,7 @@ vnc_direct_bgp_vpn_enable_ce (struct bgp *bgp, afi_t afi) struct route_node *rn; struct bgp_info *ri; - zlog_debug ("%s: entry, afi=%d", __func__, afi); + vnc_zlog_debug_verbose ("%s: entry, afi=%d", __func__, afi); if (!bgp) return; @@ -447,14 +447,14 @@ vnc_direct_bgp_vpn_enable_ce (struct bgp *bgp, afi_t afi) if (!VNC_EXPORT_BGP_CE_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export of CE routes not enabled, skipping", __func__); + vnc_zlog_debug_verbose ("%s: export of CE routes not enabled, skipping", __func__); return; } if (afi != AFI_IP && afi != AFI_IP6) { - zlog_debug ("%s: bad afi: %d", __func__, afi); + vnc_zlog_debug_verbose ("%s: bad afi: %d", __func__, afi); return; } @@ -473,14 +473,14 @@ vnc_direct_bgp_vpn_enable_ce (struct bgp *bgp, afi_t afi) prefixstr[0] = 0; inet_ntop (rn->p.family, &rn->p.u.prefix, prefixstr, BUFSIZ); - zlog_debug ("%s: checking prefix %s/%d", __func__, prefixstr, + vnc_zlog_debug_verbose ("%s: checking prefix %s/%d", __func__, prefixstr, rn->p.prefixlen); } for (ri = rn->info; ri; ri = ri->next) { - zlog_debug ("%s: ri->sub_type: %d", __func__, ri->sub_type); + vnc_zlog_debug_verbose ("%s: ri->sub_type: %d", __func__, ri->sub_type); if (ri->sub_type == BGP_ROUTE_NORMAL || ri->sub_type == BGP_ROUTE_RFP || @@ -499,7 +499,7 @@ vnc_direct_bgp_vpn_disable_ce (struct bgp *bgp, afi_t afi) { struct bgp_node *rn; - zlog_debug ("%s: entry, afi=%d", __func__, afi); + vnc_zlog_debug_verbose ("%s: entry, afi=%d", __func__, afi); if (!bgp) return; @@ -507,7 +507,7 @@ vnc_direct_bgp_vpn_disable_ce (struct bgp *bgp, afi_t afi) if (afi != AFI_IP && afi != AFI_IP6) { - zlog_debug ("%s: bad afi: %d", __func__, afi); + vnc_zlog_debug_verbose ("%s: bad afi: %d", __func__, afi); return; } @@ -781,34 +781,34 @@ vnc_direct_bgp_add_prefix ( /* check bgp redist flag for vnc direct ("vpn") routes */ if (!bgp->redist[afi][ZEBRA_ROUTE_VNC_DIRECT]) { - zlog_debug ("%s: bgp redistribution of VNC direct routes is off", + vnc_zlog_debug_verbose ("%s: bgp redistribution of VNC direct routes is off", __func__); return; } if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } if (!VNC_EXPORT_BGP_GRP_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export-to-bgp group mode not enabled, skipping", + vnc_zlog_debug_verbose ("%s: export-to-bgp group mode not enabled, skipping", __func__); return; } if (!listcount (bgp->rfapi_cfg->rfg_export_direct_bgp_l)) { - zlog_debug ("%s: no bgp-direct export nve group, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no bgp-direct export nve group, skipping", __func__); return; } bgp_attr_default_set (&attr, BGP_ORIGIN_INCOMPLETE); /* TBD set some configured med, see add_vnc_route() */ - zlog_debug ("%s: looping over nve-groups in direct-bgp export list", + vnc_zlog_debug_verbose ("%s: looping over nve-groups in direct-bgp export list", __func__); for (ALL_LIST_ELEMENTS (bgp->rfapi_cfg->rfg_export_direct_bgp_l, @@ -873,9 +873,9 @@ vnc_direct_bgp_add_prefix ( if (VNC_DEBUG(EXPORT_BGP_DIRECT_ADD)) { - zlog_debug ("%s: attr follows", __func__); + vnc_zlog_debug_any ("%s: attr follows", __func__); rfapiPrintAttrPtrs (NULL, &attr); - zlog_debug ("%s: hattr follows", __func__); + vnc_zlog_debug_any ("%s: hattr follows", __func__); rfapiPrintAttrPtrs (NULL, &hattr); } @@ -890,7 +890,7 @@ vnc_direct_bgp_add_prefix ( { bgp_attr_flush (&hattr); bgp_attr_extra_free (&hattr); - zlog_debug + vnc_zlog_debug_verbose ("%s: route map says DENY, so not calling bgp_update", __func__); continue; @@ -899,8 +899,8 @@ vnc_direct_bgp_add_prefix ( if (VNC_DEBUG(EXPORT_BGP_DIRECT_ADD)) { - zlog_debug ("%s: hattr after route_map_apply:", __func__); - rfapiPrintAttrPtrs (NULL, &hattr); + vnc_zlog_debug_any ("%s: hattr after route_map_apply:", __func__); + rfapiPrintAttrPtrs (NULL, &hattr); } iattr = bgp_attr_intern (&hattr); @@ -944,27 +944,27 @@ vnc_direct_bgp_del_prefix ( /* check bgp redist flag for vnc direct ("vpn") routes */ if (!bgp->redist[afi][ZEBRA_ROUTE_VNC_DIRECT]) { - zlog_debug ("%s: bgp redistribution of VNC direct routes is off", + vnc_zlog_debug_verbose ("%s: bgp redistribution of VNC direct routes is off", __func__); return; } if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } if (!VNC_EXPORT_BGP_GRP_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export-to-bgp group mode not enabled, skipping", + vnc_zlog_debug_verbose ("%s: export-to-bgp group mode not enabled, skipping", __func__); return; } if (!listcount (bgp->rfapi_cfg->rfg_export_direct_bgp_l)) { - zlog_debug ("%s: no bgp-direct export nve group, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no bgp-direct export nve group, skipping", __func__); return; } @@ -1035,19 +1035,19 @@ vnc_direct_bgp_add_nve (struct bgp *bgp, struct rfapi_descriptor *rfd) return; if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } if (!VNC_EXPORT_BGP_GRP_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export-to-bgp group mode not enabled, skipping", + vnc_zlog_debug_verbose ("%s: export-to-bgp group mode not enabled, skipping", __func__); return; } if (!bgp->redist[afi][ZEBRA_ROUTE_VNC_DIRECT]) { - zlog_debug ("%s: bgp redistribution of VNC direct routes is off", + vnc_zlog_debug_verbose ("%s: bgp redistribution of VNC direct routes is off", __func__); return; } @@ -1183,19 +1183,19 @@ vnc_direct_bgp_del_nve (struct bgp *bgp, struct rfapi_descriptor *rfd) return; if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } if (!VNC_EXPORT_BGP_GRP_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export-to-bgp group mode not enabled, skipping", + vnc_zlog_debug_verbose ("%s: export-to-bgp group mode not enabled, skipping", __func__); return; } if (!bgp->redist[afi][ZEBRA_ROUTE_VNC_DIRECT]) { - zlog_debug ("%s: bgp redistribution of VNC direct routes is off", + vnc_zlog_debug_verbose ("%s: bgp redistribution of VNC direct routes is off", __func__); return; } @@ -1276,12 +1276,12 @@ vnc_direct_bgp_add_group_afi ( struct attr attr = { 0 }; struct rfapi_import_table *import_table; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); import_table = rfg->rfapi_import_table; if (!import_table) { - zlog_debug ("%s: import table not defined, returning", __func__); + vnc_zlog_debug_verbose ("%s: import table not defined, returning", __func__); return; } @@ -1299,7 +1299,7 @@ vnc_direct_bgp_add_group_afi ( if (!rfg->nves) { /* avoid segfault below if list doesn't exist */ - zlog_debug ("%s: no NVEs in this group", __func__); + vnc_zlog_debug_verbose ("%s: no NVEs in this group", __func__); return; } @@ -1417,12 +1417,12 @@ vnc_direct_bgp_del_group_afi ( struct route_node *rn; struct rfapi_import_table *import_table; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); import_table = rfg->rfapi_import_table; if (!import_table) { - zlog_debug ("%s: import table not defined, returning", __func__); + vnc_zlog_debug_verbose ("%s: import table not defined, returning", __func__); return; } @@ -1433,7 +1433,7 @@ vnc_direct_bgp_del_group_afi ( if (!rfg->nves) { /* avoid segfault below if list does not exist */ - zlog_debug ("%s: no NVEs in this group", __func__); + vnc_zlog_debug_verbose ("%s: no NVEs in this group", __func__); return; } @@ -1592,7 +1592,7 @@ vnc_direct_bgp_vpn_enable (struct bgp *bgp, afi_t afi) if (!VNC_EXPORT_BGP_GRP_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export-to-bgp group mode not enabled, skipping", + vnc_zlog_debug_verbose ("%s: export-to-bgp group mode not enabled, skipping", __func__); return; } @@ -1600,7 +1600,7 @@ vnc_direct_bgp_vpn_enable (struct bgp *bgp, afi_t afi) if (afi != AFI_IP && afi != AFI_IP6) { - zlog_debug ("%s: bad afi: %d", __func__, afi); + vnc_zlog_debug_verbose ("%s: bad afi: %d", __func__, afi); return; } @@ -1626,21 +1626,21 @@ vnc_direct_bgp_vpn_disable (struct bgp *bgp, afi_t afi) struct rfapi_import_table *it; uint8_t family = afi2family (afi); - zlog_debug ("%s: entry, afi=%d", __func__, afi); + vnc_zlog_debug_verbose ("%s: entry, afi=%d", __func__, afi); if (!bgp) return; if (!bgp->rfapi) { - zlog_debug ("%s: rfapi not initialized", __func__); + vnc_zlog_debug_verbose ("%s: rfapi not initialized", __func__); return; } if (!family || (afi != AFI_IP && afi != AFI_IP6)) { - zlog_debug ("%s: bad afi: %d", __func__, afi); + vnc_zlog_debug_verbose ("%s: bad afi: %d", __func__, afi); return; } @@ -1699,20 +1699,20 @@ vnc_direct_bgp_rh_add_route ( /* check bgp redist flag for vnc direct ("vpn") routes */ if (!bgp->redist[afi][ZEBRA_ROUTE_VNC_DIRECT]) { - zlog_debug ("%s: bgp redistribution of VNC direct routes is off", + vnc_zlog_debug_verbose ("%s: bgp redistribution of VNC direct routes is off", __func__); return; } if (!(hc = bgp->rfapi_cfg)) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } if (!VNC_EXPORT_BGP_RH_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export-to-bgp RH mode not enabled, skipping", + vnc_zlog_debug_verbose ("%s: export-to-bgp RH mode not enabled, skipping", __func__); return; } @@ -1835,19 +1835,19 @@ vnc_direct_bgp_rh_del_route ( /* check bgp redist flag for vnc direct ("vpn") routes */ if (!bgp->redist[afi][ZEBRA_ROUTE_VNC_DIRECT]) { - zlog_debug ("%s: bgp redistribution of VNC direct routes is off", + vnc_zlog_debug_verbose ("%s: bgp redistribution of VNC direct routes is off", __func__); return; } if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } if (!VNC_EXPORT_BGP_RH_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export-to-bgp group mode not enabled, skipping", + vnc_zlog_debug_verbose ("%s: export-to-bgp group mode not enabled, skipping", __func__); return; } @@ -1860,7 +1860,7 @@ vnc_direct_bgp_rh_del_route ( eti->timer = thread_add_timer (bm->master, vncExportWithdrawTimer, eti, eti->lifetime); - zlog_debug ("%s: set expiration timer for %u seconds", + vnc_zlog_debug_verbose ("%s: set expiration timer for %u seconds", __func__, eti->lifetime); } } @@ -1873,7 +1873,7 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi) struct bgp_node *prn; struct rfapi_cfg *hc; - zlog_debug ("%s: entry, afi=%d", __func__, afi); + vnc_zlog_debug_verbose ("%s: entry, afi=%d", __func__, afi); if (!bgp) return; @@ -1883,14 +1883,14 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi) if (!VNC_EXPORT_BGP_RH_ENABLED (bgp->rfapi_cfg)) { - zlog_debug ("%s: export of RH routes not enabled, skipping", __func__); + vnc_zlog_debug_verbose ("%s: export of RH routes not enabled, skipping", __func__); return; } if (afi != AFI_IP && afi != AFI_IP6) { - zlog_debug ("%s: bad afi: %d", __func__, afi); + vnc_zlog_debug_verbose ("%s: bad afi: %d", __func__, afi); return; } @@ -1898,7 +1898,7 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi) * Go through the entire BGP VPN table and export to BGP unicast. */ - zlog_debug ("%s: starting RD loop", __func__); + vnc_zlog_debug_verbose ("%s: starting RD loop", __func__); /* Loop over all the RDs */ for (prn = bgp_table_top (bgp->rib[afi][SAFI_MPLS_VPN]); prn; @@ -1931,7 +1931,7 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi) prefixstr[0] = 0; inet_ntop (rn->p.family, &rn->p.u.prefix, prefixstr, BUFSIZ); - zlog_debug ("%s: checking prefix %s/%d", __func__, prefixstr, + vnc_zlog_debug_verbose ("%s: checking prefix %s/%d", __func__, prefixstr, rn->p.prefixlen); } @@ -1944,7 +1944,7 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi) PREFIX_DENY) { - zlog_debug ("%s: prefix list says DENY", __func__); + vnc_zlog_debug_verbose ("%s: prefix list says DENY", __func__); continue; } } @@ -1952,7 +1952,7 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi) for (ri = rn->info; ri; ri = ri->next) { - zlog_debug ("%s: ri->sub_type: %d", __func__, ri->sub_type); + vnc_zlog_debug_verbose ("%s: ri->sub_type: %d", __func__, ri->sub_type); if (ri->sub_type == BGP_ROUTE_NORMAL || ri->sub_type == BGP_ROUTE_RFP) @@ -1968,7 +1968,7 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi) */ if (encap_attr_export (&hattr, ri->attr, NULL, NULL)) { - zlog_debug ("%s: encap_attr_export failed", __func__); + vnc_zlog_debug_verbose ("%s: encap_attr_export failed", __func__); continue; } @@ -1986,7 +1986,7 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi) { bgp_attr_flush (&hattr); bgp_attr_extra_free (&hattr); - zlog_debug ("%s: route map says DENY", __func__); + vnc_zlog_debug_verbose ("%s: route map says DENY", __func__); continue; } } @@ -2014,7 +2014,7 @@ vnc_direct_bgp_rh_vpn_enable (struct bgp *bgp, afi_t afi) eti->timer = NULL; } - zlog_debug ("%s: calling bgp_update", __func__); + vnc_zlog_debug_verbose ("%s: calling bgp_update", __func__); bgp_update (ri->peer, &rn->p, /* prefix */ 0, /* addpath_id */ @@ -2034,7 +2034,7 @@ vnc_direct_bgp_rh_vpn_disable (struct bgp *bgp, afi_t afi) { struct bgp_node *rn; - zlog_debug ("%s: entry, afi=%d", __func__, afi); + vnc_zlog_debug_verbose ("%s: entry, afi=%d", __func__, afi); if (!bgp) return; @@ -2042,7 +2042,7 @@ vnc_direct_bgp_rh_vpn_disable (struct bgp *bgp, afi_t afi) if (afi != AFI_IP && afi != AFI_IP6) { - zlog_debug ("%s: bad afi: %d", __func__, afi); + vnc_zlog_debug_verbose ("%s: bad afi: %d", __func__, afi); return; } diff --git a/bgpd/rfapi/vnc_export_table.c b/bgpd/rfapi/vnc_export_table.c index 16ffc801ec..7c8035cf81 100644 --- a/bgpd/rfapi/vnc_export_table.c +++ b/bgpd/rfapi/vnc_export_table.c @@ -32,6 +32,7 @@ #include "bgpd/rfapi/vnc_export_table.h" #include "bgpd/rfapi/rfapi_private.h" #include "bgpd/rfapi/rfapi_import.h" +#include "bgpd/rfapi/vnc_debug.h" struct route_node * vnc_etn_get (struct bgp *bgp, vnc_export_type_t type, struct prefix *p) @@ -160,7 +161,7 @@ vnc_eti_delete (struct vnc_export_info *goner) if (!eti) { - zlog_debug ("%s: COULDN'T FIND ETI", __func__); + vnc_zlog_debug_verbose ("%s: COULDN'T FIND ETI", __func__); return; } diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index dc2640ab9e..4801e2906a 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -221,12 +221,12 @@ print_rhn_list (const char *tag1, const char *tag2) sl = bgp->frapi->resolve_nve_nexthop; if (!sl) { - zlog_debug ("%s: %s: RHN List is empty", (tag1 ? tag1 : ""), + vnc_zlog_debug_verbose ("%s: %s: RHN List is empty", (tag1 ? tag1 : ""), (tag2 ? tag2 : "")); return; } - zlog_debug ("%s: %s: RHN list:", (tag1 ? tag1 : ""), (tag2 ? tag2 : "")); + vnc_zlog_debug_verbose ("%s: %s: RHN list:", (tag1 ? tag1 : ""), (tag2 ? tag2 : "")); /* XXX uses secret knowledge of skiplist structure */ for (p = sl->header->forward[0]; p; p = p->forward[0]) @@ -241,7 +241,7 @@ print_rhn_list (const char *tag1, const char *tag2) prefix2str (&pb->hpfx, hbuf, BUFSIZ); prefix2str (&pb->upfx, ubuf, BUFSIZ); - zlog_debug ("RHN Entry %d (q=%p): kpfx=%s, upfx=%s, hpfx=%s, ubi=%p", + vnc_zlog_debug_verbose ("RHN Entry %d (q=%p): kpfx=%s, upfx=%s, hpfx=%s, ubi=%p", ++count, p, kbuf, ubuf, hbuf, pb->ubi); } } @@ -293,13 +293,13 @@ vnc_rhnck (char *tag) prefix2str (&pb->hpfx, str_nve_pfx, BUFSIZ); str_nve_pfx[BUFSIZ - 1] = 0; - zlog_debug + vnc_zlog_debug_verbose ("%s: %s: FATAL: resolve_nve_nexthop list item bi nexthop %s != nve pfx %s", __func__, tag, str_onh, str_nve_pfx); assert (0); } } - zlog_debug ("%s: vnc_rhnck OK", tag); + vnc_zlog_debug_verbose ("%s: vnc_rhnck OK", tag); } #define VNC_RHNCK(n) do {char buf[BUFSIZ];sprintf(buf,"%s: %s", __func__, #n);vnc_rhnck(buf);} while (0) @@ -347,16 +347,16 @@ process_unicast_route ( */ if (hc->plist_redist[ZEBRA_ROUTE_BGP_DIRECT][afi]) { - zlog_debug ("%s: HC prefix list is set, checking", __func__); + vnc_zlog_debug_verbose ("%s: HC prefix list is set, checking", __func__); if (prefix_list_apply (hc->plist_redist[ZEBRA_ROUTE_BGP_DIRECT][afi], prefix) == PREFIX_DENY) { - zlog_debug ("%s: prefix list returns DENY, blocking route", + vnc_zlog_debug_verbose ("%s: prefix list returns DENY, blocking route", __func__); return -1; } - zlog_debug ("%s: prefix list returns PASS, allowing route", __func__); + vnc_zlog_debug_verbose ("%s: prefix list returns PASS, allowing route", __func__); } /* apply routemap, if any, later */ @@ -394,7 +394,7 @@ process_unicast_route ( { bgp_attr_flush (&hattr); bgp_attr_extra_free (&hattr); - zlog_debug ("%s: route map \"%s\" says DENY, returning", __func__, + vnc_zlog_debug_verbose ("%s: route map \"%s\" says DENY, returning", __func__, rmap->name); return -1; } @@ -465,7 +465,7 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi ( uint32_t *plifetime; struct bgp_attr_encap_subtlv *encaptlvs; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); if (bi->type != ZEBRA_ROUTE_BGP && bi->type != ZEBRA_ROUTE_BGP_DIRECT) { @@ -566,14 +566,14 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_rd ( prefix2str (ubi_nexthop, str_nh, BUFSIZ); str_nh[BUFSIZ - 1] = 0; - zlog_debug ("%s: ubi_nexthop=%s", __func__, str_nh); + vnc_zlog_debug_verbose ("%s: ubi_nexthop=%s", __func__, str_nh); } /* exact match */ bn = bgp_node_lookup (table_rd, ubi_nexthop); if (!bn) { - zlog_debug ("%s: no match in RD's table for ubi_nexthop", __func__); + vnc_zlog_debug_verbose ("%s: no match in RD's table for ubi_nexthop", __func__); return; } @@ -631,13 +631,13 @@ vnc_import_bgp_add_route_mode_resolve_nve ( str_nh[1] = 0; } - zlog_debug ("%s(bgp=%p, unicast prefix=%s, unicast nh=%s)", + vnc_zlog_debug_verbose ("%s(bgp=%p, unicast prefix=%s, unicast nh=%s)", __func__, bgp, str_pfx, str_nh); } if (info->type != ZEBRA_ROUTE_BGP) { - zlog_debug ("%s: unicast type %d=\"%s\" is not %d=%s, skipping", + vnc_zlog_debug_verbose ("%s: unicast type %d=\"%s\" is not %d=%s, skipping", __func__, info->type, zebra_route_string (info->type), ZEBRA_ROUTE_BGP, "ZEBRA_ROUTE_BGP"); return; @@ -655,14 +655,14 @@ vnc_import_bgp_add_route_mode_resolve_nve ( if (!(hc = bgp->rfapi_cfg)) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } /* check vnc redist flag for bgp direct routes */ if (!bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT]) { - zlog_debug + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg->redist[afi=%d][type=ZEBRA_ROUTE_BGP_DIRECT] is 0, skipping", __func__, afi); return; @@ -673,7 +673,7 @@ vnc_import_bgp_add_route_mode_resolve_nve ( &ecom, &pfx_unicast_nexthop)) { - zlog_debug ("%s: process_unicast_route error, skipping", __func__); + vnc_zlog_debug_verbose ("%s: process_unicast_route error, skipping", __func__); return; } @@ -739,7 +739,7 @@ vnc_import_bgp_add_route_mode_resolve_nve ( if (ecom) ecommunity_free (&ecom); - zlog_debug ("%s: done", __func__); + vnc_zlog_debug_verbose ("%s: done", __func__); } @@ -771,7 +771,7 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp, buf[0] = 0; prefix2str (prefix, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; - zlog_debug ("%s(prefix=%s) entry", __func__, buf); + vnc_zlog_debug_verbose ("%s(prefix=%s) entry", __func__, buf); } if (!afi) @@ -782,14 +782,14 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp, if (!(hc = bgp->rfapi_cfg)) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } /* check vnc redist flag for bgp direct routes */ if (!bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT]) { - zlog_debug + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg->redist[afi=%d][type=ZEBRA_ROUTE_BGP_DIRECT] is 0, skipping", __func__, afi); return; @@ -799,23 +799,23 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp, * mode "plain" specific code */ { - zlog_debug ("%s: NOT using redist RFG", __func__); + vnc_zlog_debug_verbose ("%s: NOT using redist RFG", __func__); /* * prefix list check */ if (hc->plist_redist[ZEBRA_ROUTE_BGP_DIRECT][afi]) { - zlog_debug ("%s: HC prefix list is set, checking", __func__); + vnc_zlog_debug_verbose ("%s: HC prefix list is set, checking", __func__); if (prefix_list_apply (hc->plist_redist[ZEBRA_ROUTE_BGP_DIRECT][afi], prefix) == PREFIX_DENY) { - zlog_debug ("%s: prefix list returns DENY, blocking route", + vnc_zlog_debug_verbose ("%s: prefix list returns DENY, blocking route", __func__); return; } - zlog_debug ("%s: prefix list returns PASS, allowing route", __func__); + vnc_zlog_debug_verbose ("%s: prefix list returns PASS, allowing route", __func__); } /* apply routemap, if any, later */ @@ -839,7 +839,7 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp, buf[0] = 0; prefix2str (vn_pfx, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; - zlog_debug ("%s vn_pfx=%s", __func__, buf); + vnc_zlog_debug_any ("%s vn_pfx=%s", __func__, buf); } /* @@ -847,7 +847,7 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp, */ if (rfapiQprefix2Raddr (vn_pfx, &vnaddr)) { - zlog_debug ("%s: redist VN invalid, skipping", __func__); + vnc_zlog_debug_verbose ("%s: redist VN invalid, skipping", __func__); return; } @@ -873,7 +873,7 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp, { bgp_attr_flush (&hattr); bgp_attr_extra_free (&hattr); - zlog_debug ("%s: route map \"%s\" says DENY, returning", __func__, + vnc_zlog_debug_verbose ("%s: route map \"%s\" says DENY, returning", __func__, rmap->name); return; } @@ -894,7 +894,7 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp, { if (vnaddr.addr_family != AF_INET) { - zlog_debug + vnc_zlog_debug_verbose ("%s: can't auto-assign RD, VN AF (%d) is not IPv4, skipping", __func__, vnaddr.addr_family); if (iattr) @@ -925,7 +925,7 @@ vnc_import_bgp_add_route_mode_plain (struct bgp *bgp, buf[0] = 0; rfapiRfapiIpAddr2Str (&vnaddr, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; - zlog_debug ("%s: setting vnaddr to %s", __func__, buf); + vnc_zlog_debug_any ("%s: setting vnaddr to %s", __func__, buf); } vncHDBgpDirect.peer = peer; @@ -966,7 +966,7 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp, buf[0] = 0; prefix2str (prefix, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; - zlog_debug ("%s(prefix=%s) entry", __func__, buf); + vnc_zlog_debug_verbose ("%s(prefix=%s) entry", __func__, buf); } assert (rfg); @@ -979,14 +979,14 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp, if (!(hc = bgp->rfapi_cfg)) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } /* check vnc redist flag for bgp direct routes */ if (!bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT]) { - zlog_debug + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg->redist[afi=%d][type=ZEBRA_ROUTE_BGP_DIRECT] is 0, skipping", __func__, afi); return; @@ -1000,23 +1000,23 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp, struct rfapi_ip_prefix pfx_un; - zlog_debug ("%s: using redist RFG", __func__); + vnc_zlog_debug_verbose ("%s: using redist RFG", __func__); /* * RFG prefix list check */ if (rfg->plist_redist[ZEBRA_ROUTE_BGP_DIRECT][afi]) { - zlog_debug ("%s: RFG prefix list is set, checking", __func__); + vnc_zlog_debug_verbose ("%s: RFG prefix list is set, checking", __func__); if (prefix_list_apply (rfg->plist_redist[ZEBRA_ROUTE_BGP_DIRECT][afi], prefix) == PREFIX_DENY) { - zlog_debug ("%s: prefix list returns DENY, blocking route", + vnc_zlog_debug_verbose ("%s: prefix list returns DENY, blocking route", __func__); return; } - zlog_debug ("%s: prefix list returns PASS, allowing route", __func__); + vnc_zlog_debug_verbose ("%s: prefix list returns PASS, allowing route", __func__); } /* apply routemap, if any, later */ @@ -1034,7 +1034,7 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp, if (!is_host_prefix (&rfg->un_prefix)) { /* NB prefixlen==0 means it has not been configured */ - zlog_debug ("%s: redist RFG UN pfx not host pfx (plen=%d), skipping", + vnc_zlog_debug_verbose ("%s: redist RFG UN pfx not host pfx (plen=%d), skipping", __func__, rfg->un_prefix.prefixlen); return; } @@ -1051,7 +1051,7 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp, buf[0] = 0; prefix2str (vn_pfx, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; - zlog_debug ("%s vn_pfx=%s", __func__, buf); + vnc_zlog_debug_any ("%s vn_pfx=%s", __func__, buf); } /* @@ -1059,7 +1059,7 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp, */ if (rfapiQprefix2Raddr (vn_pfx, &vnaddr)) { - zlog_debug ("%s: redist VN invalid, skipping", __func__); + vnc_zlog_debug_verbose ("%s: redist VN invalid, skipping", __func__); return; } @@ -1085,7 +1085,7 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp, { bgp_attr_flush (&hattr); bgp_attr_extra_free (&hattr); - zlog_debug ("%s: route map \"%s\" says DENY, returning", __func__, + vnc_zlog_debug_verbose ("%s: route map \"%s\" says DENY, returning", __func__, rmap->name); return; } @@ -1133,7 +1133,7 @@ vnc_import_bgp_add_route_mode_nvegroup (struct bgp *bgp, buf[0] = 0; rfapiRfapiIpAddr2Str (&vnaddr, buf, BUFSIZ); buf[BUFSIZ - 1] = 0; - zlog_debug ("%s: setting vnaddr to %s", __func__, buf); + vnc_zlog_debug_any ("%s: setting vnaddr to %s", __func__, buf); } vncHDBgpDirect.peer = peer; @@ -1185,7 +1185,7 @@ vnc_import_bgp_del_route_mode_plain (struct bgp *bgp, } else { - zlog_debug ("%s: no attr, can't delete route", __func__); + vnc_zlog_debug_verbose ("%s: no attr, can't delete route", __func__); return; } vn_pfx = &vn_pfx_space; @@ -1196,7 +1196,7 @@ vnc_import_bgp_del_route_mode_plain (struct bgp *bgp, case AF_INET: if (vn_pfx->prefixlen != 32) { - zlog_debug ("%s: redist VN plen (%d) != 32, skipping", + vnc_zlog_debug_verbose ("%s: redist VN plen (%d) != 32, skipping", __func__, vn_pfx->prefixlen); return; } @@ -1206,7 +1206,7 @@ vnc_import_bgp_del_route_mode_plain (struct bgp *bgp, case AF_INET6: if (vn_pfx->prefixlen != 128) { - zlog_debug ("%s: redist VN plen (%d) != 128, skipping", + vnc_zlog_debug_verbose ("%s: redist VN plen (%d) != 128, skipping", __func__, vn_pfx->prefixlen); return; } @@ -1214,7 +1214,7 @@ vnc_import_bgp_del_route_mode_plain (struct bgp *bgp, break; default: - zlog_debug ("%s: no redist RFG VN host pfx configured, skipping", + vnc_zlog_debug_verbose ("%s: no redist RFG VN host pfx configured, skipping", __func__); return; } @@ -1223,12 +1223,12 @@ vnc_import_bgp_del_route_mode_plain (struct bgp *bgp, memset (&prd, 0, sizeof (prd)); if (rfapi_set_autord_from_vn (&prd, &vnaddr)) { - zlog_debug ("%s: can't auto-assign RD, skipping", __func__); + vnc_zlog_debug_verbose ("%s: can't auto-assign RD, skipping", __func__); return; } vncHDBgpDirect.peer = info->peer; - zlog_debug ("%s: setting peer to %p", __func__, vncHDBgpDirect.peer); + vnc_zlog_debug_verbose ("%s: setting peer to %p", __func__, vncHDBgpDirect.peer); del_vnc_route (&vncHDBgpDirect, info->peer, bgp, @@ -1273,7 +1273,7 @@ vnc_import_bgp_del_route_mode_nvegroup (struct bgp *bgp, case AF_INET: if (vn_pfx->prefixlen != 32) { - zlog_debug ("%s: redist VN plen (%d) != 32, skipping", + vnc_zlog_debug_verbose ("%s: redist VN plen (%d) != 32, skipping", __func__, vn_pfx->prefixlen); return; } @@ -1283,7 +1283,7 @@ vnc_import_bgp_del_route_mode_nvegroup (struct bgp *bgp, case AF_INET6: if (vn_pfx->prefixlen != 128) { - zlog_debug ("%s: redist VN plen (%d) != 128, skipping", + vnc_zlog_debug_verbose ("%s: redist VN plen (%d) != 128, skipping", __func__, vn_pfx->prefixlen); return; } @@ -1291,7 +1291,7 @@ vnc_import_bgp_del_route_mode_nvegroup (struct bgp *bgp, break; default: - zlog_debug ("%s: no redist RFG VN host pfx configured, skipping", + vnc_zlog_debug_verbose ("%s: no redist RFG VN host pfx configured, skipping", __func__); return; } @@ -1306,14 +1306,14 @@ vnc_import_bgp_del_route_mode_nvegroup (struct bgp *bgp, /* means "auto" with VN addr */ if (rfapi_set_autord_from_vn (&prd, &vnaddr)) { - zlog_debug ("%s: can't auto-assign RD, skipping", __func__); + vnc_zlog_debug_verbose ("%s: can't auto-assign RD, skipping", __func__); return; } } vncHDBgpDirect.peer = info->peer; - zlog_debug ("%s: setting peer to %p", __func__, vncHDBgpDirect.peer); + vnc_zlog_debug_verbose ("%s: setting peer to %p", __func__, vncHDBgpDirect.peer); del_vnc_route (&vncHDBgpDirect, info->peer, bgp, @@ -1386,7 +1386,7 @@ vnc_import_bgp_del_route_mode_resolve_nve_one_rd ( prefix2str (ubi_nexthop, str_nh, BUFSIZ); str_nh[BUFSIZ - 1] = 0; - zlog_debug ("%s: ubi_nexthop=%s", __func__, str_nh); + vnc_zlog_debug_verbose ("%s: ubi_nexthop=%s", __func__, str_nh); } @@ -1394,7 +1394,7 @@ vnc_import_bgp_del_route_mode_resolve_nve_one_rd ( bn = bgp_node_lookup (table_rd, ubi_nexthop); if (!bn) { - zlog_debug ("%s: no match in RD's table for ubi_nexthop", __func__); + vnc_zlog_debug_verbose ("%s: no match in RD's table for ubi_nexthop", __func__); return; } @@ -1429,13 +1429,13 @@ vnc_import_bgp_del_route_mode_resolve_nve (struct bgp *bgp, if (!sl) { - zlog_debug ("%s: no RHN entries, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no RHN entries, skipping", __func__); return; } if (info->type != ZEBRA_ROUTE_BGP) { - zlog_debug ("%s: unicast type %d=\"%s\" is not %d=%s, skipping", + vnc_zlog_debug_verbose ("%s: unicast type %d=\"%s\" is not %d=%s, skipping", __func__, info->type, zebra_route_string (info->type), ZEBRA_ROUTE_BGP, "ZEBRA_ROUTE_BGP"); return; @@ -1445,7 +1445,7 @@ vnc_import_bgp_del_route_mode_resolve_nve (struct bgp *bgp, &ecom, &pfx_unicast_nexthop)) { - zlog_debug ("%s: process_unicast_route error, skipping", __func__); + vnc_zlog_debug_verbose ("%s: process_unicast_route error, skipping", __func__); return; } @@ -1511,24 +1511,24 @@ vnc_import_bgp_add_vnc_host_route_mode_resolve_nve ( void *cursor; struct rfapi_cfg *hc = NULL; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); if (afi != AFI_IP && afi != AFI_IP6) { - zlog_debug ("%s: bad afi %d, skipping", __func__, afi); + vnc_zlog_debug_verbose ("%s: bad afi %d, skipping", __func__, afi); return; } if (!(hc = bgp->rfapi_cfg)) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } /* check vnc redist flag for bgp direct routes */ if (!hc->redist[afi][ZEBRA_ROUTE_BGP_DIRECT]) { - zlog_debug + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg->redist[afi=%d][type=ZEBRA_ROUTE_BGP_DIRECT] is 0, skipping", __func__, afi); return; @@ -1536,7 +1536,7 @@ vnc_import_bgp_add_vnc_host_route_mode_resolve_nve ( if (hc->redist_mode != VNC_REDIST_MODE_RESOLVE_NVE) { - zlog_debug ("%s: not in resolve-nve mode, skipping", __func__); + vnc_zlog_debug_verbose ("%s: not in resolve-nve mode, skipping", __func__); return; } @@ -1545,13 +1545,13 @@ vnc_import_bgp_add_vnc_host_route_mode_resolve_nve ( if (!sl) { - zlog_debug ("%s: no resolve_nve_nexthop skiplist, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no resolve_nve_nexthop skiplist, skipping", __func__); return; } if (!is_host_prefix (prefix)) { - zlog_debug ("%s: not host prefix, skipping", __func__); + vnc_zlog_debug_verbose ("%s: not host prefix, skipping", __func__); return; } @@ -1573,7 +1573,7 @@ vnc_import_bgp_add_vnc_host_route_mode_resolve_nve ( prefix2str (&pb->hpfx, hbuf, BUFSIZ); prefix2str (&pb->upfx, ubuf, BUFSIZ); - zlog_debug + vnc_zlog_debug_any ("%s: examining RHN Entry (q=%p): upfx=%s, hpfx=%s, ubi=%p", __func__, cursor, ubuf, hbuf, pb->ubi); } @@ -1582,7 +1582,7 @@ vnc_import_bgp_add_vnc_host_route_mode_resolve_nve ( &ecom, &pfx_unicast_nexthop)) { - zlog_debug ("%s: process_unicast_route error, skipping", __func__); + vnc_zlog_debug_verbose ("%s: process_unicast_route error, skipping", __func__); continue; } local_pref = calc_local_pref (pb->ubi->attr, pb->ubi->peer); @@ -1608,7 +1608,7 @@ vnc_import_bgp_add_vnc_host_route_mode_resolve_nve ( prefix2str (prefix, str_nve_pfx, BUFSIZ); str_nve_pfx[BUFSIZ - 1] = 0; - zlog_debug + vnc_zlog_debug_verbose ("%s: FATAL: resolve_nve_nexthop list item bi nexthop %s != nve pfx %s", __func__, str_unh, str_nve_pfx); assert (0); @@ -1629,14 +1629,14 @@ vnc_import_bgp_add_vnc_host_route_mode_resolve_nve ( prefix2str (prefix, pbuf, BUFSIZ); - zlog_debug ("%s: advancing past RHN Entry (q=%p): with prefix %s", + vnc_zlog_debug_verbose ("%s: advancing past RHN Entry (q=%p): with prefix %s", __func__, cursor, pbuf); print_rhn_list (__func__, NULL); /* debug */ } #endif rc = skiplist_next_value (sl, prefix, (void *) &pb, &cursor); } - zlog_debug ("%s: done", __func__); + vnc_zlog_debug_verbose ("%s: done", __func__); } @@ -1661,7 +1661,7 @@ vnc_import_bgp_del_vnc_host_route_mode_resolve_nve ( prefix2str (prefix, str_pfx, BUFSIZ); str_pfx[BUFSIZ - 1] = 0; - zlog_debug ("%s(bgp=%p, nve prefix=%s)", __func__, bgp, str_pfx); + vnc_zlog_debug_verbose ("%s(bgp=%p, nve prefix=%s)", __func__, bgp, str_pfx); } if (afi != AFI_IP && afi != AFI_IP6) @@ -1669,14 +1669,14 @@ vnc_import_bgp_del_vnc_host_route_mode_resolve_nve ( if (!(hc = bgp->rfapi_cfg)) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } /* check vnc redist flag for bgp direct routes */ if (!hc->redist[afi][ZEBRA_ROUTE_BGP_DIRECT]) { - zlog_debug + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg->redist[afi=%d][type=ZEBRA_ROUTE_BGP_DIRECT] is 0, skipping", __func__, afi); return; @@ -1684,7 +1684,7 @@ vnc_import_bgp_del_vnc_host_route_mode_resolve_nve ( if (hc->redist_mode != VNC_REDIST_MODE_RESOLVE_NVE) { - zlog_debug ("%s: not in resolve-nve mode, skipping", __func__); + vnc_zlog_debug_verbose ("%s: not in resolve-nve mode, skipping", __func__); return; } @@ -1693,13 +1693,13 @@ vnc_import_bgp_del_vnc_host_route_mode_resolve_nve ( if (!sl) { - zlog_debug ("%s: no RHN entries, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no RHN entries, skipping", __func__); return; } if (!is_host_prefix (prefix)) { - zlog_debug ("%s: not host route, skip", __func__); + vnc_zlog_debug_verbose ("%s: not host route, skip", __func__); return; } @@ -1719,7 +1719,7 @@ vnc_import_bgp_del_vnc_host_route_mode_resolve_nve ( &ecom, &pfx_unicast_nexthop)) { - zlog_debug ("%s: process_unicast_route error, skipping", __func__); + vnc_zlog_debug_verbose ("%s: process_unicast_route error, skipping", __func__); continue; } @@ -1737,7 +1737,7 @@ vnc_import_bgp_del_vnc_host_route_mode_resolve_nve ( prefix2str (prefix, str_nve_pfx, BUFSIZ); str_nve_pfx[BUFSIZ - 1] = 0; - zlog_debug + vnc_zlog_debug_verbose ("%s: FATAL: resolve_nve_nexthop list item bi nexthop %s != nve pfx %s", __func__, str_unh, str_nve_pfx); assert (0); @@ -1767,7 +1767,7 @@ is_usable_interior_route (struct bgp_info *bi_interior) if (!VALID_INTERIOR_TYPE (bi_interior->type)) { #if DEBUG_IS_USABLE_INTERIOR - zlog_debug ("%s: NO: type %d is not valid interior type", + vnc_zlog_debug_verbose ("%s: NO: type %d is not valid interior type", __func__, bi_interior->type); #endif return 0; @@ -1775,7 +1775,7 @@ is_usable_interior_route (struct bgp_info *bi_interior) if (!CHECK_FLAG (bi_interior->flags, BGP_INFO_VALID)) { #if DEBUG_IS_USABLE_INTERIOR - zlog_debug ("%s: NO: BGP_INFO_VALID not set", __func__); + vnc_zlog_debug_verbose ("%s: NO: BGP_INFO_VALID not set", __func__); #endif return 0; } @@ -1811,36 +1811,36 @@ vnc_import_bgp_exterior_add_route_it ( h = bgp_default->rfapi; hc = bgp_default->rfapi_cfg; - zlog_debug ("%s: entry with it=%p", __func__, it_only); + vnc_zlog_debug_verbose ("%s: entry with it=%p", __func__, it_only); if (!h || !hc) { - zlog_debug ("%s: rfapi or rfapi_cfg not instantiated, skipping", + vnc_zlog_debug_verbose ("%s: rfapi or rfapi_cfg not instantiated, skipping", __func__); return; } if (!hc->redist_bgp_exterior_view) { - zlog_debug ("%s: exterior view not set, skipping", __func__); + vnc_zlog_debug_verbose ("%s: exterior view not set, skipping", __func__); return; } if (bgp != hc->redist_bgp_exterior_view) { - zlog_debug ("%s: bgp %p != hc->redist_bgp_exterior_view %p, skipping", + vnc_zlog_debug_verbose ("%s: bgp %p != hc->redist_bgp_exterior_view %p, skipping", __func__, bgp, hc->redist_bgp_exterior_view); return; } if (!hc->redist[afi][ZEBRA_ROUTE_BGP_DIRECT_EXT]) { - zlog_debug ("%s: redist of exterior routes not enabled, skipping", + vnc_zlog_debug_verbose ("%s: redist of exterior routes not enabled, skipping", __func__); return; } if (!info->attr) { - zlog_debug ("%s: no info, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no info, skipping", __func__); return; } @@ -1860,11 +1860,11 @@ vnc_import_bgp_exterior_add_route_it ( struct bgp_info *bi_interior; int have_usable_route; - zlog_debug ("%s: doing it %p", __func__, it); + vnc_zlog_debug_verbose ("%s: doing it %p", __func__, it); if (it_only && (it_only != it)) { - zlog_debug ("%s: doesn't match it_only %p", __func__, it_only); + vnc_zlog_debug_verbose ("%s: doesn't match it_only %p", __func__, it_only); continue; } @@ -1874,7 +1874,7 @@ vnc_import_bgp_exterior_add_route_it ( have_usable_route = 0; (!have_usable_route) && rn;) { - zlog_debug ("%s: it %p trying rn %p", __func__, it, rn); + vnc_zlog_debug_verbose ("%s: it %p trying rn %p", __func__, it, rn); for (bi_interior = rn->info; bi_interior; bi_interior = bi_interior->next) @@ -1886,7 +1886,7 @@ vnc_import_bgp_exterior_add_route_it ( if (!is_usable_interior_route (bi_interior)) continue; - zlog_debug ("%s: usable: bi_interior %p", __func__, + vnc_zlog_debug_verbose ("%s: usable: bi_interior %p", __func__, bi_interior); /* @@ -2012,31 +2012,31 @@ vnc_import_bgp_exterior_del_route ( if (!h || !hc) { - zlog_debug ("%s: rfapi or rfapi_cfg not instantiated, skipping", + vnc_zlog_debug_verbose ("%s: rfapi or rfapi_cfg not instantiated, skipping", __func__); return; } if (!hc->redist_bgp_exterior_view) { - zlog_debug ("%s: exterior view not set, skipping", __func__); + vnc_zlog_debug_verbose ("%s: exterior view not set, skipping", __func__); return; } if (bgp != hc->redist_bgp_exterior_view) { - zlog_debug ("%s: bgp %p != hc->redist_bgp_exterior_view %p, skipping", + vnc_zlog_debug_verbose ("%s: bgp %p != hc->redist_bgp_exterior_view %p, skipping", __func__, bgp, hc->redist_bgp_exterior_view); return; } if (!hc->redist[afi][ZEBRA_ROUTE_BGP_DIRECT_EXT]) { - zlog_debug ("%s: redist of exterior routes no enabled, skipping", + vnc_zlog_debug_verbose ("%s: redist of exterior routes no enabled, skipping", __func__); return; } if (!info->attr) { - zlog_debug ("%s: no info, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no info, skipping", __func__); return; } @@ -2162,24 +2162,24 @@ vnc_import_bgp_exterior_add_route_interior ( int rc; struct list *list_adopted; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); if (!is_usable_interior_route (bi_interior)) { - zlog_debug ("%s: not usable interior route, skipping", __func__); + vnc_zlog_debug_verbose ("%s: not usable interior route, skipping", __func__); return; } if (!bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT_EXT]) { - zlog_debug ("%s: redist of exterior routes no enabled, skipping", + vnc_zlog_debug_verbose ("%s: redist of exterior routes no enabled, skipping", __func__); return; } if (it == bgp->rfapi->it_ce) { - zlog_debug ("%s: import table is it_ce, skipping", __func__); + vnc_zlog_debug_verbose ("%s: import table is it_ce, skipping", __func__); return; } @@ -2190,7 +2190,7 @@ vnc_import_bgp_exterior_add_route_interior ( prefix2str (&rn_interior->p, str_pfx, BUFSIZ); str_pfx[BUFSIZ - 1] = 0; - zlog_debug ("%s: interior prefix=%s, bi type=%d", + vnc_zlog_debug_verbose ("%s: interior prefix=%s, bi type=%d", __func__, str_pfx, bi_interior->type); } @@ -2199,7 +2199,7 @@ vnc_import_bgp_exterior_add_route_interior ( int count = 0; /* debugging */ - zlog_debug ("%s: has exterior monitor; ext src: %p", __func__, + vnc_zlog_debug_verbose ("%s: has exterior monitor; ext src: %p", __func__, RFAPI_MONITOR_EXTERIOR (rn_interior)->source); /* @@ -2256,13 +2256,13 @@ vnc_import_bgp_exterior_add_route_interior ( bgp_attr_extra_free (&new_attr); } - zlog_debug + vnc_zlog_debug_verbose ("%s: finished constructing exteriors based on existing monitors", __func__); return; } - zlog_debug ("%s: no exterior monitor", __func__); + vnc_zlog_debug_verbose ("%s: no exterior monitor", __func__); /* * No monitor at this node. Is this the first valid interior @@ -2270,7 +2270,7 @@ vnc_import_bgp_exterior_add_route_interior ( */ if (RFAPI_MONITOR_EXTERIOR (rn_interior)->valid_interior_count > 1) { - zlog_debug + vnc_zlog_debug_verbose ("%s: new interior route not first valid one, skipping pulldown", __func__); return; @@ -2289,7 +2289,7 @@ vnc_import_bgp_exterior_add_route_interior ( if (par) { - zlog_debug ("%s: checking parent %p for possible pulldowns", + vnc_zlog_debug_verbose ("%s: checking parent %p for possible pulldowns", __func__, par); /* check monitors at par for possible pulldown */ @@ -2423,7 +2423,7 @@ vnc_import_bgp_exterior_add_route_interior ( } } - zlog_debug ("%s: checking orphans", __func__); + vnc_zlog_debug_verbose ("%s: checking orphans", __func__); /* * See if any orphans can be pulled down to the current node @@ -2444,11 +2444,11 @@ vnc_import_bgp_exterior_add_route_interior ( prefix2str (pfx_exterior, buf, sizeof (buf)); buf[sizeof (buf) - 1] = 0; - zlog_debug ("%s: checking exterior orphan at prefix %s", __func__, buf); + vnc_zlog_debug_verbose ("%s: checking exterior orphan at prefix %s", __func__, buf); if (afi_exterior != afi) { - zlog_debug ("%s: exterior orphan afi %d != interior afi %d, skip", + vnc_zlog_debug_verbose ("%s: exterior orphan afi %d != interior afi %d, skip", __func__, afi_exterior, afi); continue; } @@ -2559,28 +2559,28 @@ vnc_import_bgp_exterior_del_route_interior ( if (!VALID_INTERIOR_TYPE (bi_interior->type)) { - zlog_debug ("%s: type %d not valid interior type, skipping", + vnc_zlog_debug_verbose ("%s: type %d not valid interior type, skipping", __func__, bi_interior->type); return; } if (!bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT_EXT]) { - zlog_debug ("%s: redist of exterior routes no enabled, skipping", + vnc_zlog_debug_verbose ("%s: redist of exterior routes no enabled, skipping", __func__); return; } if (it == bgp->rfapi->it_ce) { - zlog_debug ("%s: it is it_ce, skipping", __func__); + vnc_zlog_debug_verbose ("%s: it is it_ce, skipping", __func__); return; } /* If no exterior routes depend on this prefix, nothing to do */ if (!RFAPI_HAS_MONITOR_EXTERIOR (rn_interior)) { - zlog_debug ("%s: no exterior monitor, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no exterior monitor, skipping", __func__); return; } @@ -2591,7 +2591,7 @@ vnc_import_bgp_exterior_del_route_interior ( prefix2str (&rn_interior->p, str_pfx, BUFSIZ); str_pfx[BUFSIZ - 1] = 0; - zlog_debug ("%s: interior prefix=%s, bi type=%d", + vnc_zlog_debug_verbose ("%s: interior prefix=%s, bi type=%d", __func__, str_pfx, bi_interior->type); } @@ -2635,7 +2635,7 @@ vnc_import_bgp_exterior_del_route_interior ( */ if (RFAPI_MONITOR_EXTERIOR (rn_interior)->valid_interior_count) { - zlog_debug ("%s: interior routes still present, skipping", __func__); + vnc_zlog_debug_verbose ("%s: interior routes still present, skipping", __func__); return; } @@ -2650,7 +2650,7 @@ vnc_import_bgp_exterior_del_route_interior ( break; } - zlog_debug ("%s: par=%p, ext src: %p", __func__, + vnc_zlog_debug_verbose ("%s: par=%p, ext src: %p", __func__, par, RFAPI_MONITOR_EXTERIOR (rn_interior)->source); /* move all monitors */ @@ -2769,7 +2769,7 @@ vnc_import_bgp_add_route ( rfapiUnicastNexthop2Prefix (afi, info->attr, &pfx_nexthop); prefix2str (&pfx_nexthop, buf_nh, BUFSIZ); - zlog_debug ("%s: pfx %s, nh %s", __func__, buf, buf_nh); + vnc_zlog_debug_verbose ("%s: pfx %s, nh %s", __func__, buf, buf_nh); } #if DEBUG_RHN_LIST print_rhn_list(__func__, "ENTER "); @@ -2784,14 +2784,14 @@ vnc_import_bgp_add_route ( if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } /* check vnc redist flag for bgp direct routes */ if (!bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT]) { - zlog_debug + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg->redist[afi=%d][type=%d=ZEBRA_ROUTE_BGP_DIRECT] is 0, skipping", __func__, afi, ZEBRA_ROUTE_BGP_DIRECT); return; @@ -2808,7 +2808,7 @@ vnc_import_bgp_add_route ( vnc_import_bgp_add_route_mode_nvegroup (bgp, prefix, info, bgp->rfapi_cfg->rfg_redist); else - zlog_debug ("%s: mode RFG but no redist RFG", __func__); + vnc_zlog_debug_verbose ("%s: mode RFG but no redist RFG", __func__); break; case VNC_REDIST_MODE_RESOLVE_NVE: @@ -2843,7 +2843,7 @@ vnc_import_bgp_del_route ( rfapiUnicastNexthop2Prefix (afi, info->attr, &pfx_nexthop); prefix2str (&pfx_nexthop, buf_nh, BUFSIZ); - zlog_debug ("%s: pfx %s, nh %s", __func__, buf, buf_nh); + vnc_zlog_debug_verbose ("%s: pfx %s, nh %s", __func__, buf, buf_nh); } #if DEBUG_RHN_LIST print_rhn_list(__func__, "ENTER "); @@ -2852,15 +2852,15 @@ vnc_import_bgp_del_route ( if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } /* check bgp redist flag for vnc direct ("vpn") routes */ if (!bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT]) { - zlog_debug ("%s: bgp redistribution of afi=%d VNC direct routes is off", - __func__, afi); + vnc_zlog_debug_verbose ("%s: bgp redistribution of afi=%d VNC direct routes is off", + __func__, afi); return; } @@ -2874,7 +2874,7 @@ vnc_import_bgp_del_route ( if (bgp->rfapi_cfg->rfg_redist) vnc_import_bgp_del_route_mode_nvegroup (bgp, prefix, info); else - zlog_debug ("%s: mode RFG but no redist RFG", __func__); + vnc_zlog_debug_verbose ("%s: mode RFG but no redist RFG", __func__); break; case VNC_REDIST_MODE_RESOLVE_NVE: @@ -2900,11 +2900,11 @@ vnc_import_bgp_redist_enable (struct bgp *bgp, afi_t afi) struct bgp_node *rn; - zlog_debug ("%s: entry, afi=%d", __func__, afi); + vnc_zlog_debug_verbose ("%s: entry, afi=%d", __func__, afi); if (bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT]) { - zlog_debug ("%s: already enabled for afi %d, skipping", __func__, afi); + vnc_zlog_debug_verbose ("%s: already enabled for afi %d, skipping", __func__, afi); return; } bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT] = 1; @@ -2924,7 +2924,7 @@ vnc_import_bgp_redist_enable (struct bgp *bgp, afi_t afi) vnc_import_bgp_add_route (bgp, &rn->p, bi); } } - zlog_debug ("%s: set redist[afi=%d][type=%d=ZEBRA_ROUTE_BGP_DIRECT] return", + vnc_zlog_debug_verbose ("%s: set redist[afi=%d][type=%d=ZEBRA_ROUTE_BGP_DIRECT] return", __func__, afi, ZEBRA_ROUTE_BGP_DIRECT); } @@ -2938,14 +2938,14 @@ vnc_import_bgp_exterior_redist_enable (struct bgp *bgp, afi_t afi) if (bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT_EXT]) { - zlog_debug ("%s: already enabled for afi %d, skipping", __func__, afi); + vnc_zlog_debug_verbose ("%s: already enabled for afi %d, skipping", __func__, afi); return; } bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT_EXT] = 1; if (!bgp_exterior) { - zlog_debug ("%s: no exterior view set yet, no routes to import yet", + vnc_zlog_debug_verbose ("%s: no exterior view set yet, no routes to import yet", __func__); return; } @@ -2965,7 +2965,7 @@ vnc_import_bgp_exterior_redist_enable (struct bgp *bgp, afi_t afi) vnc_import_bgp_exterior_add_route (bgp_exterior, &rn->p, bi); } } - zlog_debug ("%s: set redist[afi=%d][type=%d=ZEBRA_ROUTE_BGP_DIRECT] return", + vnc_zlog_debug_verbose ("%s: set redist[afi=%d][type=%d=ZEBRA_ROUTE_BGP_DIRECT] return", __func__, afi, ZEBRA_ROUTE_BGP_DIRECT); } @@ -2982,19 +2982,19 @@ vnc_import_bgp_exterior_redist_enable_it ( struct bgp *bgp_exterior; struct bgp_node *rn; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); bgp_exterior = bgp->rfapi_cfg->redist_bgp_exterior_view; if (!bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT_EXT]) { - zlog_debug ("%s: not enabled for afi %d, skipping", __func__, afi); + vnc_zlog_debug_verbose ("%s: not enabled for afi %d, skipping", __func__, afi); return; } if (!bgp_exterior) { - zlog_debug ("%s: no exterior view set yet, no routes to import yet", + vnc_zlog_debug_verbose ("%s: no exterior view set yet, no routes to import yet", __func__); return; } @@ -3029,11 +3029,11 @@ vnc_import_bgp_redist_disable (struct bgp *bgp, afi_t afi) struct bgp_node *rn1; struct bgp_node *rn2; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); if (!bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT]) { - zlog_debug ("%s: already disabled for afi %d, skipping", __func__, afi); + vnc_zlog_debug_verbose ("%s: already disabled for afi %d, skipping", __func__, afi); return; } @@ -3067,7 +3067,7 @@ vnc_import_bgp_redist_disable (struct bgp *bgp, afi_t afi) rfd = bi->extra->vnc.export.rfapi_handle; - zlog_debug + vnc_zlog_debug_verbose ("%s: deleting bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p [passing rfd=%p]", __func__, bi, bi->peer, bi->type, bi->sub_type, (bi->extra ? bi->extra->vnc. @@ -3097,7 +3097,7 @@ vnc_import_bgp_redist_disable (struct bgp *bgp, afi_t afi) } bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT] = 0; - zlog_debug ("%s: return", __func__); + vnc_zlog_debug_verbose ("%s: return", __func__); } @@ -3107,17 +3107,17 @@ vnc_import_bgp_exterior_redist_disable (struct bgp *bgp, afi_t afi) struct rfapi_cfg *hc = bgp->rfapi_cfg; struct bgp *bgp_exterior = hc->redist_bgp_exterior_view; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); if (!hc->redist[afi][ZEBRA_ROUTE_BGP_DIRECT_EXT]) { - zlog_debug ("%s: already disabled for afi %d, skipping", __func__, afi); + vnc_zlog_debug_verbose ("%s: already disabled for afi %d, skipping", __func__, afi); return; } if (!bgp_exterior) { - zlog_debug ("%s: bgp exterior view not defined, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp exterior view not defined, skipping", __func__); return; } @@ -3145,5 +3145,5 @@ vnc_import_bgp_exterior_redist_disable (struct bgp *bgp, afi_t afi) } bgp->rfapi_cfg->redist[afi][ZEBRA_ROUTE_BGP_DIRECT_EXT] = 0; - zlog_debug ("%s: return", __func__); + vnc_zlog_debug_verbose ("%s: return", __func__); } diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c index e357ef6eff..608bc6d3c7 100644 --- a/bgpd/rfapi/vnc_zebra.c +++ b/bgpd/rfapi/vnc_zebra.c @@ -46,6 +46,7 @@ #include "bgpd/rfapi/vnc_zebra.h" #include "bgpd/rfapi/rfapi_vty.h" #include "bgpd/rfapi/rfapi_backend.h" +#include "bgpd/rfapi/vnc_debug.h" static struct rfapi_descriptor vncHD1VR; /* Single-VR export dummy nve descr */ static struct zclient *zclient_vnc = NULL; @@ -75,28 +76,28 @@ vnc_redistribute_add ( if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } afi = family2afi (p->family); if (!afi) { - zlog_debug ("%s: unknown prefix address family %d", __func__, + vnc_zlog_debug_verbose ("%s: unknown prefix address family %d", __func__, p->family); return; } if (!bgp->rfapi_cfg->redist[afi][type]) { - zlog_debug + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg->redist[afi=%d][type=%d] is 0, skipping", __func__, afi, type); return; } if (!bgp->rfapi_cfg->rfg_redist) { - zlog_debug ("%s: no redist nve group, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no redist nve group, skipping", __func__); return; } @@ -111,7 +112,7 @@ vnc_redistribute_add ( case AF_INET: if (bgp->rfapi_cfg->rfg_redist->vn_prefix.prefixlen != 32) { - zlog_debug + vnc_zlog_debug_verbose ("%s: redist nve group VN prefix len (%d) != 32, skipping", __func__, bgp->rfapi_cfg->rfg_redist->vn_prefix.prefixlen); return; @@ -121,7 +122,7 @@ vnc_redistribute_add ( case AF_INET6: if (bgp->rfapi_cfg->rfg_redist->vn_prefix.prefixlen != 128) { - zlog_debug + vnc_zlog_debug_verbose ("%s: redist nve group VN prefix len (%d) != 128, skipping", __func__, bgp->rfapi_cfg->rfg_redist->vn_prefix.prefixlen); return; @@ -129,7 +130,7 @@ vnc_redistribute_add ( vnaddr.addr.v6 = bgp->rfapi_cfg->rfg_redist->vn_prefix.u.prefix6; break; default: - zlog_debug + vnc_zlog_debug_verbose ("%s: no redist nve group VN host prefix configured, skipping", __func__); return; @@ -155,7 +156,7 @@ vnc_redistribute_add ( case AF_INET: if (pfx_un.length != 32) { - zlog_debug + vnc_zlog_debug_verbose ("%s: redist nve group UN prefix len (%d) != 32, skipping", __func__, pfx_un.length); return; @@ -164,14 +165,14 @@ vnc_redistribute_add ( case AF_INET6: if (pfx_un.length != 128) { - zlog_debug + vnc_zlog_debug_verbose ("%s: redist nve group UN prefix len (%d) != 128, skipping", __func__, pfx_un.length); return; } break; default: - zlog_debug + vnc_zlog_debug_verbose ("%s: no redist nve group UN host prefix configured, skipping", __func__); return; @@ -238,26 +239,26 @@ vnc_redistribute_delete (struct prefix *p, uint8_t type) if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } afi = family2afi (p->family); if (!afi) { - zlog_debug ("%s: unknown prefix address family %d", __func__, + vnc_zlog_debug_verbose ("%s: unknown prefix address family %d", __func__, p->family); return; } if (!bgp->rfapi_cfg->redist[afi][type]) { - zlog_debug + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg->redist[afi=%d][type=%d] is 0, skipping", __func__, afi, type); return; } if (!bgp->rfapi_cfg->rfg_redist) { - zlog_debug ("%s: no redist nve group, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no redist nve group, skipping", __func__); return; } @@ -284,13 +285,13 @@ vnc_redistribute_withdraw (struct bgp *bgp, afi_t afi, uint8_t type) struct bgp_node *prn; struct bgp_node *rn; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); if (!bgp) return; if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } @@ -331,7 +332,7 @@ vnc_redistribute_withdraw (struct bgp *bgp, afi_t afi, uint8_t type) } } } - zlog_debug ("%s: return", __func__); + vnc_zlog_debug_verbose ("%s: return", __func__); } /* @@ -388,7 +389,7 @@ vnc_zebra_read_ipv4 ( if (BGP_DEBUG (zebra, ZEBRA)) { char buf[2][INET_ADDRSTRLEN]; - zlog_debug + vnc_zlog_debug_verbose ("%s: Zebra rcvd: IPv4 route add %s %s/%d nexthop %s metric %u", __func__, zebra_route_string (api.type), inet_ntop (AF_INET, &p.prefix, @@ -406,7 +407,7 @@ vnc_zebra_read_ipv4 ( if (BGP_DEBUG (zebra, ZEBRA)) { char buf[2][INET_ADDRSTRLEN]; - zlog_debug ("%s: Zebra rcvd: IPv4 route delete %s %s/%d " + vnc_zlog_debug_verbose ("%s: Zebra rcvd: IPv4 route delete %s %s/%d " "nexthop %s metric %u", __func__, zebra_route_string (api.type), @@ -477,7 +478,7 @@ vnc_zebra_read_ipv6 ( if (BGP_DEBUG (zebra, ZEBRA)) { char buf[INET6_ADDRSTRLEN]; - zlog_debug ("Zebra rcvd: IPv6 route add %s %s/%d metric %u", + vnc_zlog_debug_verbose ("Zebra rcvd: IPv6 route add %s %s/%d metric %u", zebra_route_string (api.type), inet_ntop (AF_INET6, &p.prefix, buf, sizeof (buf)), p.prefixlen, api.metric); @@ -489,7 +490,7 @@ vnc_zebra_read_ipv6 ( if (BGP_DEBUG (zebra, ZEBRA)) { char buf[INET6_ADDRSTRLEN]; - zlog_debug ("Zebra rcvd: IPv6 route delete %s %s/%d metric %u", + vnc_zlog_debug_verbose ("Zebra rcvd: IPv6 route delete %s %s/%d metric %u", zebra_route_string (api.type), inet_ntop (AF_INET6, &p.prefix, buf, sizeof (buf)), p.prefixlen, api.metric); @@ -516,7 +517,7 @@ vnc_zebra_route_msg ( { if (!nhp_count) { - zlog_debug ("%s: empty nexthop list, skipping", __func__); + vnc_zlog_debug_verbose ("%s: empty nexthop list, skipping", __func__); return; } @@ -538,7 +539,7 @@ vnc_zebra_route_msg ( { char buf[INET_ADDRSTRLEN]; - zlog_debug ("%s: Zebra send: IPv4 route %s %s/%d, nhp_count=%d", + vnc_zlog_debug_verbose ("%s: Zebra send: IPv4 route %s %s/%d, nhp_count=%d", __func__, (add ? "add" : "del"), inet_ntop (AF_INET, &p->u.prefix4, buf, sizeof (buf)), @@ -572,7 +573,7 @@ vnc_zebra_route_msg ( { char buf[INET6_ADDRSTRLEN]; - zlog_debug ("%s: Zebra send: IPv6 route %s %s/%d nhp_count=%d", + vnc_zlog_debug_verbose ("%s: Zebra send: IPv6 route %s %s/%d nhp_count=%d", __func__, (add ? "add" : "del"), inet_ntop (AF_INET6, &p->u.prefix6, buf, sizeof (buf)), @@ -585,7 +586,7 @@ vnc_zebra_route_msg ( } else { - zlog_debug ("%s: unknown prefix address family, skipping", __func__); + vnc_zlog_debug_verbose ("%s: unknown prefix address family, skipping", __func__); return; } } @@ -607,7 +608,7 @@ nve_list_to_nh_array ( if (!nve_count) { - zlog_debug ("%s: empty nve_list, skipping", __func__); + vnc_zlog_debug_verbose ("%s: empty nve_list, skipping", __func__); return; } @@ -643,7 +644,7 @@ nve_list_to_nh_array ( *iap = nhp.u.prefix4; *v = iap; - zlog_debug ("%s: ipadr: (%p)<-0x%x, ptr: (%p)<-%p", + vnc_zlog_debug_verbose ("%s: ipadr: (%p)<-0x%x, ptr: (%p)<-%p", __func__, iap, nhp.u.prefix4.s_addr, v, iap); ++iap; @@ -729,7 +730,7 @@ vnc_zebra_add_del_prefix ( void *nh_ary = NULL; void *nhp_ary = NULL; - zlog_debug ("%s: entry, add=%d", __func__, add); + vnc_zlog_debug_verbose ("%s: entry, add=%d", __func__, add); if (zclient_vnc->sock < 0) return; @@ -746,12 +747,12 @@ vnc_zebra_add_del_prefix ( if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } if (!listcount (bgp->rfapi_cfg->rfg_export_zebra_l)) { - zlog_debug ("%s: no zebra export nve group, skipping", __func__); + vnc_zlog_debug_verbose ("%s: no zebra export nve group, skipping", __func__); return; } @@ -808,7 +809,7 @@ vnc_zebra_add_del_nve ( // struct prefix *nhpp; void *pAddr; - zlog_debug ("%s: entry, add=%d", __func__, add); + vnc_zlog_debug_verbose ("%s: entry, add=%d", __func__, add); if (zclient_vnc->sock < 0) return; @@ -826,13 +827,13 @@ vnc_zebra_add_del_nve ( return; if (!bgp->rfapi_cfg) { - zlog_debug ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); + vnc_zlog_debug_verbose ("%s: bgp->rfapi_cfg is NULL, skipping", __func__); return; } if (rfapiRaddr2Qprefix (&rfd->vn_addr, &nhp)) { - zlog_debug ("%s: can't convert vn address, skipping", __func__); + vnc_zlog_debug_verbose ("%s: can't convert vn address, skipping", __func__); return; } @@ -857,7 +858,7 @@ vnc_zebra_add_del_nve ( struct rfapi_import_table *import_table; import_table = rfg->rfapi_import_table; - zlog_debug ("%s: this nve's group is in zebra export list", + vnc_zlog_debug_verbose ("%s: this nve's group is in zebra export list", __func__); rt = import_table->imported_vpn[afi]; @@ -871,7 +872,7 @@ vnc_zebra_add_del_nve ( if (rn->info) { - zlog_debug ("%s: sending %s", __func__, + vnc_zlog_debug_verbose ("%s: sending %s", __func__, (add ? "add" : "del")); vnc_zebra_route_msg (&rn->p, 1, &pAddr, add); } @@ -909,11 +910,11 @@ vnc_zebra_add_del_group_afi ( void *nh_ary = NULL; void *nhp_ary = NULL; - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); import_table = rfg->rfapi_import_table; if (!import_table) { - zlog_debug ("%s: import table not defined, returning", __func__); + vnc_zlog_debug_verbose ("%s: import table not defined, returning", __func__); return; } @@ -937,17 +938,17 @@ vnc_zebra_add_del_group_afi ( if (!rfg->nves) { /* avoid segfault below if list doesn't exist */ - zlog_debug ("%s: no NVEs in this group", __func__); + vnc_zlog_debug_verbose ("%s: no NVEs in this group", __func__); return; } nve_group_to_nve_list (rfg, &nves, family); if (nves) { - zlog_debug ("%s: have nves", __func__); + vnc_zlog_debug_verbose ("%s: have nves", __func__); nve_list_to_nh_array (family, nves, &nexthop_count, &nh_ary, &nhp_ary); - zlog_debug ("%s: family: %d, nve count: %d", __func__, family, + vnc_zlog_debug_verbose ("%s: family: %d, nve count: %d", __func__, family, nexthop_count); list_delete (nves); @@ -982,7 +983,7 @@ vnc_zebra_add_group (struct bgp *bgp, struct rfapi_nve_group_cfg *rfg) void vnc_zebra_del_group (struct bgp *bgp, struct rfapi_nve_group_cfg *rfg) { - zlog_debug ("%s: entry", __func__); + vnc_zlog_debug_verbose ("%s: entry", __func__); vnc_zebra_add_del_group_afi (bgp, rfg, AFI_IP, 0); vnc_zebra_add_del_group_afi (bgp, rfg, AFI_IP6, 0); } @@ -1041,7 +1042,7 @@ vnc_redistribute_set (struct bgp *bgp, afi_t afi, int type) return CMD_WARNING; if (BGP_DEBUG (zebra, ZEBRA)) - zlog_debug ("Zebra send: redistribute add %s", zebra_route_string (type)); + vnc_zlog_debug_verbose ("Zebra send: redistribute add %s", zebra_route_string (type)); /* Send distribute add message to zebra. */ zebra_redistribute_send (ZEBRA_REDISTRIBUTE_ADD, zclient_vnc, afi, type, 0, VRF_DEFAULT); @@ -1053,11 +1054,11 @@ vnc_redistribute_set (struct bgp *bgp, afi_t afi, int type) int vnc_redistribute_unset (struct bgp *bgp, afi_t afi, int type) { - zlog_debug ("%s: type=%d entry", __func__, type); + vnc_zlog_debug_verbose ("%s: type=%d entry", __func__, type); if (!bgp->rfapi_cfg) { - zlog_debug ("%s: return (no rfapi_cfg)", __func__); + vnc_zlog_debug_verbose ("%s: return (no rfapi_cfg)", __func__); return CMD_WARNING; } @@ -1074,7 +1075,7 @@ vnc_redistribute_unset (struct bgp *bgp, afi_t afi, int type) { /* Send distribute delete message to zebra. */ if (BGP_DEBUG (zebra, ZEBRA)) - zlog_debug ("Zebra send: redistribute delete %s", + vnc_zlog_debug_verbose ("Zebra send: redistribute delete %s", zebra_route_string (type)); zebra_redistribute_send (ZEBRA_REDISTRIBUTE_DELETE, zclient_vnc, afi, type, 0, VRF_DEFAULT); @@ -1083,7 +1084,7 @@ vnc_redistribute_unset (struct bgp *bgp, afi_t afi, int type) /* Withdraw redistributed routes from current BGP's routing table. */ vnc_redistribute_withdraw (bgp, afi, type); - zlog_debug ("%s: return", __func__); + vnc_zlog_debug_verbose ("%s: return", __func__); return CMD_SUCCESS; } diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 8479d7f31a..dfa7561484 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -606,6 +606,18 @@ isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream) } } +void +isis_circuit_prepare (struct isis_circuit *circuit) +{ +#ifdef GNU_LINUX + THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit, + circuit->fd); +#else + THREAD_TIMER_MSEC_ON (master, circuit->t_read, isis_receive, circuit, + listcount (circuit->area->circuit_list) * 100); +#endif +} + int isis_circuit_up (struct isis_circuit *circuit) { @@ -715,13 +727,7 @@ isis_circuit_up (struct isis_circuit *circuit) isis_circuit_stream(circuit, &circuit->rcv_stream); isis_circuit_stream(circuit, &circuit->snd_stream); -#ifdef GNU_LINUX - THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit, - circuit->fd); -#else - THREAD_TIMER_MSEC_ON (master, circuit->t_read, isis_receive, circuit, - listcount (circuit->area->circuit_list) * 100); -#endif + isis_circuit_prepare (circuit); circuit->lsp_queue = list_new (); circuit->lsp_queue_last_cleared = time (NULL); diff --git a/isisd/isis_circuit.h b/isisd/isis_circuit.h index efe153f32e..035e558c0a 100644 --- a/isisd/isis_circuit.h +++ b/isisd/isis_circuit.h @@ -168,6 +168,7 @@ void isis_circuit_add_addr (struct isis_circuit *circuit, struct connected *conn); void isis_circuit_del_addr (struct isis_circuit *circuit, struct connected *conn); +void isis_circuit_prepare (struct isis_circuit *circuit); int isis_circuit_up (struct isis_circuit *circuit); void isis_circuit_down (struct isis_circuit *); void circuit_update_nlpids (struct isis_circuit *circuit); diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 6fec498a4d..96e459a797 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -2134,41 +2134,6 @@ isis_handle_pdu (struct isis_circuit *circuit, u_char * ssnpa) return retval; } -#ifdef GNU_LINUX -int -isis_receive (struct thread *thread) -{ - struct isis_circuit *circuit; - u_char ssnpa[ETH_ALEN]; - int retval; - - /* - * Get the circuit - */ - circuit = THREAD_ARG (thread); - assert (circuit); - - isis_circuit_stream(circuit, &circuit->rcv_stream); - - retval = circuit->rx (circuit, ssnpa); - circuit->t_read = NULL; - - if (retval == ISIS_OK) - retval = isis_handle_pdu (circuit, ssnpa); - - /* - * prepare for next packet. - */ - if (!circuit->is_passive) - { - THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit, - circuit->fd); - } - - return retval; -} - -#else int isis_receive (struct thread *thread) { @@ -2195,18 +2160,11 @@ isis_receive (struct thread *thread) * prepare for next packet. */ if (!circuit->is_passive) - { - circuit->t_read = thread_add_timer_msec (master, isis_receive, circuit, - listcount - (circuit->area->circuit_list) * - 100); - } + isis_circuit_prepare (circuit); return retval; } -#endif - /* filling of the fixed isis header */ void fill_fixed_hdr (struct isis_fixed_hdr *hdr, u_char pdu_type) diff --git a/isisd/isis_te.c b/isisd/isis_te.c index d3605f448c..109f5e4574 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -1061,9 +1061,6 @@ mpls_te_print_detail(struct vty *vty, struct te_is_neigh *te) void isis_mpls_te_config_write_router (struct vty *vty) { - - zlog_debug ("ISIS MPLS-TE: Write ISIS router configuration"); - if (IS_MPLS_TE(isisMplsTE)) { vty_out (vty, " mpls-te on%s", VTY_NEWLINE); diff --git a/lib/sockopt.c b/lib/sockopt.c index be3ac0e4bf..461e1f7f54 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -29,30 +29,30 @@ #include "sockopt.h" #include "sockunion.h" -int +void setsockopt_so_recvbuf (int sock, int size) { - int ret; - - if ( (ret = setsockopt (sock, SOL_SOCKET, SO_RCVBUF, (char *) - &size, sizeof (int))) < 0) - zlog_err ("fd %d: can't setsockopt SO_RCVBUF to %d: %s", - sock,size,safe_strerror(errno)); + int orig_req = size; - return ret; + while (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size)) == -1) + size /= 2; + + if (size != orig_req) + zlog_warn ("%s: fd %d: SO_RCVBUF set to %d (requested %d)", __func__, sock, + size, orig_req); } -int +void setsockopt_so_sendbuf (const int sock, int size) { - int ret = setsockopt (sock, SOL_SOCKET, SO_SNDBUF, - (char *)&size, sizeof (int)); - - if (ret < 0) - zlog_err ("fd %d: can't setsockopt SO_SNDBUF to %d: %s", - sock, size, safe_strerror (errno)); + int orig_req = size; - return ret; + while (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &size, sizeof (size)) == -1) + size /= 2; + + if (size != orig_req) + zlog_warn ("%s: fd %d: SO_SNDBUF set to %d (requested %d)", __func__, sock, + size, orig_req); } int diff --git a/lib/sockopt.h b/lib/sockopt.h index 02f0189345..b3ab57ab71 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -24,8 +24,8 @@ #include "sockunion.h" -extern int setsockopt_so_recvbuf (int sock, int size); -extern int setsockopt_so_sendbuf (const int sock, int size); +extern void setsockopt_so_recvbuf (int sock, int size); +extern void setsockopt_so_sendbuf (const int sock, int size); extern int getsockopt_so_sendbuf (const int sock); #ifdef HAVE_IPV6 diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 0d730c5967..0217d66038 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -118,8 +118,6 @@ ospf6_sso (ifindex_t ifindex, struct in6_addr *group, int option) struct ipv6_mreq mreq6; int ret; int bufsize = (8 * 1024 * 1024); - int optval; - socklen_t optlen = sizeof(optval); assert (ifindex); mreq6.ipv6mr_interface = ifindex; @@ -134,40 +132,8 @@ ospf6_sso (ifindex_t ifindex, struct in6_addr *group, int option) return ret; } - if ((ret = setsockopt (ospf6_sock, SOL_SOCKET, SO_SNDBUF, - &bufsize, sizeof (bufsize))) < 0) - { - zlog_err ("Couldn't increase raw wbuf size: %s\n", safe_strerror(errno)); - return ret; - } - - if ((ret = getsockopt (ospf6_sock, SOL_SOCKET, SO_SNDBUF, - &optval, &optlen)) < 0) - { - zlog_err ("getsockopt of SO_SNDBUF failed with error %s\n", safe_strerror(errno)); - return ret; - } - else if (optval < bufsize) - { - zlog_err ("Unable to SO_SNDBUF to %d, set to %d\n", bufsize, optval); - } - - if ((ret = setsockopt (ospf6_sock, SOL_SOCKET, SO_RCVBUF, - &bufsize, sizeof (bufsize))) < 0) - { - zlog_err ("Couldn't increase raw rbuf size: %s\n", safe_strerror(errno)); - } - - if ((ret = getsockopt (ospf6_sock, SOL_SOCKET, SO_RCVBUF, - &optval, &optlen)) < 0) - { - zlog_err ("getsockopt of SO_RCVBUF failed with error %s\n", safe_strerror(errno)); - return ret; - } - else if (optval < bufsize) - { - zlog_err ("Unable to SO_RCVBUF to %d, set to %d\n", bufsize, optval); - } + setsockopt_so_sendbuf (ospf6_sock, bufsize); + setsockopt_so_recvbuf (ospf6_sock, bufsize); return 0; } diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index 2c8124b93d..8440765579 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -797,11 +797,6 @@ ospf_if_up (struct ospf_interface *oi) OSPF_ISM_EVENT_SCHEDULE (oi, ISM_LoopInd); else { - struct ospf *ospf = ospf_lookup (); - if (ospf != NULL) - ospf_adjust_sndbuflen (ospf, oi->ifp->mtu); - else - zlog_warn ("%s: ospf_lookup() returned NULL", __func__); ospf_if_stream_set (oi); OSPF_ISM_EVENT_SCHEDULE (oi, ISM_InterfaceUp); } diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index 088123ea24..d7ec256214 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -41,7 +41,6 @@ extern struct zebra_privs_t ospfd_privs; #include "ospfd/ospf_lsdb.h" #include "ospfd/ospf_neighbor.h" #include "ospfd/ospf_packet.h" -#include "ospfd/ospf_dump.h" @@ -162,8 +161,6 @@ ospf_sock_init (void) int ospf_sock; int ret, hincl = 1; int bufsize = (8 * 1024 * 1024); - int optval; - socklen_t optlen = sizeof(optval); if ( ospfd_privs.change (ZPRIVS_RAISE) ) zlog_err ("ospf_sock_init: could not raise privs, %s", @@ -223,72 +220,8 @@ ospf_sock_init (void) safe_strerror (errno) ); } - if ((ret = setsockopt (ospf_sock, SOL_SOCKET, SO_RCVBUF, - &bufsize, sizeof (bufsize))) < 0) - { - zlog_err ("Couldn't increase raw rbuf size: %s\n", safe_strerror(errno)); - } + setsockopt_so_sendbuf (ospf_sock, bufsize); + setsockopt_so_recvbuf (ospf_sock, bufsize); - if ((ret = getsockopt (ospf_sock, SOL_SOCKET, SO_RCVBUF, - &optval, &optlen)) < 0) - { - zlog_err("getsockopt of SO_RCVBUF failed with error %s\n", safe_strerror(errno)); - } - if (optval < bufsize) - { - zlog_err("Unable to SO_RCVBUF to %d, set to %d\n", bufsize, optval); - } - - - if ((ret = setsockopt (ospf_sock, SOL_SOCKET, SO_SNDBUF, - &bufsize, sizeof (bufsize))) < 0) - { - zlog_err ("Couldn't increase raw wbuf size: %s\n", safe_strerror(errno)); - } - - if ((ret = getsockopt (ospf_sock, SOL_SOCKET, SO_SNDBUF, - &optval, &optlen)) < 0) - { - zlog_err ("getsockopt of SO_SNDBUF failed with error %s\n", safe_strerror(errno)); - } - if (optval < bufsize) - { - zlog_err ("Unable to SO_SNDBUF to %d, set to %d\n", bufsize, optval); - } - return ospf_sock; } - -void -ospf_adjust_sndbuflen (struct ospf * ospf, unsigned int buflen) -{ - int ret, newbuflen; - /* Check if any work has to be done at all. */ - if (ospf->maxsndbuflen >= buflen) - return; - if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) - zlog_debug ("%s: adjusting OSPF send buffer size to %d", - __func__, buflen); - if (ospfd_privs.change (ZPRIVS_RAISE)) - zlog_err ("%s: could not raise privs, %s", __func__, - safe_strerror (errno)); - /* Now we try to set SO_SNDBUF to what our caller has requested - * (the MTU of a newly added interface). However, if the OS has - * truncated the actual buffer size to somewhat less size, try - * to detect it and update our records appropriately. The OS - * may allocate more buffer space, than requested, this isn't - * a error. - */ - ret = setsockopt_so_sendbuf (ospf->fd, buflen); - newbuflen = getsockopt_so_sendbuf (ospf->fd); - if (ret < 0 || newbuflen < 0 || newbuflen < (int) buflen) - zlog_warn ("%s: tried to set SO_SNDBUF to %u, but got %d", - __func__, buflen, newbuflen); - if (newbuflen >= 0) - ospf->maxsndbuflen = (unsigned int)newbuflen; - else - zlog_warn ("%s: failed to get SO_SNDBUF", __func__); - if (ospfd_privs.change (ZPRIVS_LOWER)) - zlog_err ("%s: could not lower privs, %s", __func__, - safe_strerror (errno)); -} diff --git a/ospfd/ospf_network.h b/ospfd/ospf_network.h index 8257adb4af..bc01a84325 100644 --- a/ospfd/ospf_network.h +++ b/ospfd/ospf_network.h @@ -34,6 +34,5 @@ extern int ospf_if_drop_alldrouters (struct ospf *, struct prefix *, ifindex_t); extern int ospf_if_ipmulticast (struct ospf *, struct prefix *, ifindex_t); extern int ospf_sock_init (void); -extern void ospf_adjust_sndbuflen (struct ospf *, unsigned int); #endif /* _ZEBRA_OSPF_NETWORK_H */ diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 72ce5586f6..f7d1d0fa7d 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -691,13 +691,9 @@ ospf_write (struct thread *thread) last_serviced_oi = oi; } pkt_count++; - /* convenience - max OSPF data per packet, - * and reliability - not more data, than our - * socket can accept - */ #ifdef WANT_OSPF_WRITE_FRAGMENT - maxdatasize = MIN (oi->ifp->mtu, ospf->maxsndbuflen) - - sizeof (struct ip); + /* convenience - max OSPF data per packet */ + maxdatasize = oi->ifp->mtu - sizeof (struct ip); #endif /* WANT_OSPF_WRITE_FRAGMENT */ /* Get one packet from queue. */ op = ospf_fifo_head (oi->obuf); diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 7156c1edac..1a7691c529 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -280,10 +280,6 @@ ospf_new (u_short instance) "a socket"); exit(1); } - new->maxsndbuflen = getsockopt_so_sendbuf (new->fd); - if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) - zlog_debug ("%s: starting with OSPF send buffer size %u", - __func__, new->maxsndbuflen); if ((new->ibuf = stream_new(OSPF_MAX_PACKET_SIZE+1)) == NULL) { zlog_err("ospf_new: fatal error: stream_new(%u) failed allocating ibuf", diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index 93b5ab766a..41a7a30d85 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -252,7 +252,6 @@ struct ospf int write_oi_count; /* Num of packets sent per thread invocation */ struct thread *t_read; int fd; - unsigned int maxsndbuflen; struct stream *ibuf; struct list *oi_write_q; diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index afac71814f..c8c18928c9 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -111,9 +111,7 @@ ripng_make_socket (void) return sock; } - ret = setsockopt_so_recvbuf (sock, 8096); - if (ret < 0) - return ret; + setsockopt_so_recvbuf (sock, 8096); ret = setsockopt_ipv6_pktinfo (sock, 1); if (ret < 0) return ret;