]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #1158 from opensourcerouting/ldpd-label-allocation
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 13 Sep 2017 16:24:14 +0000 (12:24 -0400)
committerGitHub <noreply@github.com>
Wed, 13 Sep 2017 16:24:14 +0000 (12:24 -0400)
ldpd label allocation

ldpd/lde.c
ldpd/ldp_debug.c
ldpd/ldp_debug.h
ldpd/ldp_vty_cmds.c
ldpd/ldpd.c

index 4460b424d253a8a52dcffabab51598babd141501..3482f3d7226d95447ce80f95ffdac73f7f664952 100644 (file)
@@ -1609,7 +1609,6 @@ static void
 zclient_sync_init(u_short instance)
 {
        /* Initialize special zclient for synchronous message exchanges. */
-       log_debug("Initializing synchronous zclient for label manager");
        zclient_sync = zclient_new(master);
        zclient_sync->sock = -1;
        zclient_sync->redist_default = ZEBRA_ROUTE_LDP;
@@ -1640,7 +1639,7 @@ lde_get_label_chunk(void)
        int              ret;
        uint32_t         start, end;
 
-       log_debug("Getting label chunk");
+       debug_labels("getting label chunk (size %u)", CHUNK_SIZE);
        ret = lm_get_label_chunk(zclient_sync, 0, CHUNK_SIZE, &start, &end);
        if (ret < 0) {
                log_warnx("Error getting label chunk!");
@@ -1670,7 +1669,7 @@ on_get_label_chunk_response(uint32_t start, uint32_t end)
 {
        struct label_chunk *new_label_chunk;
 
-       log_debug("Label Chunk assign: %u - %u", start, end);
+       debug_labels("label chunk assign: %u - %u", start, end);
 
        new_label_chunk = calloc(1, sizeof(struct label_chunk));
        if (!new_label_chunk) {
@@ -1693,7 +1692,8 @@ static uint32_t
 lde_get_next_label(void)
 {
        struct label_chunk      *label_chunk;
-       uint32_t                 i, pos, size;
+       uint32_t                 i, size;
+       uint64_t                 pos;
        uint32_t                 label = NO_LABEL;
 
        while (current_label_chunk) {
index d80ec8dfbc69086cf83773f38ffe46398155f06a..ee4f0843b7d7079095720e4b8f870c3d08dc70ca 100644 (file)
@@ -66,6 +66,11 @@ ldp_vty_debug(struct vty *vty, const char *negate, const char *type_str,
                        DEBUG_OFF(event, EVENT);
                else
                        DEBUG_ON(event, EVENT);
+       } else if (strcmp(type_str, "labels") == 0) {
+               if (negate)
+                       DEBUG_OFF(labels, LABELS);
+               else
+                       DEBUG_ON(labels, LABELS);
        } else if (strcmp(type_str, "messages") == 0) {
                if (dir_str == NULL)
                        return (CMD_WARNING_CONFIG_FAILED);
@@ -115,6 +120,8 @@ ldp_vty_show_debugging(struct vty *vty)
                vty_out (vty, "  LDP errors debugging is on\n");
        if (LDP_DEBUG(event, EVENT))
                vty_out (vty, "  LDP events debugging is on\n");
+       if (LDP_DEBUG(labels, LABELS))
+               vty_out (vty, "  LDP labels debugging is on\n");
        if (LDP_DEBUG(msg, MSG_RECV_ALL))
                vty_out (vty,
                          "  LDP detailed messages debugging is on (inbound)\n");
@@ -157,6 +164,11 @@ ldp_debug_config_write(struct vty *vty)
                write = 1;
        }
 
+       if (CONF_LDP_DEBUG(labels, LABELS)) {
+               vty_out (vty, "debug mpls ldp labels\n");
+               write = 1;
+       }
+
        if (CONF_LDP_DEBUG(msg, MSG_RECV_ALL)) {
                vty_out (vty, "debug mpls ldp messages recv all\n");
                write = 1;
index 4b916568519c595ff63e2e129fc20f52dfd125d7..a0972cea8e663b04cdc93b087dc8e0f928f52420 100644 (file)
@@ -31,6 +31,9 @@ struct ldp_debug {
        int      event;
 #define LDP_DEBUG_EVENT                0x01
 
+       int      labels;
+#define LDP_DEBUG_LABELS       0x01
+
        int      msg;
 #define LDP_DEBUG_MSG_RECV     0x01
 #define LDP_DEBUG_MSG_RECV_ALL 0x02
@@ -90,6 +93,12 @@ do {                                                                 \
                log_debug("event: " emsg, __VA_ARGS__);                 \
 } while (0)
 
+#define                 debug_labels(emsg, ...)                                \
+do {                                                                   \
+       if (LDP_DEBUG(labels, LABELS))                                  \
+               log_debug("labels: " emsg, __VA_ARGS__);                \
+} while (0)
+
 #define                 debug_msg_recv(emsg, ...)                              \
 do {                                                                   \
        if (LDP_DEBUG(msg, MSG_RECV))                                   \
index be473063cdabc68d325c17fc3a6ead2122574db5..cd92958d4c8fa2bd38ebbee71b56b60d4db5caa8 100644 (file)
@@ -538,13 +538,14 @@ DEFPY  (ldp_debug_mpls_ldp_discovery_hello,
 
 DEFPY  (ldp_debug_mpls_ldp_type,
        ldp_debug_mpls_ldp_type_cmd,
-       "[no] debug mpls ldp <errors|event|zebra>$type",
+       "[no] debug mpls ldp <errors|event|labels|zebra>$type",
        NO_STR
        "Debugging functions\n"
        "MPLS information\n"
        "Label Distribution Protocol\n"
        "Errors\n"
        "LDP event information\n"
+       "LDP label allocation information\n"
        "LDP zebra information\n")
 {
        return (ldp_vty_debug(vty, no, type, NULL, NULL));
index 0a586ec1c5b123671954ca019712d50e859bb0b3..d31c575920031badfafe232a0439b06ae1174067 100644 (file)
@@ -370,9 +370,9 @@ main(int argc, char *argv[])
 
        if (main_imsg_send_ipc_sockets(&iev_ldpe->ibuf, &iev_lde->ibuf))
                fatal("could not establish imsg links");
-       main_imsg_compose_both(IMSG_INIT, &init, sizeof(init));
        main_imsg_compose_both(IMSG_DEBUG_UPDATE, &ldp_debug,
            sizeof(ldp_debug));
+       main_imsg_compose_both(IMSG_INIT, &init, sizeof(init));
        main_imsg_send_config(ldpd_conf);
 
        if (ldpd_conf->ipv4.flags & F_LDPD_AF_ENABLED)