Skip to content

Commit

Permalink
bgpd: Enable combined logging for UPDATEs
Browse files Browse the repository at this point in the history
Before this patch if we enable two commands:
* `debug bgp updates in 10.0.0.1`
* `debug bgp updates prefix 192.168.0.0/24`

We never check both conditions if a prefix and neighbor match. If we see that
we enabled logging for a specific neighbor, then we log all the messages related
to that neighbor and ignore what prefix we expect.

With this patch, we have a combined check and look at prefix + neighbor.

Signed-off-by: Donatas Abraitis <[email protected]>
  • Loading branch information
ton31337 committed Nov 14, 2023
1 parent aa521c6 commit 715f4ea
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2573,25 +2573,33 @@ bool bgp_debug_update(const struct peer *peer, const struct prefix *p,
if (inbound) {
if (bgp_debug_per_peer(host, term_bgp_debug_update,
BGP_DEBUG_UPDATE_IN,
bgp_debug_update_in_peers))
bgp_debug_update_in_peers)) {
if (BGP_DEBUG(update, UPDATE_PREFIX))
return bgp_debug_per_prefix(p,
term_bgp_debug_update,
BGP_DEBUG_UPDATE_PREFIX,
bgp_debug_update_prefixes);
return true;
}

/* outbound */
else {
}
} else {
if (bgp_debug_per_peer(host, term_bgp_debug_update,
BGP_DEBUG_UPDATE_OUT,
bgp_debug_update_out_peers))
bgp_debug_update_out_peers)) {
if (BGP_DEBUG(update, UPDATE_PREFIX))
return bgp_debug_per_prefix(p,
term_bgp_debug_update,
BGP_DEBUG_UPDATE_PREFIX,
bgp_debug_update_prefixes);
return true;
}

/* Check if update debugging implicitly enabled for the group.
*/
if (updgrp && UPDGRP_DBG_ON(updgrp))
return true;
}


if (BGP_DEBUG(update, UPDATE_PREFIX)) {
if (!peer && BGP_DEBUG(update, UPDATE_PREFIX)) {

This comment has been minimized.

Copy link
@jyuan-panw

jyuan-panw Nov 17, 2023

why do we need to check "!peer" here? could we enable debug bgp update prefix for a neighbor?

if (bgp_debug_per_prefix(p, term_bgp_debug_update,
BGP_DEBUG_UPDATE_PREFIX,
bgp_debug_update_prefixes))
Expand Down

0 comments on commit 715f4ea

Please sign in to comment.