summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/if.c b/lib/if.c
index 9efd298a4f..f03574e787 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -263,15 +263,21 @@ void if_update_to_new_vrf(struct interface *ifp, vrf_id_t vrf_id)
*/
if (yang_module_find("frr-interface")) {
struct lyd_node *if_dnode;
+ char oldpath[XPATH_MAXLEN];
+ char newpath[XPATH_MAXLEN];
if_dnode = yang_dnode_get(
running_config->dnode,
"/frr-interface:lib/interface[name='%s'][vrf='%s']/vrf",
ifp->name, old_vrf->name);
+
if (if_dnode) {
- nb_running_unset_entry(if_dnode->parent);
+ yang_dnode_get_path(if_dnode->parent, oldpath,
+ sizeof(oldpath));
yang_dnode_change_leaf(if_dnode, vrf->name);
- nb_running_set_entry(if_dnode->parent, ifp);
+ yang_dnode_get_path(if_dnode->parent, newpath,
+ sizeof(newpath));
+ nb_running_move_tree(oldpath, newpath);
running_config->version++;
}
}
@@ -1561,8 +1567,8 @@ static int lib_interface_destroy(struct nb_cb_destroy_args *args)
case NB_EV_VALIDATE:
ifp = nb_running_get_entry(args->dnode, NULL, true);
if (CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE)) {
- zlog_warn("%s: only inactive interfaces can be deleted",
- __func__);
+ snprintf(args->errmsg, args->errmsg_len,
+ "only inactive interfaces can be deleted");
return NB_ERR_VALIDATION;
}
break;