summaryrefslogtreecommitdiff
path: root/bgpd/bgp_debug.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-01-07 15:43:30 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-01-07 16:17:11 +0200
commit7a474b87548189e82c40e95010319603771b5e29 (patch)
treef11b967912167ecc0356fc101d7d6875ca872db5 /bgpd/bgp_debug.c
parentd2fe1936d9815a979f1e99afeb32fc5c0f0e0806 (diff)
bgpd: Add `debug bgp updates detail` command
When filtering with `debug bgp updates in x.x.x.x prefix-list plist`, we want to filter out unnecessary messages like: ``` 127.0.0.1(Unknown) rcvd UPDATE wlen 0 attrlen 20 alen 5 ``` Such a line as above will be repeated for all the paths received and it's useless without knowing the prefix (because NLRIs are not parsed yet). But want to see only relevant ones: ``` 127.0.0.1(Unknown) rcvd UPDATE w/ attr: nexthop 127.0.0.1, origin i, path 65002 127.0.0.1(Unknown) rcvd 10.255.255.1/32 IPv4 unicast ``` With `debug bgp updates detail` we can combine this to something like: ``` 127.0.0.1(Unknown) rcvd UPDATE w/ attr: nexthop 127.0.0.1, origin i, path 65002 127.0.0.1(Unknown) rcvd UPDATE wlen 0 attrlen 20 alen 5 127.0.0.1(Unknown) rcvd 10.255.255.1/32 IPv4 unicast ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_debug.c')
-rw-r--r--bgpd/bgp_debug.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index 138ffedb29..20608b295c 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -1148,6 +1148,31 @@ DEFUN (debug_bgp_update,
return CMD_SUCCESS;
}
+DEFPY (debug_bgp_update_detail,
+ debug_bgp_update_detail_cmd,
+ "[no] debug bgp updates detail",
+ NO_STR
+ DEBUG_STR
+ BGP_STR
+ "BGP updates\n"
+ "Show detailed information about updates\n")
+{
+ if (vty->node == CONFIG_NODE) {
+ if (no)
+ DEBUG_OFF(update, UPDATE_DETAIL);
+ else
+ DEBUG_ON(update, UPDATE_DETAIL);
+ } else {
+ if (no)
+ TERM_DEBUG_OFF(update, UPDATE_DETAIL);
+ else
+ TERM_DEBUG_ON(update, UPDATE_DETAIL);
+ vty_out(vty, "BGP updates detail debugging is on\n");
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN (debug_bgp_update_direct,
debug_bgp_update_direct_cmd,
"debug bgp updates <in|out>",
@@ -2304,6 +2329,11 @@ static int bgp_config_write_debug(struct vty *vty)
bgp_debug_update_out_peers);
}
+ if (CONF_BGP_DEBUG(update, UPDATE_DETAIL)) {
+ vty_out(vty, "debug bgp updates detail\n");
+ write++;
+ }
+
if (CONF_BGP_DEBUG(zebra, ZEBRA)) {
if (!bgp_debug_zebra_prefixes
|| list_isempty(bgp_debug_zebra_prefixes)) {
@@ -2409,6 +2439,8 @@ void bgp_debug_init(void)
install_element(CONFIG_NODE, &debug_bgp_keepalive_cmd);
install_element(ENABLE_NODE, &debug_bgp_update_cmd);
install_element(CONFIG_NODE, &debug_bgp_update_cmd);
+ install_element(ENABLE_NODE, &debug_bgp_update_detail_cmd);
+ install_element(CONFIG_NODE, &debug_bgp_update_detail_cmd);
install_element(ENABLE_NODE, &debug_bgp_zebra_cmd);
install_element(CONFIG_NODE, &debug_bgp_zebra_cmd);
install_element(ENABLE_NODE, &debug_bgp_update_groups_cmd);