Skip to content

hello FEATURE advertise YANG 1.1 modules in NETCONF capabilities#587

Closed
vjardin wants to merge 2 commits intoCESNET:develfrom
vjardin:vj_fixhello
Closed

hello FEATURE advertise YANG 1.1 modules in NETCONF capabilities#587
vjardin wants to merge 2 commits intoCESNET:develfrom
vjardin:vj_fixhello

Conversation

@vjardin
Copy link
Copy Markdown

@vjardin vjardin commented Mar 30, 2026

Fix nc_server_get_cpblts() regression from the libyang v4 migration (5ab029a): the simplified version filter mod->version != version broke LYS_VERSION_UNDEF (0), causing zero model capabilities to be returned. Guard with version && to restore the "all versions" semantics.

Additionally, change nc_send_hello_io() from LYS_VERSION_1_0 to LYS_VERSION_UNDEF so that YANG 1.1 modules -- the majority of modern YANG models -- are advertised in the server capabilities alongside YANG 1.0 ones.

RFC 7950 section 5.6.4 requires YANG 1.1 modules be discoverable via ietf-yang-library but does not prohibit listing them in <hello>. In practice, clients commonly rely on hello capabilities to determine server support.

Tested with netopeer2 test_hello (new test) verifying both YANG 1.0 (edit1.yang) and YANG 1.1 (notif2.yang) modules appear in session capabilities.

vjardin added 2 commits March 30, 2026 18:31
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 <vjardin@free.fr>

Fix: 5ab029a (lib UPDATE move to libyang v4)
nc_send_hello_io() hardcoded LYS_VERSION_1_0 when generating
server capabilities, so only YANG 1.0 modules appeared in the
<hello> 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 <hello>. 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 <vjardin@free.fr>
@vjardin
Copy link
Copy Markdown
Author

vjardin commented Mar 30, 2026

see CESNET/netopeer2#1792

@jktjkt
Copy link
Copy Markdown
Contributor

jktjkt commented Mar 30, 2026

This is actually in the introduction of RFC7950 (emphasis mine):

A server advertises support for YANG 1.1 modules by using ietf-yang-library [RFC7895] instead of listing them as capabilities in the <hello> message.

That's a standard from 2016. I wonder -- what client fails to implement this YANG 1.1 semantics and still supports the YANG 1.1 features of the models?

@vjardin
Copy link
Copy Markdown
Author

vjardin commented Mar 30, 2026

good point !

@vjardin vjardin closed this Mar 30, 2026
@vjardin vjardin deleted the vj_fixhello branch March 30, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants