From 30d6b9cac85d3b7ef13e7174d6a6c6f899fcc7f0 Mon Sep 17 00:00:00 2001 From: Roman Janota Date: Fri, 11 Sep 2026 14:07:58 +0200 Subject: [PATCH 1/3] cmake UPDATE libnetconf2 updates nc_ps_poll() now removes a terminated session from the pollsession and hands its ownership over to the caller, which the server relies on, so require libnetconf2 4.6.0. Also drop the thread count check. MAX_PSPOLL_THREAD_COUNT is gone from libnetconf2, its pollsession queue grows on demand instead, so there is no limit left to check against and the pkg-config variable holding it is not exported anymore either. --- CMakeLists.txt | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b29c09b..bdda05cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,8 +49,8 @@ set(LIBYANG_DEP_SOVERSION 5.9.2) set(LIBYANG_DEP_SOVERSION_MAJOR 5) # libnetconf2 required version -set(LIBNETCONF2_DEP_VERSION 4.4.3) -set(LIBNETCONF2_DEP_SOVERSION 5.4.3) +set(LIBNETCONF2_DEP_VERSION 4.6.0) +set(LIBNETCONF2_DEP_SOVERSION 5.4.19) set(LIBNETCONF2_DEP_SOVERSION_MAJOR 5) # sysrepo required version @@ -156,16 +156,6 @@ if(PkgConfig_FOUND) pkg_check_modules(PKG_LN2 libnetconf2) if(PKG_LN2_FOUND) - # libnetconf2 thread count check - pkg_get_variable(LN2_THREAD_COUNT libnetconf2 "LN2_MAX_THREAD_COUNT") - if(LN2_THREAD_COUNT) - if(LN2_THREAD_COUNT LESS THREAD_COUNT) - message(FATAL_ERROR "libnetconf2 was compiled with support up to ${LN2_THREAD_COUNT} threads, server is configured with ${THREAD_COUNT}.") - else() - message(STATUS "libnetconf2 was compiled with support of up to ${LN2_THREAD_COUNT} threads") - endif() - endif() - # get libnetconf2 module directory, use it later when installing modules pkg_get_variable(LN2_YANG_MODULE_DIR libnetconf2 "LN2_SCHEMAS_DIR") endif() @@ -173,9 +163,6 @@ endif() # } PKGCONFIG -if(NOT LN2_THREAD_COUNT) - message(STATUS "Unable to learn libnetconf2 thread support, check skipped") -endif() if(NOT LN2_YANG_MODULE_DIR) message(FATAL_ERROR "Unable to learn libnetconf2 module search directory, define LN2_YANG_MODULE_DIR manually.") endif() From 734859cac28c41a743d4e0dcbcfe47b8f615289c Mon Sep 17 00:00:00 2001 From: Roman Janota Date: Fri, 11 Sep 2026 14:08:07 +0200 Subject: [PATCH 2/3] main UPDATE libnetconf2 session ownership A session reported as terminated by nc_ps_poll() is no longer in the pollsession, the poll removed it and handed its ownership over. So nc_ps_del_session() on it fails now and an error was logged for every session that ended normally. np2srv_del_session_cb() is called both for such a session and, on server shutdown, for one that is still in the pollsession and has to be removed from it. Only the caller knows which it is, so it tells the callback with a new parameter. --- src/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 66a57325..3f6893ce 100644 --- a/src/main.c +++ b/src/main.c @@ -121,15 +121,16 @@ signal_handler(int sig) * @brief Callback for deleting NC sessions. * * @param[in] session NC session to delete. + * @param[in] in_ps Whether @p session is still in the pollsession. */ static void -np2srv_del_session_cb(struct nc_session *session) +np2srv_del_session_cb(struct nc_session *session, int in_ps) { struct np_user_sess *user_sess; uint32_t i; /* remove from PS structure */ - if (nc_ps_del_session(np2srv.nc_ps, session)) { + if (in_ps && nc_ps_del_session(np2srv.nc_ps, session)) { ERR("Removing session from ps failed."); } @@ -1115,7 +1116,7 @@ server_destroy(void) while (nc_ps_session_count(np2srv.nc_ps)) { sess = nc_ps_get_session(np2srv.nc_ps, 0); nc_session_set_term_reason(sess, NC_SESSION_TERM_OTHER); - np2srv_del_session_cb(sess); + np2srv_del_session_cb(sess, 1); sr_release_context(np2srv.sr_conn); } nc_ps_free(np2srv.nc_ps); @@ -1554,7 +1555,7 @@ worker_thread(void *arg) } if (rc & NC_PSPOLL_SESSION_TERM) { VRB("Session %d: thread %d event session terminated.", nc_session_get_id(ncs), idx); - np2srv_del_session_cb(ncs); + np2srv_del_session_cb(ncs, 0); sr_release_context(np2srv.sr_conn); } #ifdef NC_ENABLED_SSH_TLS From 040b2d5ed44a8bf011dd99500bb7ac72737f95e8 Mon Sep 17 00:00:00 2001 From: Roman Janota Date: Fri, 11 Sep 2026 14:08:11 +0200 Subject: [PATCH 3/3] VERSION bump to version 2.8.17 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bdda05cd..718837a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ endif() # Generic version of not only the library. Major version is reserved for really big changes of the project, # minor version changes with added functionality (new tool, functionality of the tool or library, ...) and # micro version is changed with a set of small changes or bugfixes anywhere in the project. -set(NP2SRV_VERSION 2.8.16) +set(NP2SRV_VERSION 2.8.17) # libyang required version set(LIBYANG_DEP_VERSION 6.3.0)