]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: add [no] debug bgp pbr vty command
authorPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 9 Mar 2018 09:02:25 +0000 (10:02 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 3 May 2018 13:15:07 +0000 (15:15 +0200)
This command is used to troubleshoot the routes that are installed inbgp
pbr fib, before being injected in zebra.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_debug.c
bgpd/bgp_debug.h

index 29ac5f520de9ac7a979426db4a7b40db9659be3e..3e3fbcbfe8088e47e1d566c2efbde2838587f6df 100644 (file)
@@ -59,6 +59,7 @@ unsigned long conf_bgp_debug_update_groups;
 unsigned long conf_bgp_debug_vpn;
 unsigned long conf_bgp_debug_flowspec;
 unsigned long conf_bgp_debug_labelpool;
+unsigned long conf_bgp_debug_pbr;
 
 unsigned long term_bgp_debug_as4;
 unsigned long term_bgp_debug_neighbor_events;
@@ -75,6 +76,7 @@ unsigned long term_bgp_debug_update_groups;
 unsigned long term_bgp_debug_vpn;
 unsigned long term_bgp_debug_flowspec;
 unsigned long term_bgp_debug_labelpool;
+unsigned long term_bgp_debug_pbr;
 
 struct list *bgp_debug_neighbor_events_peers = NULL;
 struct list *bgp_debug_keepalive_peers = NULL;
@@ -1653,7 +1655,40 @@ DEFUN (no_debug_bgp_vpn,
 
        if (vty->node != CONFIG_NODE)
                vty_out(vty, "disabled debug bgp vpn %s\n", argv[idx]->text);
+       return CMD_SUCCESS;
+}
 
+/* debug bgp pbr */
+DEFUN (debug_bgp_pbr,
+       debug_bgp_pbr_cmd,
+       "debug bgp pbr",
+       DEBUG_STR
+       BGP_STR
+       "BGP policy based routing\n")
+{
+       if (vty->node == CONFIG_NODE)
+               DEBUG_ON(pbr, PBR);
+       else {
+               TERM_DEBUG_ON(pbr, PBR);
+               vty_out(vty, "BGP policy based routing is on\n");
+       }
+       return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_bgp_pbr,
+       no_debug_bgp_pbr_cmd,
+       "no debug bgp pbr",
+       NO_STR
+       DEBUG_STR
+       BGP_STR
+       "BGP policy based routing\n")
+{
+       if (vty->node == CONFIG_NODE)
+               DEBUG_OFF(pbr, PBR);
+       else {
+               TERM_DEBUG_OFF(pbr, PBR);
+               vty_out(vty, "BGP policy based routing is off\n");
+       }
        return CMD_SUCCESS;
 }
 
@@ -1733,6 +1768,7 @@ DEFUN (no_debug_bgp,
        TERM_DEBUG_OFF(vpn, VPN_LEAK_LABEL);
        TERM_DEBUG_OFF(flowspec, FLOWSPEC);
        TERM_DEBUG_OFF(labelpool, LABELPOOL);
+       TERM_DEBUG_OFF(pbr, PBR);
        vty_out(vty, "All possible debugging has been turned off\n");
 
        return CMD_SUCCESS;
@@ -1808,6 +1844,9 @@ DEFUN_NOSH (show_debugging_bgp,
        if (BGP_DEBUG(labelpool, LABELPOOL))
                vty_out(vty, "  BGP labelpool debugging is on\n");
 
+       if (BGP_DEBUG(pbr, PBR))
+               vty_out(vty, "  BGP policy based routing debugging is on\n");
+
        vty_out(vty, "\n");
        return CMD_SUCCESS;
 }
@@ -1865,6 +1904,9 @@ int bgp_debug_count(void)
        if (BGP_DEBUG(labelpool, LABELPOOL))
                ret++;
 
+       if (BGP_DEBUG(pbr, PBR))
+               ret++;
+
        return ret;
 }
 
@@ -1966,6 +2008,10 @@ static int bgp_config_write_debug(struct vty *vty)
                write++;
        }
 
+       if (CONF_BGP_DEBUG(pbr, PBR)) {
+               vty_out(vty, "debug bgp pbr\n");
+               write++;
+       }
        return write;
 }
 
@@ -2069,6 +2115,13 @@ void bgp_debug_init(void)
        install_element(CONFIG_NODE, &debug_bgp_labelpool_cmd);
        install_element(ENABLE_NODE, &no_debug_bgp_labelpool_cmd);
        install_element(CONFIG_NODE, &no_debug_bgp_labelpool_cmd);
+
+       /* debug bgp pbr */
+       install_element(ENABLE_NODE, &debug_bgp_pbr_cmd);
+       install_element(CONFIG_NODE, &debug_bgp_pbr_cmd);
+       install_element(ENABLE_NODE, &no_debug_bgp_pbr_cmd);
+       install_element(CONFIG_NODE, &no_debug_bgp_pbr_cmd);
+
 }
 
 /* Return true if this prefix is on the per_prefix_list of prefixes to debug
index ad476ee918a54ec738c818667e45a26d57511a8e..02712f2a301bfff4b930fe4ebd1550620c3ce581 100644 (file)
@@ -75,6 +75,7 @@ extern unsigned long conf_bgp_debug_update_groups;
 extern unsigned long conf_bgp_debug_vpn;
 extern unsigned long conf_bgp_debug_flowspec;
 extern unsigned long conf_bgp_debug_labelpool;
+extern unsigned long conf_bgp_debug_pbr;
 
 extern unsigned long term_bgp_debug_as4;
 extern unsigned long term_bgp_debug_neighbor_events;
@@ -89,6 +90,7 @@ extern unsigned long term_bgp_debug_update_groups;
 extern unsigned long term_bgp_debug_vpn;
 extern unsigned long term_bgp_debug_flowspec;
 extern unsigned long term_bgp_debug_labelpool;
+extern unsigned long term_bgp_debug_pbr;
 
 extern struct list *bgp_debug_neighbor_events_peers;
 extern struct list *bgp_debug_keepalive_peers;
@@ -123,6 +125,7 @@ struct bgp_debug_filter {
 #define BGP_DEBUG_VPN_LEAK_LABEL      0x08
 #define BGP_DEBUG_FLOWSPEC            0x01
 #define BGP_DEBUG_LABELPOOL           0x01
+#define BGP_DEBUG_PBR                 0x01
 
 #define BGP_DEBUG_PACKET_SEND         0x01
 #define BGP_DEBUG_PACKET_SEND_DETAIL  0x02