From 609b3b39f54ef69e5ec772ec4bc481edea967161 Mon Sep 17 00:00:00 2001 From: Vincent Jardin Date: Mon, 30 Mar 2026 18:24:18 +0200 Subject: [PATCH 1/2] session BUGFIX nc_server_get_cpblts() returns no module capabilities The libyang v4 migration (5ab029a) simplified the YANG version filter in _nc_server_get_cpblts_version() from two separate checks to a single "mod->version != version" comparison. This broke the LYS_VERSION_UNDEF (0) case: since all parsed modules have version 1 or 2, the condition (1 != 0) is always true and every module is skipped. As a result, nc_server_get_cpblts() -- which passes LYS_VERSION_UNDEF to mean "all versions" -- returns only base protocol capabilities with zero model capabilities. Guard the check with "version &&" so that LYS_VERSION_UNDEF disables filtering, restoring the pre-5ab029a behavior. Signed-off-by: Vincent Jardin Fix: 5ab029a (lib UPDATE move to libyang v4) --- src/session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/session.c b/src/session.c index 9b65374c..784ea5e5 100644 --- a/src/session.c +++ b/src/session.c @@ -1283,8 +1283,8 @@ _nc_server_get_cpblts_version(const struct ly_ctx *ctx, LYS_VERSION version, int free(yl_content_id); yl_content_id = NULL; continue; - } else if (mod->version != version) { - /* skip YANG 1.0 or 1.1 modules */ + } else if (version && (mod->version != version)) { + /* skip modules not matching the requested YANG version (LYS_VERSION_UNDEF means all) */ continue; } From 8019723230fc4fe7c39055e2806e11f2926e3aba Mon Sep 17 00:00:00 2001 From: Vincent Jardin Date: Mon, 30 Mar 2026 18:24:50 +0200 Subject: [PATCH 2/2] hello FEATURE advertise YANG 1.1 modules in NETCONF capabilities nc_send_hello_io() hardcoded LYS_VERSION_1_0 when generating server capabilities, so only YANG 1.0 modules appeared in the message. YANG 1.1 modules -- the majority of modern YANG models -- were invisible to clients inspecting capabilities. RFC 7950 section 5.6.4 requires that YANG 1.1 modules be discoverable via ietf-yang-library, but does not prohibit listing them in . In practice, clients commonly rely on hello capabilities to determine server support. Use LYS_VERSION_UNDEF so that all implemented modules are advertised regardless of YANG version. Signed-off-by: Vincent Jardin --- src/session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/session.c b/src/session.c index 784ea5e5..b6e8c864 100644 --- a/src/session.c +++ b/src/session.c @@ -1489,7 +1489,7 @@ nc_send_hello_io(struct nc_session *session, int config_locked) timeout_io = NC_CLIENT_HELLO_TIMEOUT * 1000; sid = NULL; } else { - cpblts = _nc_server_get_cpblts_version(session->ctx, LYS_VERSION_1_0, config_locked); + cpblts = _nc_server_get_cpblts_version(session->ctx, LYS_VERSION_UNDEF, config_locked); if (!cpblts) { return NC_MSG_ERROR; }