summaryrefslogtreecommitdiff
path: root/lib/yang.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-04-04 19:24:14 -0400
committerGitHub <noreply@github.com>2019-04-04 19:24:14 -0400
commitf61f266a0e484d3ba78a644f36a3a4f7113cfc74 (patch)
tree728ed9d219c276bbe6e01200c58594b392555c13 /lib/yang.c
parent04ca9856ba4eedc913ef7caf0e0c27b030d893dd (diff)
parent6a3fdeecf102f18afa95dbbe714d3b72f9e2a9dc (diff)
Merge pull request #3548 from opensourcerouting/rip-vrf
rip(ng)d: add VRF support
Diffstat (limited to 'lib/yang.c')
-rw-r--r--lib/yang.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/yang.c b/lib/yang.c
index 1d8e82eb28..7982d14fdd 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -610,6 +610,25 @@ struct list *yang_data_list_new(void)
return list;
}
+struct yang_data *yang_data_list_find(const struct list *list,
+ const char *xpath_fmt, ...)
+{
+ char xpath[XPATH_MAXLEN];
+ struct yang_data *data;
+ struct listnode *node;
+ va_list ap;
+
+ va_start(ap, xpath_fmt);
+ vsnprintf(xpath, sizeof(xpath), xpath_fmt, ap);
+ va_end(ap);
+
+ for (ALL_LIST_ELEMENTS_RO(list, node, data))
+ if (strmatch(data->xpath, xpath))
+ return data;
+
+ return NULL;
+}
+
static void *ly_dup_cb(const void *priv)
{
/* Make a shallow copy of the priv pointer. */