]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix crash when iterating over nb operational data
authorIgor Ryzhov <iryzhov@nfware.com>
Fri, 26 Feb 2021 16:17:28 +0000 (19:17 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Wed, 24 Mar 2021 15:55:56 +0000 (18:55 +0300)
Example:
```
show yang operational-data /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default'] staticd
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
lib/northbound.c

index 0cf9ce4e60563ce4b1a6c95e35a9b9db7f6867db..3ebbe29680c368b4bd2c9729107a9158c09e5c97 100644 (file)
@@ -1809,6 +1809,16 @@ int nb_oper_data_iterate(const char *xpath, struct yang_translator *translator,
 
                /* Find the list entry pointer. */
                nn = dn->schema->priv;
+               if (!nn->cbs.lookup_entry) {
+                       flog_warn(
+                               EC_LIB_NB_OPERATIONAL_DATA,
+                               "%s: data path doesn't support iteration over operational data: %s",
+                               __func__, xpath);
+                       list_delete(&list_dnodes);
+                       yang_dnode_free(dnode);
+                       return NB_ERR;
+               }
+
                list_entry =
                        nb_callback_lookup_entry(nn, list_entry, &list_keys);
                if (list_entry == NULL) {