diff options
author | G. Paul Ziemba <paulz@labn.net> | 2018-04-07 20:13:07 +0200 |
---|---|---|
committer | G. Paul Ziemba <paulz@labn.net> | 2018-04-12 08:18:28 +0200 |
commit | 955bfd984ffdf25de5748c404ee9796de7fd30be (patch) | |
tree | 2cbf34a64c17bd530af22eb4f8162cd8bb67a66d /bgpd/bgp_debug.c | |
parent | Merge pull request #2027 from qlyoung/fix-vrf-static-holdem-display (diff) | |
download | frr-955bfd984ffdf25de5748c404ee9796de7fd30be.tar.xz frr-955bfd984ffdf25de5748c404ee9796de7fd30be.zip |
bgpd: dynamic mpls label pool
MPLS label pool backed by allocations from the zebra label manager.
A caller requests a label (e.g., in support of an "auto" label
specification in the CLI) via lp_get(), supplying a unique ID and
a callback function. The callback function is invoked at a later
time with the unique ID and a label value to inform the requestor
of the assigned label.
Requestors may release their labels back to the pool via lp_release().
The label pool is stocked with labels allocated by the zebra label
manager. The interaction with zebra is asynchronous so that bgpd
is not blocked while awaiting a label allocation from zebra.
The label pool implementation allows for bgpd operation before (or
without) zebra, and gracefully handles loss and reconnection of
zebra. Of course, before initial connection with zebra, no labels
are assigned to requestors. If the zebra connection is lost and
regained, callbacks to requestors will invalidate old assignments
and then assign new labels.
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
Diffstat (limited to 'bgpd/bgp_debug.c')
-rw-r--r-- | bgpd/bgp_debug.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index ae4ff5d67..29ac5f520 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -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 |