]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: fix instance ldp-sync configuration
authorIgor Ryzhov <iryzhov@nfware.com>
Tue, 22 Jun 2021 21:23:18 +0000 (00:23 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Wed, 23 Jun 2021 12:52:37 +0000 (15:52 +0300)
Don't rely on operational data to validate that configuration is applied
to the default VRF. The VRF name is stored in the config - use it instead.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
isisd/isis_nb_config.c

index 515ceadea4a5fdbd9bd386e59d7e3499db3cccd6..a0da19fce86bf4cb0c3fa20ea448aedd8879c2a8 100644 (file)
@@ -2383,14 +2383,14 @@ int isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify(
 int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args *args)
 {
        struct isis_area *area;
+       const char *vrfname;
 
        switch (args->event) {
        case NB_EV_VALIDATE:
-               area = nb_running_get_entry(args->dnode, NULL, false);
-               if (area == NULL || area->isis == NULL)
-                       return NB_ERR_VALIDATION;
+               vrfname = yang_dnode_get_string(
+                       lyd_parent(lyd_parent(args->dnode)), "./vrf");
 
-               if (area->isis->vrf_id != VRF_DEFAULT) {
+               if (strcmp(vrfname, VRF_DEFAULT_NAME)) {
                        snprintf(args->errmsg, args->errmsg_len,
                                 "LDP-Sync only runs on Default VRF");
                        return NB_ERR_VALIDATION;
@@ -2427,14 +2427,15 @@ int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args *args)
 {
        struct isis_area *area;
        uint16_t holddown;
+       const char *vrfname;
 
        switch (args->event) {
        case NB_EV_VALIDATE:
-               area = nb_running_get_entry(args->dnode, NULL, false);
-               if (area == NULL || area->isis == NULL)
-                       return NB_ERR_VALIDATION;
+               vrfname = yang_dnode_get_string(
+                       lyd_parent(lyd_parent(lyd_parent(args->dnode))),
+                       "./vrf");
 
-               if (area->isis->vrf_id != VRF_DEFAULT) {
+               if (strcmp(vrfname, VRF_DEFAULT_NAME)) {
                        snprintf(args->errmsg, args->errmsg_len,
                                 "LDP-Sync only runs on Default VRF");
                        return NB_ERR_VALIDATION;