]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: fixes required after rebasing
authorChristian Hopps <chopps@labn.net>
Sat, 9 Dec 2023 04:49:10 +0000 (23:49 -0500)
committerChristian Hopps <chopps@labn.net>
Thu, 28 Dec 2023 18:17:24 +0000 (18:17 +0000)
lib: fix checkpatch warnings
lib: darr: disable check
mgmtd: fix initialization

Signed-off-by: Christian Hopps <chopps@labn.net>
lib/yang.c
mgmtd/mgmt_main.c
tests/lib/test_darr.c

index 33a6e1b6f7f3557c8fadc0a8abe0ada791e2d917..18d2ac58d3479927e38c2fbc4febd251a8f9f165 100644 (file)
@@ -722,6 +722,7 @@ struct ly_ctx *yang_ctx_new_setup(bool embedded_modules, bool explicit_compile)
 {
        struct ly_ctx *ctx = NULL;
        const char *yang_models_path = YANG_MODELS_PATH;
+       uint options;
        LY_ERR err;
 
        if (access(yang_models_path, R_OK | X_OK)) {
@@ -735,7 +736,7 @@ struct ly_ctx *yang_ctx_new_setup(bool embedded_modules, bool explicit_compile)
                                     YANG_MODELS_PATH);
        }
 
-       uint options = LY_CTX_NO_YANGLIBRARY | LY_CTX_DISABLE_SEARCHDIR_CWD;
+       options = LY_CTX_NO_YANGLIBRARY | LY_CTX_DISABLE_SEARCHDIR_CWD;
        if (explicit_compile)
                options |= LY_CTX_EXPLICIT_COMPILE;
        err = ly_ctx_new(yang_models_path, options, &ctx);
index 793161dc320402414ff80253d76066947c8587b0..f0fb7f8a7b85d59607d83d26af0737c5e46b4845 100644 (file)
@@ -189,12 +189,33 @@ static void mgmt_vrf_terminate(void)
 extern const struct frr_yang_module_info frr_staticd_info;
 #endif
 
+
+/*
+ * These are stub info structs that are used to load the modules used by backend
+ * clients into mgmtd. The modules are used by libyang in order to support
+ * parsing binary data returns from the backend.
+ */
+const struct frr_yang_module_info zebra_info = {
+       .name = "frr-zebra",
+       .ignore_cbs = true,
+       .nodes = { { .xpath = NULL } },
+};
+
+const struct frr_yang_module_info affinity_map_info = {
+       .name = "frr-affinity-map",
+       .ignore_cbs = true,
+       .nodes = { { .xpath = NULL } },
+};
+
+const struct frr_yang_module_info zebra_route_map_info = {
+       .name = "frr-zebra-route-map",
+       .ignore_cbs = true,
+       .nodes = { { .xpath = NULL } },
+};
+
 /*
  * List of YANG modules to be loaded in the process context of
  * MGMTd.
- *
- * NOTE: In future this will also include the YANG modules of
- * all individual Backend clients.
  */
 static const struct frr_yang_module_info *const mgmt_yang_modules[] = {
        &frr_filter_info,
@@ -202,21 +223,15 @@ static const struct frr_yang_module_info *const mgmt_yang_modules[] = {
        &frr_route_map_info,
        &frr_routing_info,
        &frr_vrf_info,
-/*
- * YANG module info supported by backend clients get added here.
- * NOTE: Always set .ignore_cbs true for to avoid validating
- * backend configuration northbound callbacks during loading.
- */
-       &(struct frr_yang_module_info){ .name = "frr-zebra",
-                                       .ignore_cbs = true },
+
        /*
-        * TO support LYD_LYB parsing we have to include all the modules that
-        * backend clients include.
+        * YANG module info used by backend clients get added here.
         */
-       &(struct frr_yang_module_info){ .name = "frr-affinity-map",
-               .ignore_cbs = true },
-       &(struct frr_yang_module_info){ .name = "frr-zebra-route-map",
-               .ignore_cbs = true },
+
+       &zebra_info,
+       &affinity_map_info,
+       &zebra_route_map_info,
+
 #ifdef HAVE_STATICD
        &frr_staticd_info,
 #endif
index 78e3a1417c7cbd165a9c2d8f2a4c6856eacb798b..74aedac4b7e783c178b47a5ddf0d4095fd208d08 100644 (file)
@@ -343,13 +343,10 @@ static void test_string(void)
        assert(darr_strlen(da1) == srclen);
        assert(darr_cap(da1) >= 128);
 
-       da2 = da1;
-       darr_in_strdup_cap(da1, src, 1024);
-       assert(da1 != da2);
+       darr_in_strdup_cap(da1, src, 256);
        assert(darr_strlen(da1) == srclen);
-       assert(darr_cap(da1) >= 1024);
+       assert(darr_cap(da1) >= 256);
        darr_free(da1);
-       da2 = NULL;
 
        da1 = darr_strdup_cap(add, 2);
        assert(darr_strlen(da1) == addlen);