mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 11:18:43 +00:00
lib: fix yang_lyd_trim_xpath
We should traverse all top-level siblings, not only the first one. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
d9d5f79610
commit
2b7d9532c8
13
lib/yang.c
13
lib/yang.c
@ -1089,7 +1089,7 @@ LY_ERR yang_lyd_trim_xpath(struct lyd_node **root, const char *xpath)
|
|||||||
}
|
}
|
||||||
return LY_SUCCESS;
|
return LY_SUCCESS;
|
||||||
#else
|
#else
|
||||||
struct lyd_node *node;
|
struct lyd_node *node, *sib;
|
||||||
struct lyd_node **remove = NULL;
|
struct lyd_node **remove = NULL;
|
||||||
struct ly_set *set = NULL;
|
struct ly_set *set = NULL;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@ -1123,10 +1123,12 @@ LY_ERR yang_lyd_trim_xpath(struct lyd_node **root, const char *xpath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
darr_ensure_cap(remove, 128);
|
darr_ensure_cap(remove, 128);
|
||||||
LYD_TREE_DFS_BEGIN (*root, node) {
|
LY_LIST_FOR(*root, sib) {
|
||||||
|
LYD_TREE_DFS_BEGIN (sib, node) {
|
||||||
/*
|
/*
|
||||||
* If this is a direct matching node then include it's subtree
|
* If this is a direct matching node then include its
|
||||||
* which won't be marked and would otherwise be removed.
|
* subtree which won't be marked and would otherwise
|
||||||
|
* be removed.
|
||||||
*/
|
*/
|
||||||
if (node->priv == (void *)2)
|
if (node->priv == (void *)2)
|
||||||
LYD_TREE_DFS_continue = 1;
|
LYD_TREE_DFS_continue = 1;
|
||||||
@ -1134,7 +1136,8 @@ LY_ERR yang_lyd_trim_xpath(struct lyd_node **root, const char *xpath)
|
|||||||
*darr_append(remove) = node;
|
*darr_append(remove) = node;
|
||||||
LYD_TREE_DFS_continue = 1;
|
LYD_TREE_DFS_continue = 1;
|
||||||
}
|
}
|
||||||
LYD_TREE_DFS_END(*root, node);
|
LYD_TREE_DFS_END(sib, node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
darr_foreach_i (remove, i) {
|
darr_foreach_i (remove, i) {
|
||||||
if (remove[i] == *root)
|
if (remove[i] == *root)
|
||||||
|
Loading…
Reference in New Issue
Block a user