mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 10:11:52 +00:00
lib: prevent gRPC assert on missing YANG node
`yang_dnode_get` will `assert` if no YANG node/model exist, so lets test for its existence first before trying to access it. This `assert` is only acceptable for internal FRR usage otherwise we might miss typos or unmatching YANG models nodes/leaves. For gRPC usage we should let users attempt to use non existing models without `assert`ing. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
fd7abfa80b
commit
0f538858c2
@ -344,6 +344,10 @@ static struct lyd_node *get_dnode_config(const std::string &path)
|
|||||||
{
|
{
|
||||||
struct lyd_node *dnode;
|
struct lyd_node *dnode;
|
||||||
|
|
||||||
|
if (!yang_dnode_exists(running_config->dnode,
|
||||||
|
path.empty() ? NULL : path.c_str()))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
dnode = yang_dnode_get(running_config->dnode,
|
dnode = yang_dnode_get(running_config->dnode,
|
||||||
path.empty() ? NULL : path.c_str());
|
path.empty() ? NULL : path.c_str());
|
||||||
if (dnode)
|
if (dnode)
|
||||||
|
Loading…
Reference in New Issue
Block a user