summaryrefslogtreecommitdiffstats
path: root/ldpd
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-09-12 14:52:20 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-09-12 16:10:15 +0200
commit08e4b244515682d2adb779a429615034f4956262 (patch)
tree30b9a7625c3b4b284f4bbb4777bf1b2b3b19d4e8 /ldpd
parentldpd: fix broken label allocation (diff)
downloadfrr-08e4b244515682d2adb779a429615034f4956262.tar.xz
frr-08e4b244515682d2adb779a429615034f4956262.zip
ldpd: guard the label allocation debug messages
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd')
-rw-r--r--ldpd/lde.c5
-rw-r--r--ldpd/ldp_debug.c12
-rw-r--r--ldpd/ldp_debug.h9
-rw-r--r--ldpd/ldp_vty_cmds.c3
-rw-r--r--ldpd/ldpd.c2
5 files changed, 26 insertions, 5 deletions
diff --git a/ldpd/lde.c b/ldpd/lde.c
index 3f84454b3..3482f3d72 100644
--- a/ldpd/lde.c
+++ b/ldpd/lde.c
@@ -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) {
diff --git a/ldpd/ldp_debug.c b/ldpd/ldp_debug.c
index d80ec8dfb..ee4f0843b 100644
--- a/ldpd/ldp_debug.c
+++ b/ldpd/ldp_debug.c
@@ -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;
diff --git a/ldpd/ldp_debug.h b/ldpd/ldp_debug.h
index 4b9165685..a0972cea8 100644
--- a/ldpd/ldp_debug.h
+++ b/ldpd/ldp_debug.h
@@ -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)) \
diff --git a/ldpd/ldp_vty_cmds.c b/ldpd/ldp_vty_cmds.c
index be473063c..cd92958d4 100644
--- a/ldpd/ldp_vty_cmds.c
+++ b/ldpd/ldp_vty_cmds.c
@@ -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));
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index 0a586ec1c..d31c57592 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -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)