]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/label_manager.c
Merge pull request #5778 from ton31337/fix/add_doc_for_ebgp_connected_route_check
[mirror_frr.git] / zebra / label_manager.c
index 03cfa572db91e2bbcf0aeed6d60ab93d579e6458..caebdc0f08644a83f212f57f9aa2c6b84d108533 100644 (file)
@@ -39,6 +39,7 @@
 #include "zebra/label_manager.h"
 #include "zebra/zebra_errors.h"
 #include "zebra/zapi_msg.h"
+#include "zebra/debug.h"
 
 #define CONNECTION_DELAY 5
 
@@ -116,8 +117,9 @@ int release_daemon_label_chunks(uint8_t proto, unsigned short instance)
        int count = 0;
        int ret;
 
-       zlog_debug("%s: Releasing chunks for client proto %s, instance %d",
-                  __func__, zebra_route_string(proto), instance);
+       if (IS_ZEBRA_DEBUG_PACKET)
+               zlog_debug("%s: Releasing chunks for client proto %s, instance %d",
+                          __func__, zebra_route_string(proto), instance);
 
        for (ALL_LIST_ELEMENTS_RO(lbl_mgr.lc_list, node, lmc)) {
                if (lmc->proto == proto && lmc->instance == instance
@@ -129,7 +131,8 @@ int release_daemon_label_chunks(uint8_t proto, unsigned short instance)
                }
        }
 
-       zlog_debug("%s: Released %d label chunks", __func__, count);
+       if (IS_ZEBRA_DEBUG_PACKET)
+               zlog_debug("%s: Released %d label chunks", __func__, count);
 
        return count;
 }
@@ -259,8 +262,12 @@ assign_specific_label_chunk(uint8_t proto, unsigned short instance,
                 * included in the previous one */
                for (node = first_node; node && (node != last_node);
                     node = next) {
+                       struct label_manager_chunk *death;
+
                        next = listnextnode(node);
+                       death = listgetdata(node);
                        list_delete_node(lbl_mgr.lc_list, node);
+                       delete_label_chunk(death);
                }
 
                lmc = create_label_chunk(proto, instance, keep, base, end);
@@ -371,7 +378,8 @@ int release_label_chunk(uint8_t proto, unsigned short instance, uint32_t start,
        int ret = -1;
 
        /* check that size matches */
-       zlog_debug("Releasing label chunk: %u - %u", start, end);
+       if (IS_ZEBRA_DEBUG_PACKET)
+               zlog_debug("Releasing label chunk: %u - %u", start, end);
        /* find chunk and disown */
        for (ALL_LIST_ELEMENTS_RO(lbl_mgr.lc_list, node, lmc)) {
                if (lmc->start != start)