summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2023-11-20 10:29:57 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2023-11-20 10:32:52 +0100
commit75a7b5b6b64fde187acdfde67e60396f7634664c (patch)
tree751cfbc63366b3283a6541337dd3dd1e0854090f /lib
parentf9012ed5cf9ade94e73744e7dc61f671ea596c40 (diff)
lib: use LYD_VALIDATE_MULTI_ERROR only if available
LYD_VALIDATE_MULTI_ERROR was added in libyang 2.1.36. The currently enforced minimum of libyang is 2.0.0. Stick an #ifdef around it. Fixes: 51a2a4b3f471 ("lib: print all errors when validating a config") Cc: Igor Ryzhov <iryzhov@nfware.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/northbound.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/northbound.c b/lib/northbound.c
index 15775f4d3a..88aa2a5f20 100644
--- a/lib/northbound.c
+++ b/lib/northbound.c
@@ -871,7 +871,12 @@ int nb_candidate_update(struct nb_config *candidate)
int nb_candidate_validate_yang(struct nb_config *candidate, bool no_state,
char *errmsg, size_t errmsg_len)
{
- uint32_t options = LYD_VALIDATE_MULTI_ERROR;
+ uint32_t options = 0;
+
+#ifdef LYD_VALIDATE_MULTI_ERROR
+ /* libyang 2.1.36+ */
+ options |= LYD_VALIDATE_MULTI_ERROR;
+#endif
if (no_state)
SET_FLAG(options, LYD_VALIDATE_NO_STATE);