]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: enhance debug bgp pbr error vty command
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 23 May 2018 12:10:38 +0000 (14:10 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 25 May 2018 13:49:38 +0000 (15:49 +0200)
Added following vty command:
[no] debug bgp pbr error

This permits dumping on the logs some errors related to PBR.

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

index 3e3fbcbfe8088e47e1d566c2efbde2838587f6df..a4ded57c25630d2008103bbcbb5a3e5a2bd62e43 100644 (file)
@@ -1661,11 +1661,23 @@ DEFUN (no_debug_bgp_vpn,
 /* debug bgp pbr */
 DEFUN (debug_bgp_pbr,
        debug_bgp_pbr_cmd,
-       "debug bgp pbr",
+       "debug bgp pbr [error]",
        DEBUG_STR
        BGP_STR
-       "BGP policy based routing\n")
+       "BGP policy based routing\n"
+       "BGP PBR error\n")
 {
+       int idx = 3;
+
+       if (argv_find(argv, argc, "error", &idx)) {
+               if (vty->node == CONFIG_NODE)
+                       DEBUG_ON(pbr, PBR_ERROR);
+               else {
+                       TERM_DEBUG_ON(pbr, PBR_ERROR);
+                       vty_out(vty, "BGP policy based routing error is on\n");
+               }
+               return CMD_SUCCESS;
+       }
        if (vty->node == CONFIG_NODE)
                DEBUG_ON(pbr, PBR);
        else {
@@ -1677,12 +1689,24 @@ DEFUN (debug_bgp_pbr,
 
 DEFUN (no_debug_bgp_pbr,
        no_debug_bgp_pbr_cmd,
-       "no debug bgp pbr",
+       "no debug bgp pbr [error]",
        NO_STR
        DEBUG_STR
        BGP_STR
-       "BGP policy based routing\n")
+       "BGP policy based routing\n"
+       "BGP PBR Error\n")
 {
+       int idx = 3;
+
+       if (argv_find(argv, argc, "error", &idx)) {
+               if (vty->node == CONFIG_NODE)
+                       DEBUG_OFF(pbr, PBR_ERROR);
+               else {
+                       TERM_DEBUG_OFF(pbr, PBR_ERROR);
+                       vty_out(vty, "BGP policy based routing error is off\n");
+               }
+               return CMD_SUCCESS;
+       }
        if (vty->node == CONFIG_NODE)
                DEBUG_OFF(pbr, PBR);
        else {
@@ -1769,6 +1793,7 @@ DEFUN (no_debug_bgp,
        TERM_DEBUG_OFF(flowspec, FLOWSPEC);
        TERM_DEBUG_OFF(labelpool, LABELPOOL);
        TERM_DEBUG_OFF(pbr, PBR);
+       TERM_DEBUG_OFF(pbr, PBR_ERROR);
        vty_out(vty, "All possible debugging has been turned off\n");
 
        return CMD_SUCCESS;
@@ -1846,6 +1871,8 @@ DEFUN_NOSH (show_debugging_bgp,
 
        if (BGP_DEBUG(pbr, PBR))
                vty_out(vty, "  BGP policy based routing debugging is on\n");
+       if (BGP_DEBUG(pbr, PBR_ERROR))
+               vty_out(vty, "  BGP policy based routing error debugging is on\n");
 
        vty_out(vty, "\n");
        return CMD_SUCCESS;
@@ -1906,6 +1933,8 @@ int bgp_debug_count(void)
 
        if (BGP_DEBUG(pbr, PBR))
                ret++;
+       if (BGP_DEBUG(pbr, PBR_ERROR))
+               ret++;
 
        return ret;
 }
@@ -2012,6 +2041,10 @@ static int bgp_config_write_debug(struct vty *vty)
                vty_out(vty, "debug bgp pbr\n");
                write++;
        }
+       if (CONF_BGP_DEBUG(pbr, PBR_ERROR)) {
+               vty_out(vty, "debug bgp pbr error\n");
+               write++;
+       }
        return write;
 }