]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_debug.c
bgpd: dynamic mpls label pool
[mirror_frr.git] / bgpd / bgp_debug.c
index ae4ff5d67e3f0e55b33a71d0016045a1843c03c5..29ac5f520de9ac7a979426db4a7b40db9659be3e 100644 (file)
@@ -58,6 +58,7 @@ unsigned long conf_bgp_debug_nht;
 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 term_bgp_debug_as4;
 unsigned long term_bgp_debug_neighbor_events;
@@ -73,6 +74,7 @@ unsigned long term_bgp_debug_nht;
 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;
 
 struct list *bgp_debug_neighbor_events_peers = NULL;
 struct list *bgp_debug_keepalive_peers = NULL;
@@ -1655,6 +1657,44 @@ DEFUN (no_debug_bgp_vpn,
        return CMD_SUCCESS;
 }
 
+DEFUN (debug_bgp_labelpool,
+       debug_bgp_labelpool_cmd,
+       "debug bgp labelpool",
+       DEBUG_STR
+       BGP_STR
+       "label pool\n")
+{
+       if (vty->node == CONFIG_NODE)
+               DEBUG_ON(labelpool, LABELPOOL);
+       else
+               TERM_DEBUG_ON(labelpool, LABELPOOL);
+
+       if (vty->node != CONFIG_NODE)
+               vty_out(vty, "enabled debug bgp labelpool\n");
+
+       return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_bgp_labelpool,
+       no_debug_bgp_labelpool_cmd,
+       "no debug bgp labelpool",
+       NO_STR
+       DEBUG_STR
+       BGP_STR
+       "label pool\n")
+{
+       if (vty->node == CONFIG_NODE)
+               DEBUG_OFF(labelpool, LABELPOOL);
+       else
+               TERM_DEBUG_OFF(labelpool, LABELPOOL);
+
+
+       if (vty->node != CONFIG_NODE)
+               vty_out(vty, "disabled debug bgp labelpool\n");
+
+       return CMD_SUCCESS;
+}
+
 DEFUN (no_debug_bgp,
        no_debug_bgp_cmd,
        "no debug bgp",
@@ -1692,6 +1732,7 @@ DEFUN (no_debug_bgp,
        TERM_DEBUG_OFF(vpn, VPN_LEAK_RMAP_EVENT);
        TERM_DEBUG_OFF(vpn, VPN_LEAK_LABEL);
        TERM_DEBUG_OFF(flowspec, FLOWSPEC);
+       TERM_DEBUG_OFF(labelpool, LABELPOOL);
        vty_out(vty, "All possible debugging has been turned off\n");
 
        return CMD_SUCCESS;
@@ -1764,6 +1805,8 @@ DEFUN_NOSH (show_debugging_bgp,
                vty_out(vty, "  BGP vpn label event debugging is on\n");
        if (BGP_DEBUG(flowspec, FLOWSPEC))
                vty_out(vty, "  BGP flowspec debugging is on\n");
+       if (BGP_DEBUG(labelpool, LABELPOOL))
+               vty_out(vty, "  BGP labelpool debugging is on\n");
 
        vty_out(vty, "\n");
        return CMD_SUCCESS;
@@ -1819,6 +1862,8 @@ int bgp_debug_count(void)
                ret++;
        if (BGP_DEBUG(flowspec, FLOWSPEC))
                ret++;
+       if (BGP_DEBUG(labelpool, LABELPOOL))
+               ret++;
 
        return ret;
 }
@@ -1916,6 +1961,10 @@ static int bgp_config_write_debug(struct vty *vty)
                vty_out(vty, "debug bgp flowspec\n");
                write++;
        }
+       if (CONF_BGP_DEBUG(labelpool, LABELPOOL)) {
+               vty_out(vty, "debug bgp labelpool\n");
+               write++;
+       }
 
        return write;
 }
@@ -2015,6 +2064,11 @@ void bgp_debug_init(void)
        install_element(CONFIG_NODE, &debug_bgp_vpn_cmd);
        install_element(ENABLE_NODE, &no_debug_bgp_vpn_cmd);
        install_element(CONFIG_NODE, &no_debug_bgp_vpn_cmd);
+
+       install_element(ENABLE_NODE, &debug_bgp_labelpool_cmd);
+       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);
 }
 
 /* Return true if this prefix is on the per_prefix_list of prefixes to debug