diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2020-06-04 19:26:42 -0400 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2020-06-04 20:24:52 -0400 |
| commit | f7c20aa1fd5b997a6c545f0f064b82ad8a5cd3ce (patch) | |
| tree | c02e2394dbbff468c651e803ee144d6e818fc649 /lib/if.c | |
| parent | f981d44931ced06f594b33c54a27d6d843ad0379 (diff) | |
lib: move all userdata when changing node xpath
All userdata pointers need to be rekeyed to their new xpaths, not just
the one associated with the dnode being moved.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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++; } } |
