]> git.proxmox.com Git - mirror_frr.git/commit - lib/northbound.c
lib: fix iteration over schema nodes of a single YANG module
authorRenato Westphal <renato@opensourcerouting.org>
Tue, 20 Oct 2020 02:56:54 +0000 (23:56 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 23 Oct 2020 21:18:22 +0000 (18:18 -0300)
commit9bde0b256919ff3987ea60101229fec195324102
tree03d5a635efaf775dca58f389073b58c5fa2833d9
parent858e26d6fdd820b4943906bbe778d452e38d0198
lib: fix iteration over schema nodes of a single YANG module

The only safe way to iterate over all schema nodes of a given YANG
module is by iterating over all schema nodes of all YANG modules
and filter out the nodes that belong to other modules.

The original yang_snodes_iterate_module() code did the following:
1 - Iterate over all top-level schema nodes of the given module;
2 - Iterate over all augmentations of the given module.

While that iteration strategy is more efficient, it does't handle
well more complex YANG hierarchies containing nested augmentations
or self-augmenting modules. Any iteration that isn't done on the
resolved YANG data hierarchy is fragile and prone to errors.

Fixes regression introduced by commit 8a923b48513316b where the
gen_northbound_callbacks tool was generating duplicate callbacks
for certain modules.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
lib/northbound.c
lib/northbound_confd.c
lib/northbound_sysrepo.c
lib/yang.c