]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/yang.c
Merge pull request #5625 from qlyoung/fix-zapi-ipset-name-nullterm
[mirror_frr.git] / lib / yang.c
index 2f9a9aa5a3d79f76c7f46a1070044a270aa30429..d153f755305a49a77f399bc7517b7f4130b7c394 100644 (file)
@@ -27,8 +27,8 @@
 
 #include <libyang/user_types.h>
 
-DEFINE_MTYPE(LIB, YANG_MODULE, "YANG module")
-DEFINE_MTYPE(LIB, YANG_DATA, "YANG data structure")
+DEFINE_MTYPE_STATIC(LIB, YANG_MODULE, "YANG module")
+DEFINE_MTYPE_STATIC(LIB, YANG_DATA, "YANG data structure")
 
 /* libyang container. */
 struct ly_ctx *ly_native_ctx;
@@ -595,7 +595,7 @@ struct yang_data *yang_data_list_find(const struct list *list,
 /* Make libyang log its errors using FRR logging infrastructure. */
 static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path)
 {
-       int priority;
+       int priority = LOG_ERR;
 
        switch (level) {
        case LY_LLERR:
@@ -605,10 +605,9 @@ static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path)
                priority = LOG_WARNING;
                break;
        case LY_LLVRB:
+       case LY_LLDBG:
                priority = LOG_DEBUG;
                break;
-       default:
-               return;
        }
 
        if (path)
@@ -617,6 +616,17 @@ static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path)
                zlog(priority, "libyang: %s", msg);
 }
 
+void yang_debugging_set(bool enable)
+{
+       if (enable) {
+               ly_verb(LY_LLDBG);
+               ly_verb_dbg(0xFF);
+       } else {
+               ly_verb(LY_LLERR);
+               ly_verb_dbg(0);
+       }
+}
+
 struct ly_ctx *yang_ctx_new_setup(void)
 {
        struct ly_ctx *ctx;