From 895a790d570169795b82350d97c7226b31a526de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 16 Sep 2024 11:56:00 +0200 Subject: [PATCH] Bump netopeer2, libnetconf2, libyang and sysrepo --- buildroot | 2 +- ...or-system-authentication-as-fallback.patch | 59 ------ .../UPSTREAM-Fix-netopeer2-segfault.patch | 73 ------- ...as-copy-from-only-in-rpc-copy-config.patch | 27 --- ...f-monitor-add-support-for-submodules.patch | 38 ---- ...AM-maain-BUGFIX-clear-url-protocolos.patch | 20 -- ...-UPDATE-zero-the-whole-np2srv-struct.patch | 21 --- ...STREAM-main-BUGFIX-wrong-param-order.patch | 19 -- ...as-copy-from-only-in-rpc-copy-config.patch | 10 +- ...rs-backwards-compat-with-older-mode.patch} | 25 ++- .../0005-modinfo-BUGFIX-memory-leak.patch | 29 --- ...b-ntf-BUGFIX-proper-invalid-FD-check.patch | 27 --- ...add-support-for-running-in-foregroun.patch | 4 +- ...NE-to-return-any-error-to-sysrepocfg.patch | 34 ++-- ...3-Allow-to-copy-from-factory-default.patch | 9 +- ...sysrepoctl-to-install-factory-config.patch | 10 +- ...-new-log-level-SEC-for-audit-trails.patch} | 4 +- ...il-for-high-priority-system-changes.patch} | 14 +- ...r_shmsub_listen_thread-exit-process.patch} | 10 +- ...add-support-for-running-in-foregroun.patch | 71 ------- ...tall_modules-to-use-ly_ctx_load_modu.patch | 136 ------------- ...-loading-etc-sysrepo-factory-default.patch | 120 ------------ ...l-add-support-for-Cfactory-d-running.patch | 56 ------ ...NE-to-return-any-error-to-sysrepocfg.patch | 152 --------------- ...o-BUGFIX-do-not-replace-changed-data.patch | 53 ------ ...add-support-for-running-in-foregroun.patch | 72 ------- ...NE-to-return-any-error-to-sysrepocfg.patch | 153 --------------- ...4-Allow-to-copy-from-factory-default.patch | 27 --- ...sysrepoctl-to-install-factory-config.patch | 178 ------------------ 29 files changed, 71 insertions(+), 1382 deletions(-) delete mode 100644 patches/libnetconf2/3.0.17/0001-Add-support-for-system-authentication-as-fallback.patch delete mode 100644 patches/libyang/2.2.8/UPSTREAM-Fix-netopeer2-segfault.patch delete mode 100644 patches/netopeer2/2.1.71/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch delete mode 100644 patches/netopeer2/2.1.71/0002-netconf-monitor-add-support-for-submodules.patch delete mode 100644 patches/netopeer2/2.2.28/0003-UPSTREAM-maain-BUGFIX-clear-url-protocolos.patch delete mode 100644 patches/netopeer2/2.2.28/0004-UPSTREAM-main-UPDATE-zero-the-whole-np2srv-struct.patch delete mode 100644 patches/netopeer2/2.2.28/0005-UPSTREAM-main-BUGFIX-wrong-param-order.patch rename patches/netopeer2/{2.2.28 => 2.2.31}/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch (75%) rename patches/netopeer2/{2.2.28/0002-disable-local-users.patch => 2.2.31/0002-Disable-local-users-backwards-compat-with-older-mode.patch} (64%) delete mode 100644 patches/sysrepo/2.10.1/0005-modinfo-BUGFIX-memory-leak.patch delete mode 100644 patches/sysrepo/2.10.1/0006-sub-ntf-BUGFIX-proper-invalid-FD-check.patch rename patches/sysrepo/{2.10.1 => 2.11.7}/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch (95%) rename patches/sysrepo/{2.10.1 => 2.11.7}/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch (82%) rename patches/sysrepo/{2.10.1 => 2.11.7}/0003-Allow-to-copy-from-factory-default.patch (74%) rename patches/sysrepo/{2.10.1 => 2.11.7}/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch (95%) rename patches/sysrepo/{2.10.1/0007-Introduce-new-log-level-SEC-for-audit-trails.patch => 2.11.7/0005-Introduce-new-log-level-SEC-for-audit-trails.patch} (96%) rename patches/sysrepo/{2.10.1/0008-Add-audit-trail-for-high-priority-system-changes.patch => 2.11.7/0006-Add-audit-trail-for-high-priority-system-changes.patch} (86%) rename patches/sysrepo/{2.10.1/0009-On-error-in-sr_shmsub_listen_thread-exit-process.patch => 2.11.7/0007-On-error-in-sr_shmsub_listen_thread-exit-process.patch} (79%) delete mode 100644 patches/sysrepo/2.2.105/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch delete mode 100644 patches/sysrepo/2.2.105/0002-Refactor-_sr_install_modules-to-use-ly_ctx_load_modu.patch delete mode 100644 patches/sysrepo/2.2.105/0003-Add-support-for-loading-etc-sysrepo-factory-default.patch delete mode 100644 patches/sysrepo/2.2.105/0004-sysrepoctl-add-support-for-Cfactory-d-running.patch delete mode 100644 patches/sysrepo/2.2.105/0005-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch delete mode 100644 patches/sysrepo/2.2.170/0001-modinfo-BUGFIX-do-not-replace-changed-data.patch delete mode 100644 patches/sysrepo/2.2.170/0002-sysrepo-plugind-add-support-for-running-in-foregroun.patch delete mode 100644 patches/sysrepo/2.2.170/0003-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch delete mode 100644 patches/sysrepo/2.2.170/0004-Allow-to-copy-from-factory-default.patch delete mode 100644 patches/sysrepo/2.2.170/0005-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch diff --git a/buildroot b/buildroot index 7c1f44ce6..475ea17ff 160000 --- a/buildroot +++ b/buildroot @@ -1 +1 @@ -Subproject commit 7c1f44ce6a0f1aa7c3cbe18d861f7f2504b9caa7 +Subproject commit 475ea17ffe80507af42657b297a6f2815699b021 diff --git a/patches/libnetconf2/3.0.17/0001-Add-support-for-system-authentication-as-fallback.patch b/patches/libnetconf2/3.0.17/0001-Add-support-for-system-authentication-as-fallback.patch deleted file mode 100644 index 83dcbaa77..000000000 --- a/patches/libnetconf2/3.0.17/0001-Add-support-for-system-authentication-as-fallback.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 2b3e1c379bf9b9404452b7aa1a66a6ce6d1301e3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= -Date: Fri, 17 May 2024 13:33:53 +0200 -Subject: [PATCH] Add support for system authentication as fallback - -First check if the user is configurured in ietf-netconf-server YANG, -if found in YANG go with the user found. Else, if using shadow or pam, -just continue, try to auth anyway. PAM will block the login later if -incorrect. ---- - src/session_server_ssh.c | 17 +++++++++++++++-- - 1 file changed, 15 insertions(+), 2 deletions(-) - -diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c -index c8386bc..86d5bb1 100644 ---- a/src/session_server_ssh.c -+++ b/src/session_server_ssh.c -@@ -1415,6 +1415,7 @@ nc_session_ssh_msg(struct nc_session *session, struct nc_server_ssh_opts *opts, - * process known messages - */ - if (type == SSH_REQUEST_AUTH) { -+ int username_allocated = 0; - if (session->flags & NC_SESSION_SSH_AUTHENTICATED) { - ERR(session, "User \"%s\" authenticated, but requested another authentication.", session->username); - ssh_message_reply_default(msg); -@@ -1439,6 +1440,15 @@ nc_session_ssh_msg(struct nc_session *session, struct nc_server_ssh_opts *opts, - } - } - -+#if defined(HAVE_LIBPAM) || defined(HAVE_SHADOW) -+ if (!auth_client) { -+ username_allocated = 1; -+ auth_client = malloc(sizeof(*auth_client)); /* Get freed when closing session. */ -+ memset(auth_client, 0, sizeof(*auth_client)); -+ auth_client->username = strdup(username); -+ auth_client->kb_int_enabled = 1; -+ } -+#else - if (!auth_client) { - if (opts->referenced_endpt_name) { - /* client not known by the endpt, but it references another one so try it */ -@@ -1457,9 +1467,12 @@ nc_session_ssh_msg(struct nc_session *session, struct nc_server_ssh_opts *opts, - ssh_message_reply_default(msg); - return 0; - } -- -+#endif - if (!session->username) { -- session->username = strdup(username); -+ if (username_allocated) -+ session->username = auth_client->username; -+ else -+ session->username = strdup(username); - - /* configure and count accepted auth methods */ - if (auth_client->store == NC_STORE_LOCAL) { --- -2.34.1 - diff --git a/patches/libyang/2.2.8/UPSTREAM-Fix-netopeer2-segfault.patch b/patches/libyang/2.2.8/UPSTREAM-Fix-netopeer2-segfault.patch deleted file mode 100644 index f104136cb..000000000 --- a/patches/libyang/2.2.8/UPSTREAM-Fix-netopeer2-segfault.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 1544e0adb44a18d95e1bb23d2881a73a89fa5631 Mon Sep 17 00:00:00 2001 -From: Michal Vasko -Date: Mon, 22 Apr 2024 14:12:24 +0200 -Subject: [PATCH] plugins BUGFIX safe retrieval of canonical value - -Fixes cesnet/netopeer2#1562 ---- - src/plugins_types/binary.c | 6 +++--- - src/plugins_types/instanceid.c | 2 +- - src/plugins_types/string.c | 6 +++--- - 3 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/src/plugins_types/binary.c b/src/plugins_types/binary.c -index c2655119d..c70b4a008 100644 ---- a/src/plugins_types/binary.c -+++ b/src/plugins_types/binary.c -@@ -338,7 +338,7 @@ lyplg_type_store_binary(const struct ly_ctx *ctx, const struct lysc_type *type, - * @brief Implementation of ::lyplg_type_validate_clb for the binary type. - */ - static LY_ERR --lyplg_type_validate_binary(const struct ly_ctx *UNUSED(ctx), const struct lysc_type *type, const struct lyd_node *UNUSED(ctx_node), -+lyplg_type_validate_binary(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *UNUSED(ctx_node), - const struct lyd_node *UNUSED(tree), struct lyd_value *storage, struct ly_err_item **err) - { - struct lysc_type_bin *type_bin = (struct lysc_type_bin *)type; -@@ -349,8 +349,8 @@ lyplg_type_validate_binary(const struct ly_ctx *UNUSED(ctx), const struct lysc_t - LY_CHECK_ARG_RET(NULL, type, storage, err, LY_EINVAL); - - val = LYPLG_TYPE_VAL_IS_DYN(val) ? (struct lyd_value_binary *)(storage->dyn_mem) : (struct lyd_value_binary *)(storage->fixed_mem); -- value = storage->_canonical; -- value_len = strlen(storage->_canonical); -+ value = lyd_value_get_canonical(ctx, storage); -+ value_len = strlen(value); - *err = NULL; - - /* length restriction of the binary value */ -diff --git a/src/plugins_types/instanceid.c b/src/plugins_types/instanceid.c -index 84e92b698..00ad45a98 100644 ---- a/src/plugins_types/instanceid.c -+++ b/src/plugins_types/instanceid.c -@@ -244,7 +244,7 @@ lyplg_type_validate_instanceid(const struct ly_ctx *ctx, const struct lysc_type - - /* find the target in data */ - if ((ret = ly_path_eval(storage->target, tree, NULL, NULL))) { -- value = lyplg_type_print_instanceid(ctx, storage, LY_VALUE_CANON, NULL, NULL, NULL); -+ value = lyd_value_get_canonical(ctx, storage); - path = lyd_path(ctx_node, LYD_PATH_STD, NULL, 0); - return ly_err_new(err, ret, LYVE_DATA, path, strdup("instance-required"), LY_ERRMSG_NOINST, value); - } -diff --git a/src/plugins_types/string.c b/src/plugins_types/string.c -index e4c1cb986..2ad003551 100644 ---- a/src/plugins_types/string.c -+++ b/src/plugins_types/string.c -@@ -112,7 +112,7 @@ lyplg_type_store_string(const struct ly_ctx *ctx, const struct lysc_type *type, - * @brief Implementation of ::lyplg_type_validate_clb for the string type. - */ - static LY_ERR --lyplg_type_validate_string(const struct ly_ctx *UNUSED(ctx), const struct lysc_type *type, const struct lyd_node *UNUSED(ctx_node), -+lyplg_type_validate_string(const struct ly_ctx *ctx, const struct lysc_type *type, const struct lyd_node *UNUSED(ctx_node), - const struct lyd_node *UNUSED(tree), struct lyd_value *storage, struct ly_err_item **err) - { - LY_ERR ret; -@@ -121,8 +121,8 @@ lyplg_type_validate_string(const struct ly_ctx *UNUSED(ctx), const struct lysc_t - size_t value_len; - - LY_CHECK_ARG_RET(NULL, type, storage, err, LY_EINVAL); -- value = storage->_canonical; -- value_len = strlen(storage->_canonical); -+ value = lyd_value_get_canonical(ctx, storage); -+ value_len = strlen(value); - *err = NULL; - - /* length restriction of the string */ diff --git a/patches/netopeer2/2.1.71/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch b/patches/netopeer2/2.1.71/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch deleted file mode 100644 index 8897cbfb4..000000000 --- a/patches/netopeer2/2.1.71/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 1175168ef202c32ce07a674b0c14678c5c130274 Mon Sep 17 00:00:00 2001 -From: Joachim Wiberg -Date: Thu, 22 Jun 2023 10:24:57 +0200 -Subject: [PATCH] Allow 'factory' as copy-from (only) in rpc copy-config -Organization: Addiva Elektronik - -Signed-off-by: Joachim Wiberg ---- - src/netconf.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/netconf.c b/src/netconf.c -index 840debb..fa778d5 100644 ---- a/src/netconf.c -+++ b/src/netconf.c -@@ -332,6 +332,8 @@ np2srv_rpc_copyconfig_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), con - ds = SR_DS_STARTUP; - } else if (!strcmp(nodeset->dnodes[0]->schema->name, "candidate")) { - ds = SR_DS_CANDIDATE; -+ } else if (!strcmp(nodeset->dnodes[0]->schema->name, "factory")) { -+ ds = SR_DS_FACTORY_DEFAULT; /* only allowed as copy-from */ - } else { - assert(!strcmp(nodeset->dnodes[0]->schema->name, "url")); - #ifdef NP2SRV_URL_CAPAB --- -2.34.1 - diff --git a/patches/netopeer2/2.1.71/0002-netconf-monitor-add-support-for-submodules.patch b/patches/netopeer2/2.1.71/0002-netconf-monitor-add-support-for-submodules.patch deleted file mode 100644 index 4f0f249b5..000000000 --- a/patches/netopeer2/2.1.71/0002-netconf-monitor-add-support-for-submodules.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/src/netconf_monitoring.c b/src/netconf_monitoring.c -index 467338b..4280a7f 100644 ---- a/src/netconf_monitoring.c -+++ b/src/netconf_monitoring.c -@@ -273,11 +273,14 @@ np2srv_ncm_oper_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), const cha - { - struct lyd_node *root = NULL, *cont, *list; - const struct lys_module *mod; -+ const struct lysp_submodule *submod; - sr_conn_ctx_t *conn; - struct ly_ctx *ly_ctx; - char **cpblts; - char *time_str, buf[11]; - uint32_t i; -+ LY_ARRAY_COUNT_TYPE u; -+ struct timespec ts; - - /* context is locked while the callback is executed */ - conn = sr_session_get_connection(session); -@@ -320,6 +323,18 @@ np2srv_ncm_oper_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), const cha - lyd_new_list(cont, NULL, "schema", 0, &list, mod->name, mod->revision ? mod->revision : "", "yin"); - lyd_new_term(list, NULL, "namespace", mod->ns, 0, NULL); - lyd_new_term(list, NULL, "location", "NETCONF", 0, NULL); -+ -+ LY_ARRAY_FOR(mod->parsed->includes, u) { -+ submod = mod->parsed->includes[u].submodule; -+ -+ lyd_new_list(cont, NULL, "schema", 0, &list, submod->name, submod->revs ? submod->revs[0].date : "", "yang"); -+ lyd_new_term(list, NULL, "namespace", mod->ns, 0, NULL); -+ lyd_new_term(list, NULL, "location", "NETCONF", 0, NULL); -+ -+ lyd_new_list(cont, NULL, "schema", 0, &list, submod->name, submod->revs ? submod->revs[0].date : "", "yin"); -+ lyd_new_term(list, NULL, "namespace", mod->ns, 0, NULL); -+ lyd_new_term(list, NULL, "location", "NETCONF", 0, NULL); -+ } - } - - /* sessions */ diff --git a/patches/netopeer2/2.2.28/0003-UPSTREAM-maain-BUGFIX-clear-url-protocolos.patch b/patches/netopeer2/2.2.28/0003-UPSTREAM-maain-BUGFIX-clear-url-protocolos.patch deleted file mode 100644 index 4871b86ad..000000000 --- a/patches/netopeer2/2.2.28/0003-UPSTREAM-maain-BUGFIX-clear-url-protocolos.patch +++ /dev/null @@ -1,20 +0,0 @@ -commit 2a7478b93b9779b70e5565544c334381947c9e3f -Author: Michal Vasko -Date: Mon Jul 1 13:01:35 2024 +0200 - - maain BUGFIX clear url protocolos - - Affects static reinitialization. - -diff --git a/src/main.c b/src/main.c -index 92ab3de..a24f3bf 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -658,6 +658,7 @@ server_destroy(void) - - /* free dynamic members */ - free(np2srv.url_protocols); -+ np2srv.url_protocols = NULL; - } - - /** diff --git a/patches/netopeer2/2.2.28/0004-UPSTREAM-main-UPDATE-zero-the-whole-np2srv-struct.patch b/patches/netopeer2/2.2.28/0004-UPSTREAM-main-UPDATE-zero-the-whole-np2srv-struct.patch deleted file mode 100644 index 996f066e4..000000000 --- a/patches/netopeer2/2.2.28/0004-UPSTREAM-main-UPDATE-zero-the-whole-np2srv-struct.patch +++ /dev/null @@ -1,21 +0,0 @@ -commit d1a99ae9f40e953b8967c83c2812b9d556093a3c -Author: Michal Vasko -Date: Mon Jul 1 14:01:39 2024 +0200 - - main UPDATE zero the whole np2srv struct - -diff --git a/src/main.c b/src/main.c -index a24f3bf..18d9078 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -658,7 +658,9 @@ server_destroy(void) - - /* free dynamic members */ - free(np2srv.url_protocols); -- np2srv.url_protocols = NULL; -+ -+ /* zero */ -+ memset(&np2srv, sizeof np2srv, 0); - } - - /** diff --git a/patches/netopeer2/2.2.28/0005-UPSTREAM-main-BUGFIX-wrong-param-order.patch b/patches/netopeer2/2.2.28/0005-UPSTREAM-main-BUGFIX-wrong-param-order.patch deleted file mode 100644 index a915a7b11..000000000 --- a/patches/netopeer2/2.2.28/0005-UPSTREAM-main-BUGFIX-wrong-param-order.patch +++ /dev/null @@ -1,19 +0,0 @@ -commit 7ec275a297ad62964b62fb44634da636fa1ac087 -Author: Michal Vasko -Date: Mon Jul 1 14:07:00 2024 +0200 - - main BUGFIX wrong param order - -diff --git a/src/main.c b/src/main.c -index 18d9078..9baf76e 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -660,7 +660,7 @@ server_destroy(void) - free(np2srv.url_protocols); - - /* zero */ -- memset(&np2srv, sizeof np2srv, 0); -+ memset(&np2srv, 0, sizeof np2srv); - } - - /** diff --git a/patches/netopeer2/2.2.28/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch b/patches/netopeer2/2.2.31/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch similarity index 75% rename from patches/netopeer2/2.2.28/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch rename to patches/netopeer2/2.2.31/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch index 8897cbfb4..f0c70952f 100644 --- a/patches/netopeer2/2.2.28/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch +++ b/patches/netopeer2/2.2.31/0001-Allow-factory-as-copy-from-only-in-rpc-copy-config.patch @@ -1,7 +1,7 @@ -From 1175168ef202c32ce07a674b0c14678c5c130274 Mon Sep 17 00:00:00 2001 +From 063f9b1696a4570aa61f02eb443d6752cab11c0c Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 22 Jun 2023 10:24:57 +0200 -Subject: [PATCH] Allow 'factory' as copy-from (only) in rpc copy-config +Subject: [PATCH 1/3] Allow 'factory' as copy-from (only) in rpc copy-config Organization: Addiva Elektronik Signed-off-by: Joachim Wiberg @@ -10,10 +10,10 @@ Signed-off-by: Joachim Wiberg 1 file changed, 2 insertions(+) diff --git a/src/netconf.c b/src/netconf.c -index 840debb..fa778d5 100644 +index e0b790f..8ae4160 100644 --- a/src/netconf.c +++ b/src/netconf.c -@@ -332,6 +332,8 @@ np2srv_rpc_copyconfig_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), con +@@ -361,6 +361,8 @@ np2srv_rpc_copyconfig_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), con ds = SR_DS_STARTUP; } else if (!strcmp(nodeset->dnodes[0]->schema->name, "candidate")) { ds = SR_DS_CANDIDATE; @@ -23,5 +23,5 @@ index 840debb..fa778d5 100644 assert(!strcmp(nodeset->dnodes[0]->schema->name, "url")); #ifdef NP2SRV_URL_CAPAB -- -2.34.1 +2.43.0 diff --git a/patches/netopeer2/2.2.28/0002-disable-local-users.patch b/patches/netopeer2/2.2.31/0002-Disable-local-users-backwards-compat-with-older-mode.patch similarity index 64% rename from patches/netopeer2/2.2.28/0002-disable-local-users.patch rename to patches/netopeer2/2.2.31/0002-Disable-local-users-backwards-compat-with-older-mode.patch index a5a21aa09..974b26284 100644 --- a/patches/netopeer2/2.2.28/0002-disable-local-users.patch +++ b/patches/netopeer2/2.2.31/0002-Disable-local-users-backwards-compat-with-older-mode.patch @@ -1,5 +1,25 @@ +From 26e36c7db9ebf11bf057a53e0c16238bda14792c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= +Date: Tue, 2 Jul 2024 14:56:15 +0200 +Subject: [PATCH 2/3] Disable local users (backwards compat with older model) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Organization: Addiva Elektronik + +Drop local-users, because if enabled netopeer require all users that +should be allowed to use NETCONF to also be configured in the updated +ietf-netconf-server model. + +Signed-off-by: Mattias Walström +Signed-off-by: Joachim Wiberg +--- + scripts/common.sh | 2 +- + scripts/merge_config.sh | 3 --- + 2 files changed, 1 insertion(+), 4 deletions(-) + diff --git a/scripts/common.sh b/scripts/common.sh -index c3271de..86c4c44 100644 +index 25e531b..13234e1 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -29,7 +29,7 @@ LN2_MODULES=( @@ -25,3 +45,6 @@ index 4b476d6..e588369 100755 +-- +2.43.0 + diff --git a/patches/sysrepo/2.10.1/0005-modinfo-BUGFIX-memory-leak.patch b/patches/sysrepo/2.10.1/0005-modinfo-BUGFIX-memory-leak.patch deleted file mode 100644 index 84ed5402e..000000000 --- a/patches/sysrepo/2.10.1/0005-modinfo-BUGFIX-memory-leak.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8181ce6caf5ee49e30a02db9695647bd7bc73838 Mon Sep 17 00:00:00 2001 -From: Michal Vasko -Date: Tue, 2 Jul 2024 12:11:30 +0200 -Subject: [PATCH 5/9] modinfo BUGFIX memory leak -Organization: Addiva Elektronik - -Signed-off-by: Joachim Wiberg ---- - src/modinfo.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/modinfo.c b/src/modinfo.c -index 949c321b..9edb4498 100644 ---- a/src/modinfo.c -+++ b/src/modinfo.c -@@ -1042,6 +1042,10 @@ sr_xpath_oper_data_get(struct sr_mod_info_mod_s *mod, const char *xpath, const c - cleanup: - lyd_free_tree(parent_dup); - free(parent_path); -+ if (err_info) { -+ lyd_free_all(*oper_data); -+ *oper_data = NULL; -+ } - return err_info; - } - --- -2.43.0 - diff --git a/patches/sysrepo/2.10.1/0006-sub-ntf-BUGFIX-proper-invalid-FD-check.patch b/patches/sysrepo/2.10.1/0006-sub-ntf-BUGFIX-proper-invalid-FD-check.patch deleted file mode 100644 index f4ae0994a..000000000 --- a/patches/sysrepo/2.10.1/0006-sub-ntf-BUGFIX-proper-invalid-FD-check.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 3d297a0305e35007c4e16eb729025a0e58a0bcd2 Mon Sep 17 00:00:00 2001 -From: Michal Vasko -Date: Fri, 28 Jun 2024 14:10:25 +0200 -Subject: [PATCH 6/9] sub ntf BUGFIX proper invalid FD check -Organization: Addiva Elektronik - -Signed-off-by: Joachim Wiberg ---- - src/utils/subscribed_notifications.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/utils/subscribed_notifications.c b/src/utils/subscribed_notifications.c -index 0055f10a..a0694d04 100644 ---- a/src/utils/subscribed_notifications.c -+++ b/src/utils/subscribed_notifications.c -@@ -930,7 +930,7 @@ srsn_read_dispatch_add(int fd, void *cb_data) - { - sr_error_info_t *err_info = NULL; - -- SR_CHECK_ARG_APIRET(!fd, NULL, err_info); -+ SR_CHECK_ARG_APIRET(fd < 0, NULL, err_info); - - /* add into the pollfd structure */ - err_info = srsn_dispatch_add(fd, cb_data); --- -2.43.0 - diff --git a/patches/sysrepo/2.10.1/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch b/patches/sysrepo/2.11.7/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch similarity index 95% rename from patches/sysrepo/2.10.1/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch rename to patches/sysrepo/2.11.7/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch index 25e8b03f6..a3d93c564 100644 --- a/patches/sysrepo/2.10.1/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch +++ b/patches/sysrepo/2.11.7/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch @@ -1,7 +1,7 @@ -From dcd594e7c7e2b47b489243ce823e58e6b674bea3 Mon Sep 17 00:00:00 2001 +From e8daa7e3e6d24e66e1a74b00237af4c32438cb92 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 28 Mar 2023 10:37:53 +0200 -Subject: [PATCH 1/9] sysrepo-plugind: add support for running in foreground +Subject: [PATCH 1/7] sysrepo-plugind: add support for running in foreground with syslog Organization: Addiva Elektronik diff --git a/patches/sysrepo/2.10.1/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch b/patches/sysrepo/2.11.7/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch similarity index 82% rename from patches/sysrepo/2.10.1/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch rename to patches/sysrepo/2.11.7/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch index 57dea84b2..f4e3fb73d 100644 --- a/patches/sysrepo/2.10.1/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch +++ b/patches/sysrepo/2.11.7/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch @@ -1,7 +1,7 @@ -From 2a826d77d83930b32f2bdcf32ef9c57c616ec526 Mon Sep 17 00:00:00 2001 +From 936d4f34a12ef1a2fe3372df051b77ea19ce5d59 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 7 May 2024 15:41:53 +0200 -Subject: [PATCH 2/9] Allow SR_EV_DONE to return any error to sysrepocfg +Subject: [PATCH 2/7] Allow SR_EV_DONE to return any error to sysrepocfg Organization: Addiva Elektronik Importing a system configuration with sysrepocfg the model callbacks do @@ -24,10 +24,10 @@ Signed-off-by: Joachim Wiberg 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/shm_sub.c b/src/shm_sub.c -index 0fbe0f0c..363883ab 100644 +index 000f5906..4c59cbbf 100644 --- a/src/shm_sub.c +++ b/src/shm_sub.c -@@ -1718,7 +1718,7 @@ cleanup: +@@ -1659,7 +1659,7 @@ cleanup: sr_error_info_t * sr_shmsub_change_notify_change_done(struct sr_mod_info_s *mod_info, const char *orig_name, const void *orig_data, @@ -36,14 +36,14 @@ index 0fbe0f0c..363883ab 100644 { sr_error_info_t *err_info = NULL; struct sr_mod_info_mod_s *mod = NULL; -@@ -1850,12 +1850,19 @@ sr_shmsub_change_notify_change_done(struct sr_mod_info_s *mod_info, const char * +@@ -1791,12 +1791,19 @@ sr_shmsub_change_notify_change_done(struct sr_mod_info_s *mod_info, const char * sr_rwunlock(&nsub->sub_shm->lock, 0, SR_LOCK_WRITE, cid, __func__); nsub->lock = SR_LOCK_NONE; - /* we do not care about an error */ - sr_errinfo_free(&nsub->cb_err_info); - - SR_LOG_INF("EV ORIGIN: \"%s\" \"%s\" ID %" PRIu32 " priority %" PRIu32 " succeeded.", + SR_LOG_DBG("EV ORIGIN: \"%s\" \"%s\" ID %" PRIu32 " priority %" PRIu32 " succeeded.", nsub->mod->ly_mod->name, sr_ev2str(SR_SUB_EV_DONE), nsub->mod->request_id, nsub->cur_priority); + /* @@ -59,7 +59,7 @@ index 0fbe0f0c..363883ab 100644 nsub->pending_event = 0; } } while (1); -@@ -3330,7 +3337,7 @@ sr_shmsub_change_listen_relock(sr_multi_sub_shm_t *multi_sub_shm, sr_lock_mode_t +@@ -3278,7 +3285,7 @@ sr_shmsub_change_listen_relock(sr_sub_shm_t *sub_shm, sr_lock_mode_t mode, struc sr_error_info_t * sr_shmsub_change_listen_process_module_events(struct modsub_change_s *change_subs, sr_conn_ctx_t *conn) { @@ -68,7 +68,7 @@ index 0fbe0f0c..363883ab 100644 uint32_t i, data_len = 0, valid_subscr_count; char *data = NULL, *shm_data_ptr; int ret = SR_ERR_OK, filter_valid; -@@ -3458,6 +3465,11 @@ process_event: +@@ -3406,6 +3413,11 @@ process_event: } break; } @@ -80,7 +80,7 @@ index 0fbe0f0c..363883ab 100644 } /* subscription processed this event */ -@@ -3490,6 +3502,11 @@ process_event: +@@ -3438,6 +3450,11 @@ process_event: } break; case SR_SUB_EV_DONE: @@ -92,10 +92,10 @@ index 0fbe0f0c..363883ab 100644 case SR_SUB_EV_ABORT: /* nothing to do */ break; -@@ -3509,14 +3526,17 @@ process_event: +@@ -3457,14 +3474,17 @@ process_event: /* SUB WRITE URGE LOCK */ - if (sr_shmsub_change_listen_relock(multi_sub_shm, SR_LOCK_WRITE_URGE, &sub_info, change_sub, change_subs->module_name, + if (sr_shmsub_change_listen_relock(sub_shm, SR_LOCK_WRITE_URGE, &sub_info, change_sub, change_subs->module_name, - ret, filter_valid, ev_sess, &err_info)) { + ret, filter_valid, ev_sess, &err_tmp)) { + if (err_tmp) @@ -105,14 +105,14 @@ index 0fbe0f0c..363883ab 100644 sub_lock = SR_LOCK_WRITE_URGE; /* finish event */ -- if ((err_info = sr_shmsub_multi_listen_write_event(multi_sub_shm, valid_subscr_count, err_code, &shm_data_sub, data, -+ if ((err_tmp = sr_shmsub_multi_listen_write_event(multi_sub_shm, valid_subscr_count, err_code, &shm_data_sub, data, +- if ((err_info = sr_shmsub_listen_write_event(sub_shm, valid_subscr_count, err_code, &shm_data_sub, data, ++ if ((err_tmp = sr_shmsub_listen_write_event(sub_shm, valid_subscr_count, err_code, &shm_data_sub, data, data_len, change_subs->module_name, err_code ? "fail" : "success"))) { + err_info = err_tmp; goto cleanup; } -@@ -4055,7 +4075,7 @@ finish_iter: +@@ -3953,7 +3973,7 @@ finish_iter: sr_errinfo_free(&cb_err_info); /* publish "done" event */ @@ -122,7 +122,7 @@ index 0fbe0f0c..363883ab 100644 } diff --git a/src/shm_sub.h b/src/shm_sub.h -index 3056e4c5..460ad927 100644 +index 62050e98..04637223 100644 --- a/src/shm_sub.h +++ b/src/shm_sub.h @@ -144,7 +144,7 @@ sr_error_info_t *sr_shmsub_change_notify_change(struct sr_mod_info_s *mod_info, @@ -135,10 +135,10 @@ index 3056e4c5..460ad927 100644 /** * @brief Notify about (generate) a change "abort" event. diff --git a/src/sysrepo.c b/src/sysrepo.c -index 8778956b..35a1fd8c 100644 +index 06428bd8..3f08a627 100644 --- a/src/sysrepo.c +++ b/src/sysrepo.c -@@ -3898,7 +3898,7 @@ store: +@@ -3913,7 +3913,7 @@ store: } /* publish "done" event, all changes were applied */ diff --git a/patches/sysrepo/2.10.1/0003-Allow-to-copy-from-factory-default.patch b/patches/sysrepo/2.11.7/0003-Allow-to-copy-from-factory-default.patch similarity index 74% rename from patches/sysrepo/2.10.1/0003-Allow-to-copy-from-factory-default.patch rename to patches/sysrepo/2.11.7/0003-Allow-to-copy-from-factory-default.patch index 60c334b62..02b8a2e59 100644 --- a/patches/sysrepo/2.10.1/0003-Allow-to-copy-from-factory-default.patch +++ b/patches/sysrepo/2.11.7/0003-Allow-to-copy-from-factory-default.patch @@ -1,19 +1,18 @@ -From 89fdf6691229f8f0978ca9bb13fa0143e0e79dbd Mon Sep 17 00:00:00 2001 +From e518c0ee5b4a328c5cbc7e7f25d329d094183798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Wed, 8 May 2024 17:00:50 +0200 -Subject: [PATCH 3/9] Allow to copy from factory default +Subject: [PATCH 3/7] Allow to copy from factory default Organization: Addiva Elektronik -Signed-off-by: Joachim Wiberg --- src/sysrepo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sysrepo.c b/src/sysrepo.c -index 35a1fd8c..c15855e9 100644 +index 3f08a627..3b11c0b8 100644 --- a/src/sysrepo.c +++ b/src/sysrepo.c -@@ -4146,7 +4146,7 @@ sr_copy_config(sr_session_ctx_t *session, const char *module_name, sr_datastore_ +@@ -4161,7 +4161,7 @@ sr_copy_config(sr_session_ctx_t *session, const char *module_name, sr_datastore_ struct sr_mod_info_s mod_info; const struct lys_module *ly_mod = NULL; diff --git a/patches/sysrepo/2.10.1/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch b/patches/sysrepo/2.11.7/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch similarity index 95% rename from patches/sysrepo/2.10.1/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch rename to patches/sysrepo/2.11.7/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch index f495c09ca..e56c3fdcf 100644 --- a/patches/sysrepo/2.10.1/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch +++ b/patches/sysrepo/2.11.7/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch @@ -1,13 +1,11 @@ -From c7cd85da2831a5c1476e6ebe60431b87382c74c8 Mon Sep 17 00:00:00 2001 +From a7e91aac7d7669c6b82cb06a1b4e3c3e3d79275f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 6 May 2024 14:49:32 +0200 -Subject: [PATCH 4/9] Add -z switch to sysrepoctl to install factory config +Subject: [PATCH 4/7] Add -z switch to sysrepoctl to install factory config from a json file Organization: Addiva Elektronik This to be able to load the yang modules during build time instead on boot. - -Signed-off-by: Joachim Wiberg --- src/executables/sysrepoctl.c | 20 +++++++++++++-- src/lyd_mods.h | 7 ++++++ @@ -86,10 +84,10 @@ index 1960bc06..a8ca5add 100644 + #endif diff --git a/src/sysrepo.c b/src/sysrepo.c -index c15855e9..86d694e5 100644 +index 3b11c0b8..2e02de39 100644 --- a/src/sysrepo.c +++ b/src/sysrepo.c -@@ -1631,6 +1631,55 @@ sr_free_int_install_mods(sr_int_install_mod_t *new_mods, uint32_t new_mod_count) +@@ -1646,6 +1646,55 @@ sr_free_int_install_mods(sr_int_install_mod_t *new_mods, uint32_t new_mod_count) free(new_mods); } diff --git a/patches/sysrepo/2.10.1/0007-Introduce-new-log-level-SEC-for-audit-trails.patch b/patches/sysrepo/2.11.7/0005-Introduce-new-log-level-SEC-for-audit-trails.patch similarity index 96% rename from patches/sysrepo/2.10.1/0007-Introduce-new-log-level-SEC-for-audit-trails.patch rename to patches/sysrepo/2.11.7/0005-Introduce-new-log-level-SEC-for-audit-trails.patch index a87b31128..4a2123e10 100644 --- a/patches/sysrepo/2.10.1/0007-Introduce-new-log-level-SEC-for-audit-trails.patch +++ b/patches/sysrepo/2.11.7/0005-Introduce-new-log-level-SEC-for-audit-trails.patch @@ -1,7 +1,7 @@ -From d128686fb15833e815ac3dd04bd87d3725c881ac Mon Sep 17 00:00:00 2001 +From a4060077214c573f34f2a82b18083ccd27600a38 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Wed, 21 Aug 2024 16:00:35 +0200 -Subject: [PATCH 7/9] Introduce new log level [SEC] for audit trails +Subject: [PATCH 5/7] Introduce new log level [SEC] for audit trails Organization: Addiva Elektronik This adds a new log level for security and audit trail related log diff --git a/patches/sysrepo/2.10.1/0008-Add-audit-trail-for-high-priority-system-changes.patch b/patches/sysrepo/2.11.7/0006-Add-audit-trail-for-high-priority-system-changes.patch similarity index 86% rename from patches/sysrepo/2.10.1/0008-Add-audit-trail-for-high-priority-system-changes.patch rename to patches/sysrepo/2.11.7/0006-Add-audit-trail-for-high-priority-system-changes.patch index 86f6fe48e..80080e16b 100644 --- a/patches/sysrepo/2.10.1/0008-Add-audit-trail-for-high-priority-system-changes.patch +++ b/patches/sysrepo/2.11.7/0006-Add-audit-trail-for-high-priority-system-changes.patch @@ -1,7 +1,7 @@ -From b5db2b36c06d28918f0d00dda945f7e943b470af Mon Sep 17 00:00:00 2001 +From 3ee457861d98c62b2659b4fa49ec4571e78c83d4 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Wed, 21 Aug 2024 16:04:43 +0200 -Subject: [PATCH 8/9] Add audit trail for high priority system changes +Subject: [PATCH 6/7] Add audit trail for high priority system changes Organization: Addiva Elektronik Committing a change to running, copying to a datastore, or calling an @@ -18,10 +18,10 @@ Signed-off-by: Joachim Wiberg 1 file changed, 12 insertions(+) diff --git a/src/sysrepo.c b/src/sysrepo.c -index 86d694e5..dcea51e8 100644 +index 2e02de39..85a8e41c 100644 --- a/src/sysrepo.c +++ b/src/sysrepo.c -@@ -3946,6 +3946,9 @@ store: +@@ -3961,6 +3961,9 @@ store: goto cleanup; } @@ -31,7 +31,7 @@ index 86d694e5..dcea51e8 100644 /* publish "done" event, all changes were applied */ if ((err_info = sr_shmsub_change_notify_change_done(mod_info, orig_name, orig_data, timeout_ms, cb_err_info))) { goto cleanup; -@@ -3957,6 +3960,9 @@ store: +@@ -3972,6 +3975,9 @@ store: } cleanup: @@ -41,7 +41,7 @@ index 86d694e5..dcea51e8 100644 if (change_sub_lock) { assert(change_sub_lock == SR_LOCK_READ); -@@ -4285,6 +4291,9 @@ sr_copy_config(sr_session_ctx_t *session, const char *module_name, sr_datastore_ +@@ -4300,6 +4306,9 @@ sr_copy_config(sr_session_ctx_t *session, const char *module_name, sr_datastore_ } } @@ -51,7 +51,7 @@ index 86d694e5..dcea51e8 100644 cleanup: /* MODULES UNLOCK */ sr_shmmod_modinfo_unlock(&mod_info); -@@ -6552,6 +6561,9 @@ sr_rpc_send_tree(sr_session_ctx_t *session, struct lyd_node *input, uint32_t tim +@@ -6580,6 +6589,9 @@ sr_rpc_send_tree(sr_session_ctx_t *session, struct lyd_node *input, uint32_t tim } } diff --git a/patches/sysrepo/2.10.1/0009-On-error-in-sr_shmsub_listen_thread-exit-process.patch b/patches/sysrepo/2.11.7/0007-On-error-in-sr_shmsub_listen_thread-exit-process.patch similarity index 79% rename from patches/sysrepo/2.10.1/0009-On-error-in-sr_shmsub_listen_thread-exit-process.patch rename to patches/sysrepo/2.11.7/0007-On-error-in-sr_shmsub_listen_thread-exit-process.patch index c42aa5a21..d905a4938 100644 --- a/patches/sysrepo/2.10.1/0009-On-error-in-sr_shmsub_listen_thread-exit-process.patch +++ b/patches/sysrepo/2.11.7/0007-On-error-in-sr_shmsub_listen_thread-exit-process.patch @@ -1,7 +1,7 @@ -From 13d54101eb2c3506237cebc5be99edef2ad669cd Mon Sep 17 00:00:00 2001 +From be7579a3a787d7089acbda7536a21a2a9edc487d Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 23 Aug 2024 12:22:06 +0200 -Subject: [PATCH 9/9] On error in sr_shmsub_listen_thread(), exit process +Subject: [PATCH 7/7] On error in sr_shmsub_listen_thread(), exit process Organization: Addiva Elektronik If processing callback events in, e.g., sysrepo-plugind, make sure to @@ -14,10 +14,10 @@ Signed-off-by: Joachim Wiberg 1 file changed, 3 insertions(+) diff --git a/src/shm_sub.c b/src/shm_sub.c -index 363883ab..a1e68903 100644 +index 4c59cbbf..3d703cac 100644 --- a/src/shm_sub.c +++ b/src/shm_sub.c -@@ -4918,6 +4918,7 @@ sr_shmsub_listen_thread(void *arg) +@@ -4825,6 +4825,7 @@ sr_shmsub_listen_thread(void *arg) * another event is generated, our event pipe will not get notified */ continue; } else if (ret) { @@ -25,7 +25,7 @@ index 363883ab..a1e68903 100644 goto error; } -@@ -4958,5 +4959,7 @@ error: +@@ -4865,5 +4866,7 @@ error: /* free our own resources */ ATOMIC_STORE_RELAXED(subscr->thread_running, 0); pthread_detach(pthread_self()); diff --git a/patches/sysrepo/2.2.105/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch b/patches/sysrepo/2.2.105/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch deleted file mode 100644 index 414649fba..000000000 --- a/patches/sysrepo/2.2.105/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 49c660c412342e1af76735e75cd3f286ae655b82 Mon Sep 17 00:00:00 2001 -From: Joachim Wiberg -Date: Tue, 28 Mar 2023 10:37:53 +0200 -Subject: [PATCH 1/5] sysrepo-plugind: add support for running in foreground - with syslog -Organization: Addiva Elektronik - -Signed-off-by: Joachim Wiberg ---- - src/executables/sysrepo-plugind.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/src/executables/sysrepo-plugind.c b/src/executables/sysrepo-plugind.c -index 9ab59cb3..e689f930 100644 ---- a/src/executables/sysrepo-plugind.c -+++ b/src/executables/sysrepo-plugind.c -@@ -98,6 +98,7 @@ help_print(void) - " Change verbosity to a level (none, error, warning, info, debug) or\n" - " number (0, 1, 2, 3, 4).\n" - " -d, --debug Debug mode - is not daemonized and logs to stderr instead of syslog.\n" -+ " -n, --foreground Run in foreground and log to syslog.\n" - " -P, --plugin-install \n" - " Install a sysrepo-plugind plugin. The plugin is simply copied\n" - " to the designated plugin directory.\n" -@@ -201,6 +202,8 @@ daemon_init(int debug, sr_log_level_t log_level) - - if (debug) { - handle_signals(); -+ if (debug < 0) -+ goto done; - sr_log_stderr(log_level); - return; - } -@@ -241,6 +244,7 @@ daemon_init(int debug, sr_log_level_t log_level) - close(fd); - } - -+done: - /* set verbosity */ - sr_log_syslog("sysrepo-plugind", log_level); - } -@@ -466,6 +470,7 @@ main(int argc, char **argv) - {"version", no_argument, NULL, 'V'}, - {"verbosity", required_argument, NULL, 'v'}, - {"debug", no_argument, NULL, 'd'}, -+ {"foreground", no_argument, NULL, 'n'}, - {"plugin-install", required_argument, NULL, 'P'}, - {"pid-file", required_argument, NULL, 'p'}, - {"fatal-plugin-fail", no_argument, NULL, 'f'}, -@@ -474,7 +479,7 @@ main(int argc, char **argv) - - /* process options */ - opterr = 0; -- while ((opt = getopt_long(argc, argv, "hVv:dP:p:f", options, NULL)) != -1) { -+ while ((opt = getopt_long(argc, argv, "hVv:dnP:p:f", options, NULL)) != -1) { - switch (opt) { - case 'h': - version_print(); -@@ -506,6 +511,9 @@ main(int argc, char **argv) - case 'd': - debug = 1; - break; -+ case 'n': -+ debug = -1; -+ break; - case 'P': - /* plugin-install */ - if (get_plugins_dir(&plugins_dir)) { --- -2.34.1 - diff --git a/patches/sysrepo/2.2.105/0002-Refactor-_sr_install_modules-to-use-ly_ctx_load_modu.patch b/patches/sysrepo/2.2.105/0002-Refactor-_sr_install_modules-to-use-ly_ctx_load_modu.patch deleted file mode 100644 index 0d1362d81..000000000 --- a/patches/sysrepo/2.2.105/0002-Refactor-_sr_install_modules-to-use-ly_ctx_load_modu.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 87224ddce4ed1a118b3efb24e0dc7167f8754c22 Mon Sep 17 00:00:00 2001 -From: Joachim Wiberg -Date: Wed, 7 Jun 2023 15:19:13 +0200 -Subject: [PATCH 2/5] Refactor _sr_install_modules() to use - ly_ctx_load_module() -Organization: Addiva Elektronik - -This fixes issues with sysrepo discarding searchpaths and thus not -supporting include statements with yang submodules. By delegating all -the logic to libyang we can trust it resolves all YANG features. - -Signed-off-by: Joachim Wiberg ---- - src/common.c | 5 ++++- - src/common.h | 3 ++- - src/sysrepo.c | 29 ++++++++++++++++------------- - 3 files changed, 22 insertions(+), 15 deletions(-) - -diff --git a/src/common.c b/src/common.c -index f8acfb81..bef98f9a 100644 ---- a/src/common.c -+++ b/src/common.c -@@ -3596,7 +3596,7 @@ sr_get_trim_predicates(const char *expr, char **expr2) - } - - sr_error_info_t * --sr_get_schema_name_format(const char *schema_path, char **module_name, LYS_INFORMAT *format) -+sr_get_schema_name_format(const char *schema_path, char **module_name, char **module_rev, LYS_INFORMAT *format) - { - sr_error_info_t *err_info = NULL; - const char *ptr; -@@ -3626,6 +3626,9 @@ sr_get_schema_name_format(const char *schema_path, char **module_name, LYS_INFOR - if (ptr) { - /* truncate revision */ - ((char *)ptr)[0] = '\0'; -+ if (module_rev) { -+ *module_rev = strdup(++ptr); -+ } - } - - return NULL; -diff --git a/src/common.h b/src/common.h -index 00cc909f..ca5c08ca 100644 ---- a/src/common.h -+++ b/src/common.h -@@ -958,10 +958,11 @@ sr_error_info_t *sr_get_trim_predicates(const char *expr, char **expr2); - * - * @param[in] schema_path Path to the module file. - * @param[out] module_name Name of the module. -+ * @param[out] module_rev Optional module revision. - * @param[out] format Module format. - * @return err_info, NULL on success. - */ --sr_error_info_t *sr_get_schema_name_format(const char *schema_path, char **module_name, LYS_INFORMAT *format); -+sr_error_info_t *sr_get_schema_name_format(const char *schema_path, char **module_name, char **module_rev, LYS_INFORMAT *format); - - /** - * @brief Get datastore string name. -diff --git a/src/sysrepo.c b/src/sysrepo.c -index 1387ea9d..ee30c462 100644 ---- a/src/sysrepo.c -+++ b/src/sysrepo.c -@@ -1243,6 +1243,10 @@ sr_install_module_set_searchdirs(struct ly_ctx *new_ctx, const char *search_dirs - sdirs_str = strdup(search_dirs); - SR_CHECK_MEM_GOTO(!sdirs_str, err_info, cleanup); - -+ if (ly_ctx_set_options(new_ctx, LY_CTX_PREFER_SEARCHDIRS)) { -+ sr_log_msg(0, SR_LL_WRN, "Failed enabling LY_CTX_PREFER_SEARCHDIRS option."); -+ } -+ - /* add each search dir */ - for (ptr = strtok_r(sdirs_str, ":", &ptr2); ptr; ptr = strtok_r(NULL, ":", &ptr2)) { - if (!ly_ctx_set_searchdir(new_ctx, ptr)) { -@@ -1321,15 +1325,15 @@ sr_install_modules_prepare_mod(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, sr_i - { - sr_error_info_t *err_info = NULL; - const struct lys_module *ly_mod; -- struct ly_in *in = NULL; - char *mod_name = NULL; -+ char *mod_rev = NULL; - LYS_INFORMAT format; - sr_datastore_t ds; - - *installed = 0; - - /* learn module name and format */ -- if ((err_info = sr_get_schema_name_format(new_mod->schema_path, &mod_name, &format))) { -+ if ((err_info = sr_get_schema_name_format(new_mod->schema_path, &mod_name, &mod_rev, &format))) { - goto cleanup; - } - -@@ -1362,14 +1366,9 @@ sr_install_modules_prepare_mod(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, sr_i - goto cleanup; - } - -- /* parse the module with the features */ -- if (ly_in_new_filepath(new_mod->schema_path, 0, &in)) { -- sr_errinfo_new(&err_info, SR_ERR_INVAL_ARG, "Failed to create input handler for \"%s\".", -- new_mod->schema_path); -- goto cleanup; -- } -- if (lys_parse(new_ctx, in, format, new_mod->features, (struct lys_module **)&new_mod->ly_mod)) { -- sr_errinfo_new_ly(&err_info, new_ctx, NULL); -+ new_mod->ly_mod = ly_ctx_load_module(new_ctx, mod_name, mod_rev, new_mod->features); -+ if (!new_mod->ly_mod) { -+ sr_errinfo_new(&err_info, SR_ERR_INVAL_ARG, "Failed to create input handler for \"%s\".", mod_name); - goto cleanup; - } - -@@ -1392,8 +1391,12 @@ sr_install_modules_prepare_mod(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, sr_i - } - - cleanup: -- ly_in_free(in, 0); -- free(mod_name); -+ if (mod_name) { -+ free(mod_name); -+ } -+ if (mod_rev) { -+ free(mod_rev); -+ } - return err_info; - } - -@@ -1851,7 +1854,7 @@ sr_update_modules_prepare(struct ly_ctx *new_ctx, sr_conn_ctx_t *conn, const cha - for (i = 0; i < schema_path_count; ++i) { - /* learn about the module */ - upd_mods[i].schema_path = schema_paths[i]; -- if ((err_info = sr_get_schema_name_format(upd_mods[i].schema_path, &upd_mods[i].name, &upd_mods[i].format))) { -+ if ((err_info = sr_get_schema_name_format(upd_mods[i].schema_path, &upd_mods[i].name, NULL, &upd_mods[i].format))) { - goto cleanup; - } - --- -2.34.1 - diff --git a/patches/sysrepo/2.2.105/0003-Add-support-for-loading-etc-sysrepo-factory-default.patch b/patches/sysrepo/2.2.105/0003-Add-support-for-loading-etc-sysrepo-factory-default.patch deleted file mode 100644 index 2bf649c71..000000000 --- a/patches/sysrepo/2.2.105/0003-Add-support-for-loading-etc-sysrepo-factory-default.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 2d3b9524b1448dd6a8ef83e4e101e509d2552dcc Mon Sep 17 00:00:00 2001 -From: Joachim Wiberg -Date: Fri, 16 Jun 2023 12:13:16 +0200 -Subject: [PATCH 3/5] Add support for loading /etc/sysrepo/factory-default -Organization: Addiva Elektronik - -Follow-up to 3d07270 which adds support for compile-time defaults, this -allows for reading /etc/sysrepo/factory-default.[xml,json] at run-time -as well. - -Signed-off-by: Joachim Wiberg ---- - src/common.c | 29 +++++++++++++++++++++++++++++ - src/common.h | 11 +++++++++++ - src/lyd_mods.c | 23 +++++++++++++++++------ - 3 files changed, 57 insertions(+), 6 deletions(-) - -diff --git a/src/common.c b/src/common.c -index bef98f9a..bbb0c949 100644 ---- a/src/common.c -+++ b/src/common.c -@@ -1306,6 +1306,35 @@ sr_path_conn_lockfile(sr_cid_t cid, int creat, char **path) - return err_info; - } - -+sr_error_info_t * -+sr_path_factory_default(char **path) -+{ -+ const char *fdpath = "%s/factory-default.xml"; -+ sr_error_info_t *err_info = NULL; -+ int ret, once = 0; -+ -+retry: -+ ret = asprintf(path, fdpath, sr_get_repo_path()); -+ if (ret == -1) { -+ SR_ERRINFO_MEM(&err_info); -+ goto cleanup; -+ } -+ -+ if (sr_file_exists(*path)) { -+ return NULL; -+ } -+ -+ free(*path); -+ if (!once++) { -+ fdpath = "%s/factory-default.json"; -+ goto retry; -+ } -+ -+cleanup: -+ *path = NULL; -+ return err_info; -+} -+ - void - sr_remove_evpipes(void) - { -diff --git a/src/common.h b/src/common.h -index ca5c08ca..e8d394ef 100644 ---- a/src/common.h -+++ b/src/common.h -@@ -479,6 +479,17 @@ sr_error_info_t *sr_path_yang_file(const char *mod_name, const char *mod_rev, ch - */ - sr_error_info_t *sr_path_conn_lockfile(sr_cid_t cid, int creat, char **path); - -+/** -+ * @brief Get the path to system factory default input data used to init internal modules -+ * -+ * Looks for the file factory_default_config.xml, with fallback to -+ * factory_default_config.json in /etc/sysrepo/. -+ * -+ * @param[out] path Created path. -+ * @return err_info, NULL on success. -+ */ -+sr_error_info_t *sr_path_factory_default(char **path); -+ - /** - * @brief Remove any leftover event pipes after crashed subscriptions. - * There should be none unless there was a subscription structure without subscriptions that crashed. -diff --git a/src/lyd_mods.c b/src/lyd_mods.c -index 94e97b97..d2d8d34a 100644 ---- a/src/lyd_mods.c -+++ b/src/lyd_mods.c -@@ -955,16 +955,27 @@ sr_lydmods_create_data(const struct ly_ctx *ly_ctx) - sr_error_info_t *err_info = NULL; - const struct lys_module *ly_mod; - struct lyd_node *data = NULL, *mod_data = NULL, *mod_diff = NULL; -+ LY_ERR lyrc = LY_SUCCESS; -+ char *data_path = NULL; - uint32_t idx = 0; - int rc; - -- if (!strlen(SR_INT_MOD_DATA)) { -- /* no data to set */ -- goto cleanup; -+ /* -+ * parse and validate data: -+ * - first look for /etc/sysrepo/factory-default.[xml,json] -+ * - then look for any compile-time data as fallback -+ */ -+ sr_path_factory_default(&data_path); -+ if (data_path) { -+ lyrc = lyd_parse_data_path(ly_ctx, data_path, 0, 0, LYD_VALIDATE_NO_STATE, &data); -+ free(data_path); -+ } else { -+ if (!strlen(SR_INT_MOD_DATA)) { -+ goto cleanup; -+ } -+ lyrc = lyd_parse_data_mem(ly_ctx, SR_INT_MOD_DATA, SR_INT_MOD_DATA_FORMAT, 0, LYD_VALIDATE_NO_STATE, &data); - } -- -- /* parse and validate the data */ -- if (lyd_parse_data_mem(ly_ctx, SR_INT_MOD_DATA, SR_INT_MOD_DATA_FORMAT, 0, LYD_VALIDATE_NO_STATE, &data)) { -+ if (lyrc) { - sr_errinfo_new_ly(&err_info, ly_ctx, NULL); - goto cleanup; - } --- -2.34.1 - diff --git a/patches/sysrepo/2.2.105/0004-sysrepoctl-add-support-for-Cfactory-d-running.patch b/patches/sysrepo/2.2.105/0004-sysrepoctl-add-support-for-Cfactory-d-running.patch deleted file mode 100644 index cf3225944..000000000 --- a/patches/sysrepo/2.2.105/0004-sysrepoctl-add-support-for-Cfactory-d-running.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 7726017815243818f07936e4ff3bb979e9291f04 Mon Sep 17 00:00:00 2001 -From: Joachim Wiberg -Date: Fri, 16 Jun 2023 16:17:27 +0200 -Subject: [PATCH 4/5] sysrepoctl: add support for -Cfactory -d running -Organization: Addiva Elektronik - -Signed-off-by: Joachim Wiberg ---- - src/common.h | 3 +++ - src/executables/sysrepocfg.c | 2 +- - src/sysrepo.c | 2 +- - 3 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/common.h b/src/common.h -index e8d394ef..39fcce3a 100644 ---- a/src/common.h -+++ b/src/common.h -@@ -42,6 +42,9 @@ struct srplg_ntf_s; - /** macro for checking conventional datastore type */ - #define SR_IS_CONVENTIONAL_DS(ds) ((ds == SR_DS_STARTUP) || (ds == SR_DS_RUNNING) || (ds == SR_DS_CANDIDATE)) - -+/** macro for checking allowed source datastore */ -+#define SR_IS_COPY_SRC_DS(ds) ((ds == SR_DS_STARTUP) || (ds == SR_DS_RUNNING) || (ds == SR_DS_CANDIDATE) || (ds == SR_DS_FACTORY_DEFAULT)) -+ - /** macro for checking standard (modifiable) datastore type */ - #define SR_IS_STANDARD_DS(ds) (SR_IS_CONVENTIONAL_DS(ds) || (ds == SR_DS_OPERATIONAL)) - -diff --git a/src/executables/sysrepocfg.c b/src/executables/sysrepocfg.c -index 0c719e2c..65e56696 100644 ---- a/src/executables/sysrepocfg.c -+++ b/src/executables/sysrepocfg.c -@@ -730,7 +730,7 @@ arg_get_ds(const char *optarg, sr_datastore_t *ds) - *ds = SR_DS_CANDIDATE; - } else if (!strcmp(optarg, "operational")) { - *ds = SR_DS_OPERATIONAL; -- } else if (!strcmp(optarg, "factory-default")) { -+ } else if (!strcmp(optarg, "factory-default") || !strcmp(optarg, "factory")) { - *ds = SR_DS_FACTORY_DEFAULT; - } else { - error_print(0, "Unknown datastore \"%s\"", optarg); -diff --git a/src/sysrepo.c b/src/sysrepo.c -index ee30c462..ca2a20b7 100644 ---- a/src/sysrepo.c -+++ b/src/sysrepo.c -@@ -4037,7 +4037,7 @@ sr_copy_config(sr_session_ctx_t *session, const char *module_name, sr_datastore_ - struct sr_mod_info_s mod_info; - const struct lys_module *ly_mod = NULL; - -- SR_CHECK_ARG_APIRET(!session || !SR_IS_CONVENTIONAL_DS(src_datastore) || !SR_IS_CONVENTIONAL_DS(session->ds), -+ SR_CHECK_ARG_APIRET(!session || !SR_IS_COPY_SRC_DS(src_datastore) || !SR_IS_CONVENTIONAL_DS(session->ds), - session, err_info); - - if (src_datastore == session->ds) { --- -2.34.1 - diff --git a/patches/sysrepo/2.2.105/0005-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch b/patches/sysrepo/2.2.105/0005-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch deleted file mode 100644 index 7fa48eced..000000000 --- a/patches/sysrepo/2.2.105/0005-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 49b558067ab7c6f59ec84f14cc89201b4a7bde57 Mon Sep 17 00:00:00 2001 -From: Joachim Wiberg -Date: Tue, 7 May 2024 15:41:53 +0200 -Subject: [PATCH 5/5] Allow SR_EV_DONE to return any error to sysrepocfg -Organization: Addiva Elektronik - -Importing a system configuration with sysrepocfg the model callbacks do -their best to validate the configuration and prepare the transaction in -SR_EV_CHANGE. In cases when dealing with a complex system, like adding -a route, address, or other change using iproute2, we may still get into -trouble when actually sending off the transaction in SR_EV_DONE. - -If something does go wrong we'd like to know this by the exit code of -sysrepocfg, not by inspecting logs or expected system state. - -This patch is a clumsy way of forcing the (first) error to bubble up to -the surface and cause a non-zero exit code from sysrepocfg. - -Signed-off-by: Joachim Wiberg ---- - src/shm_sub.c | 36 ++++++++++++++++++++++++++++-------- - src/shm_sub.h | 2 +- - src/sysrepo.c | 2 +- - 3 files changed, 30 insertions(+), 10 deletions(-) - -diff --git a/src/shm_sub.c b/src/shm_sub.c -index 99b2be37..298d7dd3 100644 ---- a/src/shm_sub.c -+++ b/src/shm_sub.c -@@ -1586,7 +1586,7 @@ cleanup: - - sr_error_info_t * - sr_shmsub_change_notify_change_done(struct sr_mod_info_s *mod_info, const char *orig_name, const void *orig_data, -- uint32_t timeout_ms) -+ uint32_t timeout_ms, sr_error_info_t **cb_err_info) - { - sr_error_info_t *err_info = NULL; - struct sr_mod_info_mod_s *mod = NULL; -@@ -1717,12 +1717,19 @@ sr_shmsub_change_notify_change_done(struct sr_mod_info_s *mod_info, const char * - sr_rwunlock(&nsub->sub_shm->lock, 0, SR_LOCK_WRITE, cid, __func__); - nsub->lock = SR_LOCK_NONE; - -- /* we do not care about an error */ -- sr_errinfo_free(&nsub->cb_err_info); -- - SR_LOG_INF("EV ORIGIN: \"%s\" \"%s\" ID %" PRIu32 " priority %" PRIu32 " succeeded.", - nsub->mod->ly_mod->name, sr_ev2str(SR_SUB_EV_DONE), nsub->mod->request_id, nsub->cur_priority); - -+ /* -+ * unexpected critical error, merge and cleanup, let -+ * sysrepocfg caller handle undefined system state. -+ */ -+ if (nsub->cb_err_info) { -+ sr_errinfo_merge(cb_err_info, nsub->cb_err_info); -+ nsub->cb_err_info = NULL; -+ goto cleanup; -+ } -+ - nsub->pending_event = 0; - } - } while (1); -@@ -3167,7 +3174,7 @@ sr_shmsub_change_listen_check_update_edit(sr_session_ctx_t *ev_sess, const char - sr_error_info_t * - sr_shmsub_change_listen_process_module_events(struct modsub_change_s *change_subs, sr_conn_ctx_t *conn) - { -- sr_error_info_t *err_info = NULL; -+ sr_error_info_t *err_info = NULL, *err_tmp; - uint32_t i, data_len = 0, valid_subscr_count; - char *data = NULL, *shm_data_ptr; - int ret = SR_ERR_OK; -@@ -3289,6 +3296,11 @@ process_event: - } - break; - } -+ } else if (sub_info.event == SR_SUB_EV_DONE) { -+ if (ret && err_code == SR_ERR_OK) { -+ /* unexpected, callback actually failed, save for later. */ -+ err_code = ret; -+ } - } - - /* subscription processed this event */ -@@ -3330,6 +3342,11 @@ process_event: - } - break; - case SR_SUB_EV_DONE: -+ if (err_code) { -+ /* prepare unexepected error from session to be written to SHM */ -+ sr_errinfo_new(&err_info, err_code, "Oups, error detected in SR_EV_DONE"); -+ } -+ break; - case SR_SUB_EV_ABORT: - /* nothing to do */ - break; -@@ -3349,14 +3366,17 @@ process_event: - - /* SUB WRITE URGE LOCK */ - if (sr_shmsub_change_listen_relock(multi_sub_shm, SR_LOCK_WRITE_URGE, &sub_info, change_sub, change_subs->module_name, -- ret, ev_sess, &err_info)) { -+ ret, ev_sess, &err_tmp)) { -+ if (err_tmp) -+ err_info = err_tmp; - goto cleanup; - } - sub_lock = SR_LOCK_WRITE_URGE; - - /* finish event */ -- if ((err_info = sr_shmsub_multi_listen_write_event(multi_sub_shm, valid_subscr_count, err_code, &shm_data_sub, data, -+ if ((err_tmp = sr_shmsub_multi_listen_write_event(multi_sub_shm, valid_subscr_count, err_code, &shm_data_sub, data, - data_len, change_subs->module_name, err_code ? "fail" : "success"))) { -+ err_info = err_tmp; - goto cleanup; - } - -@@ -3886,7 +3906,7 @@ finish_iter: - sr_errinfo_free(&cb_err_info); - - /* publish "done" event */ -- if ((err_info = sr_shmsub_change_notify_change_done(&mod_info, NULL, NULL, SR_CHANGE_CB_TIMEOUT))) { -+ if ((err_info = sr_shmsub_change_notify_change_done(&mod_info, NULL, NULL, SR_CHANGE_CB_TIMEOUT, &cb_err_info))) { - goto cleanup_unlock; - } - -diff --git a/src/shm_sub.h b/src/shm_sub.h -index 3056e4c5..460ad927 100644 ---- a/src/shm_sub.h -+++ b/src/shm_sub.h -@@ -144,7 +144,7 @@ sr_error_info_t *sr_shmsub_change_notify_change(struct sr_mod_info_s *mod_info, - * @return err_info, NULL on success. - */ - sr_error_info_t *sr_shmsub_change_notify_change_done(struct sr_mod_info_s *mod_info, const char *orig_name, -- const void *orig_data, uint32_t timeout_ms); -+ const void *orig_data, uint32_t timeout_ms, sr_error_info_t **cb_err_info); - - /** - * @brief Notify about (generate) a change "abort" event. -diff --git a/src/sysrepo.c b/src/sysrepo.c -index ca2a20b7..e7c1fd0e 100644 ---- a/src/sysrepo.c -+++ b/src/sysrepo.c -@@ -3801,7 +3801,7 @@ store: - } - - /* publish "done" event, all changes were applied */ -- if ((err_info = sr_shmsub_change_notify_change_done(mod_info, orig_name, orig_data, timeout_ms))) { -+ if ((err_info = sr_shmsub_change_notify_change_done(mod_info, orig_name, orig_data, timeout_ms, cb_err_info))) { - goto cleanup; - } - --- -2.34.1 - diff --git a/patches/sysrepo/2.2.170/0001-modinfo-BUGFIX-do-not-replace-changed-data.patch b/patches/sysrepo/2.2.170/0001-modinfo-BUGFIX-do-not-replace-changed-data.patch deleted file mode 100644 index 732ffc58f..000000000 --- a/patches/sysrepo/2.2.170/0001-modinfo-BUGFIX-do-not-replace-changed-data.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 85efba771fcfa94d24b4851acb05adedb2b40082 Mon Sep 17 00:00:00 2001 -From: Michal Vasko -Date: Mon, 15 Apr 2024 09:27:10 +0200 -Subject: [PATCH 1/5] modinfo BUGFIX do not replace changed data -Organization: Addiva Elektronik - -Fixes #3268 - -Signed-off-by: Tobias Waldekranz ---- - src/modinfo.c | 18 ++++++++++++------ - 1 file changed, 12 insertions(+), 6 deletions(-) - -diff --git a/src/modinfo.c b/src/modinfo.c -index c9b95bdf..88f46e09 100644 ---- a/src/modinfo.c -+++ b/src/modinfo.c -@@ -2588,20 +2588,26 @@ sr_modinfo_data_load(struct sr_mod_info_s *mod_info, int read_only, const char * - * and not modifying the data */ - mod_info->data_cached = 1; - mod_info->data = conn->run_cache_data; -+ -+ for (i = 0; i < mod_info->mod_count; ++i) { -+ mod = &mod_info->mods[i]; -+ assert(!(mod->state & MOD_INFO_CHANGED)); -+ mod->state |= MOD_INFO_DATA; -+ } - } else { - /* duplicate data of all the modules, they will be modified */ - for (i = 0; i < mod_info->mod_count; ++i) { - mod = &mod_info->mods[i]; -+ if (mod->state & MOD_INFO_DATA) { -+ continue; -+ } -+ - if ((err_info = sr_lyd_get_module_data(&conn->run_cache_data, mod->ly_mod, 0, 1, &mod_info->data))) { - goto cleanup; - } -- } -- } - -- /* we have data fot all the modules */ -- for (i = 0; i < mod_info->mod_count; ++i) { -- mod = &mod_info->mods[i]; -- mod->state |= MOD_INFO_DATA; -+ mod->state |= MOD_INFO_DATA; -+ } - } - goto cleanup; - } --- -2.34.1 - diff --git a/patches/sysrepo/2.2.170/0002-sysrepo-plugind-add-support-for-running-in-foregroun.patch b/patches/sysrepo/2.2.170/0002-sysrepo-plugind-add-support-for-running-in-foregroun.patch deleted file mode 100644 index c4fc87469..000000000 --- a/patches/sysrepo/2.2.170/0002-sysrepo-plugind-add-support-for-running-in-foregroun.patch +++ /dev/null @@ -1,72 +0,0 @@ -From b5ad162fa8872f33e80b96e80a02d5c3a3a69a84 Mon Sep 17 00:00:00 2001 -From: Joachim Wiberg -Date: Tue, 28 Mar 2023 10:37:53 +0200 -Subject: [PATCH 2/5] sysrepo-plugind: add support for running in foreground - with syslog -Organization: Addiva Elektronik - -Signed-off-by: Joachim Wiberg -Signed-off-by: Tobias Waldekranz ---- - src/executables/sysrepo-plugind.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/src/executables/sysrepo-plugind.c b/src/executables/sysrepo-plugind.c -index a6a817cc..5baebec3 100644 ---- a/src/executables/sysrepo-plugind.c -+++ b/src/executables/sysrepo-plugind.c -@@ -98,6 +98,7 @@ help_print(void) - " Change verbosity to a level (none, error, warning, info, debug) or\n" - " number (0, 1, 2, 3, 4).\n" - " -d, --debug Debug mode - is not daemonized and logs to stderr instead of syslog.\n" -+ " -n, --foreground Run in foreground and log to syslog.\n" - " -P, --plugin-install \n" - " Install a sysrepo-plugind plugin. The plugin is simply copied\n" - " to the designated plugin directory.\n" -@@ -201,6 +202,8 @@ daemon_init(int debug, sr_log_level_t log_level) - - if (debug) { - handle_signals(); -+ if (debug < 0) -+ goto done; - sr_log_stderr(log_level); - return; - } -@@ -241,6 +244,7 @@ daemon_init(int debug, sr_log_level_t log_level) - close(fd); - } - -+done: - /* set verbosity */ - sr_log_syslog("sysrepo-plugind", log_level); - } -@@ -466,6 +470,7 @@ main(int argc, char **argv) - {"version", no_argument, NULL, 'V'}, - {"verbosity", required_argument, NULL, 'v'}, - {"debug", no_argument, NULL, 'd'}, -+ {"foreground", no_argument, NULL, 'n'}, - {"plugin-install", required_argument, NULL, 'P'}, - {"pid-file", required_argument, NULL, 'p'}, - {"fatal-plugin-fail", no_argument, NULL, 'f'}, -@@ -474,7 +479,7 @@ main(int argc, char **argv) - - /* process options */ - opterr = 0; -- while ((opt = getopt_long(argc, argv, "hVv:dP:p:f", options, NULL)) != -1) { -+ while ((opt = getopt_long(argc, argv, "hVv:dnP:p:f", options, NULL)) != -1) { - switch (opt) { - case 'h': - version_print(); -@@ -506,6 +511,9 @@ main(int argc, char **argv) - case 'd': - debug = 1; - break; -+ case 'n': -+ debug = -1; -+ break; - case 'P': - /* plugin-install */ - if (get_plugins_dir(&plugins_dir)) { --- -2.34.1 - diff --git a/patches/sysrepo/2.2.170/0003-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch b/patches/sysrepo/2.2.170/0003-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch deleted file mode 100644 index 9f2e54667..000000000 --- a/patches/sysrepo/2.2.170/0003-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch +++ /dev/null @@ -1,153 +0,0 @@ -From d60d3eae79616fc0fcd2544736fb7247e02d96cb Mon Sep 17 00:00:00 2001 -From: Joachim Wiberg -Date: Tue, 7 May 2024 15:41:53 +0200 -Subject: [PATCH 3/5] Allow SR_EV_DONE to return any error to sysrepocfg -Organization: Addiva Elektronik - -Importing a system configuration with sysrepocfg the model callbacks do -their best to validate the configuration and prepare the transaction in -SR_EV_CHANGE. In cases when dealing with a complex system, like adding -a route, address, or other change using iproute2, we may still get into -trouble when actually sending off the transaction in SR_EV_DONE. - -If something does go wrong we'd like to know this by the exit code of -sysrepocfg, not by inspecting logs or expected system state. - -This patch is a clumsy way of forcing the (first) error to bubble up to -the surface and cause a non-zero exit code from sysrepocfg. - -Signed-off-by: Joachim Wiberg -Signed-off-by: Tobias Waldekranz ---- - src/shm_sub.c | 36 ++++++++++++++++++++++++++++-------- - src/shm_sub.h | 2 +- - src/sysrepo.c | 2 +- - 3 files changed, 30 insertions(+), 10 deletions(-) - -diff --git a/src/shm_sub.c b/src/shm_sub.c -index 63a55056..e243a2c5 100644 ---- a/src/shm_sub.c -+++ b/src/shm_sub.c -@@ -1694,7 +1694,7 @@ cleanup: - - sr_error_info_t * - sr_shmsub_change_notify_change_done(struct sr_mod_info_s *mod_info, const char *orig_name, const void *orig_data, -- uint32_t timeout_ms) -+ uint32_t timeout_ms, sr_error_info_t **cb_err_info) - { - sr_error_info_t *err_info = NULL; - struct sr_mod_info_mod_s *mod = NULL; -@@ -1826,12 +1826,19 @@ sr_shmsub_change_notify_change_done(struct sr_mod_info_s *mod_info, const char * - sr_rwunlock(&nsub->sub_shm->lock, 0, SR_LOCK_WRITE, cid, __func__); - nsub->lock = SR_LOCK_NONE; - -- /* we do not care about an error */ -- sr_errinfo_free(&nsub->cb_err_info); -- - SR_LOG_INF("EV ORIGIN: \"%s\" \"%s\" ID %" PRIu32 " priority %" PRIu32 " succeeded.", - nsub->mod->ly_mod->name, sr_ev2str(SR_SUB_EV_DONE), nsub->mod->request_id, nsub->cur_priority); - -+ /* -+ * unexpected critical error, merge and cleanup, let -+ * sysrepocfg caller handle undefined system state. -+ */ -+ if (nsub->cb_err_info) { -+ sr_errinfo_merge(cb_err_info, nsub->cb_err_info); -+ nsub->cb_err_info = NULL; -+ goto cleanup; -+ } -+ - nsub->pending_event = 0; - } - } while (1); -@@ -3301,7 +3308,7 @@ sr_shmsub_change_listen_check_update_edit(sr_session_ctx_t *ev_sess, const char - sr_error_info_t * - sr_shmsub_change_listen_process_module_events(struct modsub_change_s *change_subs, sr_conn_ctx_t *conn) - { -- sr_error_info_t *err_info = NULL; -+ sr_error_info_t *err_info = NULL, *err_tmp; - uint32_t i, data_len = 0, valid_subscr_count; - char *data = NULL, *shm_data_ptr; - int ret = SR_ERR_OK, filter_valid; -@@ -3429,6 +3436,11 @@ process_event: - } - break; - } -+ } else if (sub_info.event == SR_SUB_EV_DONE) { -+ if (ret && err_code == SR_ERR_OK) { -+ /* unexpected, callback actually failed, save for later. */ -+ err_code = ret; -+ } - } - - /* subscription processed this event */ -@@ -3470,6 +3482,11 @@ process_event: - } - break; - case SR_SUB_EV_DONE: -+ if (err_code) { -+ /* prepare unexepected error from session to be written to SHM */ -+ sr_errinfo_new(&err_info, err_code, "Oups, error detected in SR_EV_DONE"); -+ } -+ break; - case SR_SUB_EV_ABORT: - /* nothing to do */ - break; -@@ -3489,14 +3506,17 @@ process_event: - - /* SUB WRITE URGE LOCK */ - if (sr_shmsub_change_listen_relock(multi_sub_shm, SR_LOCK_WRITE_URGE, &sub_info, change_sub, change_subs->module_name, -- ret, filter_valid, ev_sess, &err_info)) { -+ ret, filter_valid, ev_sess, &err_tmp)) { -+ if (err_tmp) -+ err_info = err_tmp; - goto cleanup; - } - sub_lock = SR_LOCK_WRITE_URGE; - - /* finish event */ -- if ((err_info = sr_shmsub_multi_listen_write_event(multi_sub_shm, valid_subscr_count, err_code, &shm_data_sub, data, -+ if ((err_tmp = sr_shmsub_multi_listen_write_event(multi_sub_shm, valid_subscr_count, err_code, &shm_data_sub, data, - data_len, change_subs->module_name, err_code ? "fail" : "success"))) { -+ err_info = err_tmp; - goto cleanup; - } - -@@ -4025,7 +4045,7 @@ finish_iter: - sr_errinfo_free(&cb_err_info); - - /* publish "done" event */ -- if ((err_info = sr_shmsub_change_notify_change_done(&mod_info, NULL, NULL, SR_CHANGE_CB_TIMEOUT))) { -+ if ((err_info = sr_shmsub_change_notify_change_done(&mod_info, NULL, NULL, SR_CHANGE_CB_TIMEOUT, &cb_err_info))) { - goto cleanup_unlock; - } - -diff --git a/src/shm_sub.h b/src/shm_sub.h -index 3056e4c5..460ad927 100644 ---- a/src/shm_sub.h -+++ b/src/shm_sub.h -@@ -144,7 +144,7 @@ sr_error_info_t *sr_shmsub_change_notify_change(struct sr_mod_info_s *mod_info, - * @return err_info, NULL on success. - */ - sr_error_info_t *sr_shmsub_change_notify_change_done(struct sr_mod_info_s *mod_info, const char *orig_name, -- const void *orig_data, uint32_t timeout_ms); -+ const void *orig_data, uint32_t timeout_ms, sr_error_info_t **cb_err_info); - - /** - * @brief Notify about (generate) a change "abort" event. -diff --git a/src/sysrepo.c b/src/sysrepo.c -index 460a8c2f..6d0bf76d 100644 ---- a/src/sysrepo.c -+++ b/src/sysrepo.c -@@ -3874,7 +3874,7 @@ store: - } - - /* publish "done" event, all changes were applied */ -- if ((err_info = sr_shmsub_change_notify_change_done(mod_info, orig_name, orig_data, timeout_ms))) { -+ if ((err_info = sr_shmsub_change_notify_change_done(mod_info, orig_name, orig_data, timeout_ms, cb_err_info))) { - goto cleanup; - } - --- -2.34.1 - diff --git a/patches/sysrepo/2.2.170/0004-Allow-to-copy-from-factory-default.patch b/patches/sysrepo/2.2.170/0004-Allow-to-copy-from-factory-default.patch deleted file mode 100644 index e93ae9dcc..000000000 --- a/patches/sysrepo/2.2.170/0004-Allow-to-copy-from-factory-default.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 86674fd6a63f08cb4f3649fa5cb34605979a1d27 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= -Date: Wed, 8 May 2024 17:00:50 +0200 -Subject: [PATCH 4/5] Allow to copy from factory default -Organization: Addiva Elektronik - -Signed-off-by: Tobias Waldekranz ---- - src/sysrepo.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sysrepo.c b/src/sysrepo.c -index 6d0bf76d..2eac2858 100644 ---- a/src/sysrepo.c -+++ b/src/sysrepo.c -@@ -4122,7 +4122,7 @@ sr_copy_config(sr_session_ctx_t *session, const char *module_name, sr_datastore_ - struct sr_mod_info_s mod_info; - const struct lys_module *ly_mod = NULL; - -- SR_CHECK_ARG_APIRET(!session || !SR_IS_CONVENTIONAL_DS(src_datastore) || !SR_IS_CONVENTIONAL_DS(session->ds), -+ SR_CHECK_ARG_APIRET(!session || (!SR_IS_CONVENTIONAL_DS(src_datastore) && (src_datastore != SR_DS_FACTORY_DEFAULT)) || !SR_IS_CONVENTIONAL_DS(session->ds), - session, err_info); - - if (src_datastore == session->ds) { --- -2.34.1 - diff --git a/patches/sysrepo/2.2.170/0005-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch b/patches/sysrepo/2.2.170/0005-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch deleted file mode 100644 index 12709bfe8..000000000 --- a/patches/sysrepo/2.2.170/0005-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch +++ /dev/null @@ -1,178 +0,0 @@ -From 600c6904a0687f0d237ccec750ae937cd76b9e54 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= -Date: Mon, 6 May 2024 14:49:32 +0200 -Subject: [PATCH 5/5] Add -z switch to sysrepoctl to install factory config - from a json file -Organization: Addiva Elektronik - -This to be able to load the yang modules during build time instead on boot. - -Signed-off-by: Tobias Waldekranz ---- - src/executables/sysrepoctl.c | 20 +++++++++++++-- - src/lyd_mods.h | 7 ++++++ - src/sysrepo.c | 49 ++++++++++++++++++++++++++++++++++++ - src/sysrepo.h | 10 +++++++- - 4 files changed, 83 insertions(+), 3 deletions(-) - -diff --git a/src/executables/sysrepoctl.c b/src/executables/sysrepoctl.c -index b9680551..4cdba6a0 100644 ---- a/src/executables/sysrepoctl.c -+++ b/src/executables/sysrepoctl.c -@@ -647,6 +647,7 @@ main(int argc, char **argv) - {"uninstall", required_argument, NULL, 'u'}, - {"change", required_argument, NULL, 'c'}, - {"update", required_argument, NULL, 'U'}, -+ {"factory-install", no_argument, NULL, 'z'}, - {"plugin-list", no_argument, NULL, 'L'}, - {"plugin-install", required_argument, NULL, 'P'}, - {"search-dirs", required_argument, NULL, 's'}, -@@ -671,7 +672,7 @@ main(int argc, char **argv) - - /* process options */ - opterr = 0; -- while ((opt = getopt_long(argc, argv, "hVli:u:c:U:LP:s:e:d:r:o:g:p:D:m:I:fv:", options, NULL)) != -1) { -+ while ((opt = getopt_long(argc, argv, "hVli:u:c:U:LP:s:e:d:r:o:g:p:D:m:I:fv:z:", options, NULL)) != -1) { - switch (opt) { - case 'h': - /* help */ -@@ -863,6 +864,15 @@ main(int argc, char **argv) - goto cleanup; - } - break; -+ case 'z': -+ if (operation) { -+ error_print(0, "Operation already specified"); -+ goto cleanup; -+ } -+ /* init-data */ -+ operation = 'z'; -+ data_path = optarg; -+ break; - case 'I': - /* init-data */ - if (operation == 'i') { -@@ -922,9 +932,15 @@ main(int argc, char **argv) - goto cleanup; - } - } -- - /* perform the operation */ - switch (operation) { -+ case 'z': -+ /* Install factory config for built-in modules */ -+ if ((r = sr_install_factory_config(conn, data_path))) { -+ error_print(r, "Failed to install factory config"); -+ goto cleanup; -+ } -+ break; - case 'l': - /* list */ - if ((r = srctl_list(conn))) { -diff --git a/src/lyd_mods.h b/src/lyd_mods.h -index 8f9cbac6..0a1ce2b4 100644 ---- a/src/lyd_mods.h -+++ b/src/lyd_mods.h -@@ -102,4 +102,11 @@ sr_error_info_t *sr_lydmods_change_chng_feature(const struct ly_ctx *ly_ctx, con - sr_error_info_t *sr_lydmods_change_chng_replay_support(const struct lys_module *ly_mod, int enable, - struct ly_set *mod_set, sr_conn_ctx_t *conn, struct lyd_node **sr_mods); - -+/** -+ * @brief Add factory default data to built-in modules -+ * @param[in] ly_ctx Context to use for parsing SR data. -+ * @return err_info, NULL on success. -+ */ -+sr_error_info_t *sr_lydmods_create_data(const struct ly_ctx *ly_ctx); -+ - #endif -diff --git a/src/sysrepo.c b/src/sysrepo.c -index 2eac2858..ce2fa822 100644 ---- a/src/sysrepo.c -+++ b/src/sysrepo.c -@@ -1569,6 +1569,55 @@ cleanup: - return sr_api_ret(NULL, err_info); - } - -+API int -+sr_install_factory_config(sr_conn_ctx_t *conn, const char *factory_file) { -+ sr_error_info_t *err_info = NULL; -+ struct ly_ctx *new_ctx = NULL; -+ struct lyd_node *sr_mods = NULL; -+ int initialized = 0; -+ struct lyd_node *mod_data = NULL; -+ struct sr_data_update_s data_info = {0}; -+ -+ /* create new temporary context */ -+ if ((err_info = sr_ly_ctx_init(conn, &new_ctx))) { -+ goto cleanup; -+ } -+ -+ /* use temporary context to load current modules */ -+ if ((err_info = sr_shmmod_ctx_load_modules(SR_CONN_MOD_SHM(conn), new_ctx, NULL))) { -+ goto cleanup; -+ } -+ -+ if ((err_info = sr_lyd_parse_data(new_ctx, NULL, factory_file, LYD_JSON, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, &mod_data))) { -+ goto cleanup; -+ } -+ if ((err_info = sr_lyd_dup(mod_data, NULL, LYD_DUP_RECURSIVE, 1, &data_info.new.start))) { -+ goto cleanup; -+ } -+ if ((err_info = sr_lyd_dup(mod_data, NULL, LYD_DUP_RECURSIVE, 1, &data_info.new.run))) { -+ goto cleanup; -+ } -+ /* parse SR mods */ -+ if ((err_info = sr_lydmods_parse(new_ctx, conn, &initialized, &sr_mods))) { -+ goto cleanup; -+ } -+ data_info.new.fdflt = mod_data; -+ mod_data = NULL; -+ if ((err_info = sr_lycc_store_data_if_differ(conn, new_ctx, sr_mods, &data_info))) { -+ goto cleanup; -+ } -+ -+ /* update content ID and safely switch the context */ -+ SR_CONN_MAIN_SHM(conn)->content_id = ly_ctx_get_modules_hash(new_ctx); -+ sr_conn_ctx_switch(conn, &new_ctx, NULL); -+cleanup: -+ ly_ctx_destroy(new_ctx); -+ sr_lycc_update_data_clear(&data_info); -+ lyd_free_siblings(sr_mods); -+ lyd_free_siblings(mod_data); -+ return sr_api_ret(NULL, err_info); -+} -+ - API int - sr_install_module(sr_conn_ctx_t *conn, const char *schema_path, const char *search_dirs, const char **features) - { -diff --git a/src/sysrepo.h b/src/sysrepo.h -index 0dcaedc4..46c8317e 100644 ---- a/src/sysrepo.h -+++ b/src/sysrepo.h -@@ -34,7 +34,6 @@ extern "C" { - //////////////////////////////////////////////////////////////////////////////// - // Logging API - //////////////////////////////////////////////////////////////////////////////// -- - /** - * @defgroup log_api Logging API - * @{ -@@ -706,6 +705,15 @@ int sr_get_module_info(sr_conn_ctx_t *conn, sr_data_t **sysrepo_data); - */ - int sr_is_module_internal(const struct lys_module *ly_mod); - -+/** -+ * @brief Install factory config for built-in modules from a JSON file -+ * -+ * @param[in] conn Connection to use. -+ * @param[in] conn File containing factory default data in JSON format -+ * @return Error code (::SR_ERR_OK on success). -+ */ -+int sr_install_factory_config(sr_conn_ctx_t *conn, const char *factory_file); -+ - /** @} schema */ - - //////////////////////////////////////////////////////////////////////////////// --- -2.34.1 -