From adaaaa1229fa011115fcf815ec45c4968ee5df87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 13 May 2024 13:10:30 +0200 Subject: [PATCH 01/20] Remove ietf-netconf-acm@2018-02-14.yang Provided by libnetconf --- .../yang/ietf-netconf-acm@2018-02-14.yang | 464 ------------------ 1 file changed, 464 deletions(-) delete mode 100644 src/confd/yang/ietf-netconf-acm@2018-02-14.yang diff --git a/src/confd/yang/ietf-netconf-acm@2018-02-14.yang b/src/confd/yang/ietf-netconf-acm@2018-02-14.yang deleted file mode 100644 index bf4855faf0..0000000000 --- a/src/confd/yang/ietf-netconf-acm@2018-02-14.yang +++ /dev/null @@ -1,464 +0,0 @@ -module ietf-netconf-acm { - - namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-acm"; - - prefix nacm; - - import ietf-yang-types { - prefix yang; - } - - organization - "IETF NETCONF (Network Configuration) Working Group"; - - contact - "WG Web: - WG List: - - Author: Andy Bierman - - - Author: Martin Bjorklund - "; - - description - "Network Configuration Access Control Model. - - Copyright (c) 2012 - 2018 IETF Trust and the persons - identified as authors of the code. All rights reserved. - - Redistribution and use in source and binary forms, with or - without modification, is permitted pursuant to, and subject - to the license terms contained in, the Simplified BSD - License set forth in Section 4.c of the IETF Trust's - Legal Provisions Relating to IETF Documents - (https://trustee.ietf.org/license-info). - - This version of this YANG module is part of RFC 8341; see - the RFC itself for full legal notices."; - - revision "2018-02-14" { - description - "Added support for YANG 1.1 actions and notifications tied to - data nodes. Clarified how NACM extensions can be used by - other data models."; - reference - "RFC 8341: Network Configuration Access Control Model"; - } - - revision "2012-02-22" { - description - "Initial version."; - reference - "RFC 6536: Network Configuration Protocol (NETCONF) - Access Control Model"; - } - - /* - * Extension statements - */ - - extension default-deny-write { - description - "Used to indicate that the data model node - represents a sensitive security system parameter. - - If present, the NETCONF server will only allow the designated - 'recovery session' to have write access to the node. An - explicit access control rule is required for all other users. - - If the NACM module is used, then it must be enabled (i.e., - /nacm/enable-nacm object equals 'true'), or this extension - is ignored. - - The 'default-deny-write' extension MAY appear within a data - definition statement. It is ignored otherwise."; - } - - extension default-deny-all { - description - "Used to indicate that the data model node - controls a very sensitive security system parameter. - - If present, the NETCONF server will only allow the designated - 'recovery session' to have read, write, or execute access to - the node. An explicit access control rule is required for all - other users. - - If the NACM module is used, then it must be enabled (i.e., - /nacm/enable-nacm object equals 'true'), or this extension - is ignored. - - The 'default-deny-all' extension MAY appear within a data - definition statement, 'rpc' statement, or 'notification' - statement. It is ignored otherwise."; - } - - /* - * Derived types - */ - - typedef user-name-type { - type string { - length "1..max"; - } - description - "General-purpose username string."; - } - - typedef matchall-string-type { - type string { - pattern '\*'; - } - description - "The string containing a single asterisk '*' is used - to conceptually represent all possible values - for the particular leaf using this data type."; - } - - typedef access-operations-type { - type bits { - bit create { - description - "Any protocol operation that creates a - new data node."; - } - bit read { - description - "Any protocol operation or notification that - returns the value of a data node."; - } - bit update { - description - "Any protocol operation that alters an existing - data node."; - } - bit delete { - description - "Any protocol operation that removes a data node."; - } - bit exec { - description - "Execution access to the specified protocol operation."; - } - } - description - "Access operation."; - } - - typedef group-name-type { - type string { - length "1..max"; - pattern '[^\*].*'; - } - description - "Name of administrative group to which - users can be assigned."; - } - - typedef action-type { - type enumeration { - enum permit { - description - "Requested action is permitted."; - } - enum deny { - description - "Requested action is denied."; - } - } - description - "Action taken by the server when a particular - rule matches."; - } - - typedef node-instance-identifier { - type yang:xpath1.0; - description - "Path expression used to represent a special - data node, action, or notification instance-identifier - string. - - A node-instance-identifier value is an - unrestricted YANG instance-identifier expression. - All the same rules as an instance-identifier apply, - except that predicates for keys are optional. If a key - predicate is missing, then the node-instance-identifier - represents all possible server instances for that key. - - This XML Path Language (XPath) expression is evaluated in the - following context: - - o The set of namespace declarations are those in scope on - the leaf element where this type is used. - - o The set of variable bindings contains one variable, - 'USER', which contains the name of the user of the - current session. - - o The function library is the core function library, but - note that due to the syntax restrictions of an - instance-identifier, no functions are allowed. - - o The context node is the root node in the data tree. - - The accessible tree includes actions and notifications tied - to data nodes."; - } - - /* - * Data definition statements - */ - - container nacm { - nacm:default-deny-all; - - description - "Parameters for NETCONF access control model."; - - leaf enable-nacm { - type boolean; - default "true"; - description - "Enables or disables all NETCONF access control - enforcement. If 'true', then enforcement - is enabled. If 'false', then enforcement - is disabled."; - } - - leaf read-default { - type action-type; - default "permit"; - description - "Controls whether read access is granted if - no appropriate rule is found for a - particular read request."; - } - - leaf write-default { - type action-type; - default "deny"; - description - "Controls whether create, update, or delete access - is granted if no appropriate rule is found for a - particular write request."; - } - - leaf exec-default { - type action-type; - default "permit"; - description - "Controls whether exec access is granted if no appropriate - rule is found for a particular protocol operation request."; - } - - leaf enable-external-groups { - type boolean; - default "true"; - description - "Controls whether the server uses the groups reported by the - NETCONF transport layer when it assigns the user to a set of - NACM groups. If this leaf has the value 'false', any group - names reported by the transport layer are ignored by the - server."; - } - - leaf denied-operations { - type yang:zero-based-counter32; - config false; - mandatory true; - description - "Number of times since the server last restarted that a - protocol operation request was denied."; - } - - leaf denied-data-writes { - type yang:zero-based-counter32; - config false; - mandatory true; - description - "Number of times since the server last restarted that a - protocol operation request to alter - a configuration datastore was denied."; - } - - leaf denied-notifications { - type yang:zero-based-counter32; - config false; - mandatory true; - description - "Number of times since the server last restarted that - a notification was dropped for a subscription because - access to the event type was denied."; - } - - container groups { - description - "NETCONF access control groups."; - - list group { - key name; - - description - "One NACM group entry. This list will only contain - configured entries, not any entries learned from - any transport protocols."; - - leaf name { - type group-name-type; - description - "Group name associated with this entry."; - } - - leaf-list user-name { - type user-name-type; - description - "Each entry identifies the username of - a member of the group associated with - this entry."; - } - } - } - - list rule-list { - key name; - ordered-by user; - description - "An ordered collection of access control rules."; - - leaf name { - type string { - length "1..max"; - } - description - "Arbitrary name assigned to the rule-list."; - } - leaf-list group { - type union { - type matchall-string-type; - type group-name-type; - } - description - "List of administrative groups that will be - assigned the associated access rights - defined by the 'rule' list. - - The string '*' indicates that all groups apply to the - entry."; - } - - list rule { - key name; - ordered-by user; - description - "One access control rule. - - Rules are processed in user-defined order until a match is - found. A rule matches if 'module-name', 'rule-type', and - 'access-operations' match the request. If a rule - matches, the 'action' leaf determines whether or not - access is granted."; - - leaf name { - type string { - length "1..max"; - } - description - "Arbitrary name assigned to the rule."; - } - - leaf module-name { - type union { - type matchall-string-type; - type string; - } - default "*"; - description - "Name of the module associated with this rule. - - This leaf matches if it has the value '*' or if the - object being accessed is defined in the module with the - specified module name."; - } - choice rule-type { - description - "This choice matches if all leafs present in the rule - match the request. If no leafs are present, the - choice matches all requests."; - case protocol-operation { - leaf rpc-name { - type union { - type matchall-string-type; - type string; - } - description - "This leaf matches if it has the value '*' or if - its value equals the requested protocol operation - name."; - } - } - case notification { - leaf notification-name { - type union { - type matchall-string-type; - type string; - } - description - "This leaf matches if it has the value '*' or if its - value equals the requested notification name."; - } - } - - case data-node { - leaf path { - type node-instance-identifier; - mandatory true; - description - "Data node instance-identifier associated with the - data node, action, or notification controlled by - this rule. - - Configuration data or state data - instance-identifiers start with a top-level - data node. A complete instance-identifier is - required for this type of path value. - - The special value '/' refers to all possible - datastore contents."; - } - } - } - - leaf access-operations { - type union { - type matchall-string-type; - type access-operations-type; - } - default "*"; - description - "Access operations associated with this rule. - - This leaf matches if it has the value '*' or if the - bit corresponding to the requested operation is set."; - } - - leaf action { - type action-type; - mandatory true; - description - "The access control action associated with the - rule. If a rule has been determined to match a - particular request, then this object is used - to determine whether to permit or deny the - request."; - } - - leaf comment { - type string; - description - "A textual description of the access rule."; - } - } - } - } -} From 775fc0b1519fc8c1de46bb26250fb275c5ed2ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 6 May 2024 19:38:16 +0200 Subject: [PATCH 02/20] Build in required modules on buildtime This to hopefully speed up boot, do as little as possible during boot. * New modules needs to be added to src/confd/scripts/setup.sh * Permission needs to be changed post-build for YANG files, see CONFD_PERMISSIONS in confd.mk --- package/confd/confd.mk | 360 +++++++++++++++++- src/confd/bin/bootstrap | 109 +----- src/confd/bin/gen-hostkeys | 5 +- src/confd/scripts/setup.sh | 183 +++++++++ .../share/factory.d/10-netconf-server.json | 42 +- src/confd/src/ietf-interfaces.c | 5 - src/confd/src/infix-containers.c | 9 - src/confd/src/infix-factory.c | 10 - src/klish-plugin-infix/src/infix.c | 2 +- 9 files changed, 575 insertions(+), 150 deletions(-) create mode 100755 src/confd/scripts/setup.sh diff --git a/package/confd/confd.mk b/package/confd/confd.mk index 7a9ed05837..56e1afc638 100644 --- a/package/confd/confd.mk +++ b/package/confd/confd.mk @@ -11,8 +11,12 @@ CONFD_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/confd CONFD_LICENSE = BSD-3-Clause CONFD_LICENSE_FILES = LICENSE CONFD_REDISTRIBUTE = NO -CONFD_DEPENDENCIES = augeas jansson libite sysrepo libsrx libglib2 +CONFD_DEPENDENCIES = host-sysrepo netopeer2 augeas jansson libite sysrepo libsrx libglib2 CONFD_AUTORECONF = YES + +CONFD_SYSREPO_SHM_PREFIX = sr_buildroot$(subst /,_,$(CONFIG_DIR))_netopeer2 + +echo "prefix: $(CONFD_SYSREPO_SHM_PREFIX)" define CONFD_CONF_ENV CFLAGS="$(INFIX_CFLAGS)" endef @@ -23,6 +27,11 @@ else CONFD_CONF_OPTS += --disable-containers endif + +CONFD_MAKE_ENV = \ + SYSREPOCTL_EXECUTABLE=$(HOST_DIR)/bin/sysrepoctl \ + SYSREPO_SHM_PREFIX=$(CONFD_SYSREPO_SHM_PREFIX) + define CONFD_INSTALL_EXTRA cp $(CONFD_PKGDIR)/confd.conf $(FINIT_D)/available/ ln -sf ../available/confd.conf $(FINIT_D)/enabled/confd.conf @@ -30,6 +39,353 @@ define CONFD_INSTALL_EXTRA mkdir -p $(TARGET_DIR)/etc/avahi/services cp $(CONFD_PKGDIR)/avahi.service $(TARGET_DIR)/etc/avahi/services/netconf.service endef -CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_EXTRA +define CONFD_INSTALL_YANG_MODULES + USE_CONTAINERS=$(BR2_PACKAGE_PODMAN) SYSREPO_SHM_PREFIX=$(CONFD_SYSREPO_SHM_PREFIX) SYSREPOCTL_EXECUTABLE="$(HOST_DIR)/bin/sysrepoctl" SYSREPOCFG_EXECUTABLE="$(HOST_DIR)/bin/sysrepocfg" SEARCH_PATH="$(TARGET_DIR)/usr/share/yang/modules/confd/" $(@D)/scripts/setup.sh +endef +define CONFD_PERMISSIONS +# generated using chatGPT +/etc/sysrepo/data/iana-ssh-mac-algs.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-nmda.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-with-defaults.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-acm.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/libnetconf2-netconf-server.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-acm.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-factory-default.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-factory-default.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-tls-cipher-suite-algs.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-client.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-keystore.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-dot1q-types.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-ethernet-interface.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-monitoring.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tls-common.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tls-server.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-system.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-nmda.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-server.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-system.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-factory-default.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-key-exchange-algs.startup f 660 root wheel - - - - - +/etc/sysrepo/data/libnetconf2-netconf-server.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-server.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-routing.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-datastores.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-interfaces.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-network-instance.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-server.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-client.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-routing.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-routing.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-schema-mount.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-crypto-types.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ip.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-crypto-types.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-services.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-dot1ab-lldp.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-lldp.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-schema-mount.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-factory-default.startup f 660 root wheel - - - - - +/etc/sysrepo/data/notifications.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-ip.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-plugind.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-hardware.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-subscribed-notifications.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-key-chain.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ipv6-unicast-routing.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-keystore.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-monitoring.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-lldp.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-interfaces.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-system.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-schema-mount.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-dot1q-types.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-if-type.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-ethernet-interface.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-library.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-with-defaults.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-encryption-algs.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-interfaces.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-routing.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-truststore.startup f 660 root wheel - - - - - +/etc/sysrepo/data/iana-hardware.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-crypt-hash.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-dot1q-types.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-hardware.startup f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-plugind.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ssh-common.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-subscribed-notifications.startup f 660 root wheel - - - - - +/etc/sysrepo/data/iana-if-type.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-if-type.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ipv4-unicast-routing.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-with-defaults.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-dot1q-types.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-library.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-common.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-subscribed-notifications.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-interfaces.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ipv4-unicast-routing.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-monitoring.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-public-key-algs.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-plugind.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-containers.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-hardware.startup f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-key-exchange-algs.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-dot1ab-lldp.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-ethernet-interface.startup f 660 root wheel - - - - - +/etc/sysrepo/data/notifications.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-routing.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-ethernet-interface.startup f 660 root wheel - - - - - +/etc/sysrepo/data/iana-timezones.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-datastores.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-x509-cert-to-name.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-factory-default.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-dot1ab-lldp.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-acm.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-factory-default.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-containers.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/iana-tls-cipher-suite-algs.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-push.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-common.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-factory-default.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-if-type.startup f 660 root wheel - - - - - +/etc/sysrepo/data/nc-notifications.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tls-server.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/yang.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ip.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-hardware.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-push.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/notifications.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-notifications.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-public-key-algs.startup f 660 root wheel - - - - - +/etc/sysrepo/data/nc-notifications.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-interfaces.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-factory-default.startup f 660 root wheel - - - - - +/etc/sysrepo/data/iana-tls-cipher-suite-algs.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-hardware.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-encryption-algs.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-crypt-hash.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-network-instance.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-crypto-types.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-datastores.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-hardware.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-monitoring.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-datastores.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-hardware.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-ethernet-interface.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/yang.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-notifications.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ssh-common.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tls-common.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-ethernet-interface.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-mac-algs.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-server.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-services.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-x509-cert-to-name.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/iana-timezones.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-datastores.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/libnetconf2-netconf-server.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tls-common.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-library.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-notifications.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-server.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-mac-algs.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-monitoring.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-server.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-crypto-types.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-public-key-algs.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-shell-type.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-routing.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-nmda.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-monitoring.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-truststore.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-shell-type.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-ethernet-interface.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/iana-tls-cipher-suite-algs.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-interfaces.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tls-server.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ipv6-unicast-routing.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-lldp.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-network-instance.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-ip.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/nc-notifications.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-client.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-routing.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ssh-common.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-keystore.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-dot1ab-lldp.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-notifications.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-client.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-origin.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-system.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-library.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-factory-default.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-timezones.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-subscribed-notifications.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-key-chain.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ipv4-unicast-routing.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/iana-crypt-hash.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-encryption-algs.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-notifications.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/iana-hardware.startup f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-encryption-algs.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ospf.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-key-exchange-algs.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-nmda.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-timezones.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ip.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-containers.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-ethernet-interface.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-interfaces.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-origin.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/libnetconf2-netconf-server.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-push.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-nmda.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ssh-common.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-monitoring.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ip.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-acm.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-if-type.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tls-common.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-dhcp-client.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-hardware.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-system.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ssh-common.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-monitoring.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tls-server.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-ip.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-with-defaults.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-system.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ssh-server.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ipv4-unicast-routing.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-ethernet-interface.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/yang.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-hardware.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-x509-cert-to-name.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-common.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-if-type.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-server.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-origin.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-key-chain.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-common.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-system.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-x509-cert-to-name.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/nc-notifications.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-keystore.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/iana-hardware.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-common.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-containers.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-server.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-interfaces.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ssh-server.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-key-chain.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-truststore.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-factory-default.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-if-type.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tls-server.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-keystore.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-routing.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ssh-server.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-plugind.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-client.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-shell-type.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-lldp.startup f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-mac-algs.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-interfaces.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-services.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-subscribed-notifications.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-if-type.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-factory-default.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-public-key-algs.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-if-type.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-mac-algs.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-factory-default.startup f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-monitoring.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tls-common.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-hardware.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-dhcp-client.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-system.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-if-type.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-truststore.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-schema-mount.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-dhcp-client.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-network-instance.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-tcp-server.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ospf.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-truststore.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-crypt-hash.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-routing.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ipv6-unicast-routing.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/yang.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-routing.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/notifications.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-ip.startup f 660 root wheel - - - - - +/etc/sysrepo/data/libnetconf2-netconf-server.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-schema-mount.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-factory-default.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/yang.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-dot1ab-lldp.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-monitoring.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-key-chain.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-hardware.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ip.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-dhcp-client.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ipv6-unicast-routing.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-timezones.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-system.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-network-instance.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-hardware.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-ip.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ipv6-unicast-routing.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-services.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-origin.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-library.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ospf.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-acm.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-push.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-containers.startup f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-encryption-algs.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ssh-server.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-ethernet-interface.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-services.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ieee802-dot1q-types.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-origin.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-public-key-algs.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ospf.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-shell-type.startup f 660 root wheel - - - - - +/etc/sysrepo/data/iana-crypt-hash.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-interfaces.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-yang-push.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/notifications.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/nc-notifications.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-server.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ospf.startup f 660 root wheel - - - - - +/etc/sysrepo/data/infix-lldp.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-x509-cert-to-name.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-factory-default.factory-default f 660 root wheel - - - - - +/etc/sysrepo/data/infix-shell-type.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-key-exchange-algs.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-tls-cipher-suite-algs.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-system.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-netconf-with-defaults.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/iana-ssh-key-exchange-algs.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-factory-default.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/infix-dhcp-client.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ipv4-unicast-routing.running.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-ssh-server.operational.perm f 660 root wheel - - - - - +/etc/sysrepo/data/sysrepo-plugind.candidate.perm f 660 root wheel - - - - - +/etc/sysrepo/data/ietf-crypto-types.startup f 660 root wheel - - - - - +endef +define CONFD_CLEANUP + rm -f /dev/shm/$(NETOPEER2_SYSREPO_SHM_PREFIX)* +endef +CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_EXTRA +CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_YANG_MODULES +CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_CLEANUP $(eval $(autotools-package)) diff --git a/src/confd/bin/bootstrap b/src/confd/bin/bootstrap index 3aa453b5a3..aa710349e3 100755 --- a/src/confd/bin/bootstrap +++ b/src/confd/bin/bootstrap @@ -148,111 +148,23 @@ if [ -n "$TESTING" ]; then exit 0 fi -# Drop all pre-initialized data from netopeer2 install, then re-create -# with required netopeer2 models, sysrepo implicitly installs its own, -# and then we initialize it all with our factory defaults. -rm -rf /etc/sysrepo/* /dev/shm/sr_* mkdir -p /etc/sysrepo/ if [ -f "$FACTORY_CFG" ]; then cp "$FACTORY_CFG" "$INIT_DATA" else cp "$FAILURE_CFG" "$INIT_DATA" fi +rc=$? -sysrepoctl -s $SEARCH \ - -i ietf-system@2014-08-06.yang -g wheel -p 0660 \ - -e authentication \ - -e local-users \ - -e ntp \ - -e ntp-udp-port \ - -e timezone-name \ - -i iana-timezones@2013-11-19.yang -g wheel -p 0660 \ - -i nc-notifications@2008-07-14.yang -g wheel -p 0660 \ - -i notifications@2008-07-14.yang -g wheel -p 0660 \ - -i ietf-keystore@2019-07-02.yang -g wheel -p 0660 \ - -e keystore-supported \ - -e local-definitions-supported \ - -e key-generation \ - -i ietf-truststore@2019-07-02.yang -g wheel -p 0660 \ - -e truststore-supported \ - -e x509-certificates \ - -i ietf-tcp-common@2019-07-02.yang -g wheel -p 0660 \ - -e keepalives-supported \ - -i ietf-ssh-server@2019-07-02.yang -g wheel -p 0660 \ - -e local-client-auth-supported \ - -i ietf-tls-server@2019-07-02.yang -g wheel -p 0660 \ - -e local-client-auth-supported \ - -i ietf-netconf-server@2019-07-02.yang -g wheel -p 0660 \ - -e ssh-listen \ - -e tls-listen \ - -e ssh-call-home \ - -e tls-call-home \ - -i ietf-interfaces@2018-02-20.yang -g wheel -p 0660 \ - -e if-mib \ - -i ietf-ip@2018-02-22.yang -g wheel -p 0660 \ - -e ipv6-privacy-autoconf \ - -i ietf-network-instance@2019-01-21.yang -g wheel -p 0660 \ - -i ietf-netconf-monitoring@2010-10-04.yang -g wheel -p 0660 \ - -i ietf-netconf-nmda@2019-01-07.yang -g wheel -p 0660 \ - -e origin \ - -e with-defaults \ - -i ietf-subscribed-notifications@2019-09-09.yang \ - -g wheel -p 0660 \ - -e encode-xml \ - -e replay \ - -e subtree \ - -e xpath \ - -i ietf-yang-push@2019-09-09.yang -g wheel -p 0660 \ - -e on-change \ - -i ietf-routing@2018-03-13.yang -g wheel -p 0660 \ - -i ietf-ipv6-unicast-routing@2018-03-13.yang -g wheel -p 0660 \ - -i ietf-ipv4-unicast-routing@2018-03-13.yang -g wheel -p 0660 \ - -i ietf-ospf@2022-10-19.yang -g wheel -p 0660 \ - -e bfd \ - -e explicit-router-id \ - -i iana-if-type@2023-01-26.yang -g wheel -p 0660 \ - -i iana-hardware@2018-03-13.yang -g wheel -p 0660 \ - -i ietf-hardware@2018-03-13.yang -g wheel -p 0660 \ - -e hardware-state \ - -i infix-hardware@2024-04-25.yang -g wheel -p 0660 \ - -i ieee802-dot1q-types@2022-10-29.yang -g wheel -p 0660 \ - -i infix-ip@2023-09-14.yang -g wheel -p 0660 \ - -i infix-if-type@2024-01-29.yang -g wheel -p 0660 \ - -i infix-routing@2024-03-06.yang -g wheel -p 0660 \ - -i infix-interfaces@2024-01-15.yang -g wheel -p 0660 \ - -e vlan-filtering \ - -i ieee802-dot1ab-lldp@2022-03-15.yang -g wheel -p 0660 \ - -i infix-lldp@2023-08-23.yang -g wheel -p 0660 \ - -i infix-dhcp-client@2024-04-12.yang -g wheel -p 0660 \ - -i infix-shell-type@2023-08-21.yang -g wheel -p 0660 \ - -i infix-system@2024-04-12.yang -g wheel -p 0660 \ - -i infix-services@2024-04-08.yang -g wheel -p 0660 \ - -i ieee802-ethernet-interface@2019-06-21.yang -g wheel -p 0660 \ - -i infix-ethernet-interface@2024-02-27.yang -g wheel -p 0660 \ - -I "${INIT_DATA}" +sysrepoctl -z $INIT_DATA +rc=$? +sudo -u root -g wheel sysrepocfg -f json -I"$INIT_DATA" -d running rc=$? -# Unlike `sysrepoctl -i` the `-c` command requires separate invocations. -# NOTE: we ignore any errors from these at bootstrap since sysrepo may -# already enable some of these feature, resulting in error here. -# Enable features required by netopeer2 -sysrepoctl -c ietf-netconf -g wheel -p 0660 \ - -e writable-running \ - -e candidate \ - -e rollback-on-error \ - -e validate \ - -e startup \ - -e url \ - -e xpath \ - -e confirmed-commit -# Allow wheel group users (admin) to modify NACM and do factory reset -sysrepoctl -c ietf-netconf-acm -g wheel -p 0660 -sysrepoctl -c ietf-factory-default -g wheel -p 0660 -sysrepoctl -c sysrepo-plugind -g wheel -p 0660 - -# On first boot, install factory-config as startup-config. Due to a -# limitation in sysrepo we cannot initialize ietf-netconf-acm, so we -# cheat, see sysrepo#3079 + +#rm $INIT_DATA + +# On first boot, install factory-config as startup-config. chgrp wheel /cfg chmod g+w /cfg if [ ! -f "$STARTUP_CFG" ]; then @@ -260,7 +172,8 @@ if [ ! -f "$STARTUP_CFG" ]; then fi # Clear running-config so we can load startup in the next step -echo "{}" > "$INIT_DATA" -sysrepocfg -f json -I"$INIT_DATA" -d running +temp=$(mktemp) +echo "{}" > $temp +sysrepocfg -f json -I$temp -d running exit $rc diff --git a/src/confd/bin/gen-hostkeys b/src/confd/bin/gen-hostkeys index d7639adfe3..76037057de 100755 --- a/src/confd/bin/gen-hostkeys +++ b/src/confd/bin/gen-hostkeys @@ -18,9 +18,10 @@ cat <conn, "infix-interfaces", "containers"); -#endif - REGISTER_CHANGE(confd->session, "ietf-interfaces", "/ietf-interfaces:interfaces//.", 0, ifchange, confd, &confd->sub); REGISTER_CHANGE(confd->cand, "ietf-interfaces", "/ietf-interfaces:interfaces//.", diff --git a/src/confd/src/infix-containers.c b/src/confd/src/infix-containers.c index 8cb22b4abb..9b99d580a7 100644 --- a/src/confd/src/infix-containers.c +++ b/src/confd/src/infix-containers.c @@ -22,11 +22,6 @@ #define ACTIVE_QUEUE "/var/lib/containers/active" #define LOGGER "logger -t container -p local1.notice" -static const struct srx_module_requirement reqs[] = { - { .dir = YANG_PATH_, .name = MODULE, .rev = "2024-03-27" }, - { NULL } -}; - static int add(const char *name, struct lyd_node *cif) { const char *image = lydx_get_cattr(cif, "image"); @@ -438,10 +433,6 @@ int infix_containers_init(struct confd *confd) { int rc; - rc = srx_require_modules(confd->conn, reqs); - if (rc) - goto fail; - REGISTER_CHANGE(confd->session, MODULE, CFG_XPATH, 0, change, confd, &confd->sub); REGISTER_RPC(confd->session, CFG_XPATH "/container/start", action, NULL, &confd->sub); REGISTER_RPC(confd->session, CFG_XPATH "/container/stop", action, NULL, &confd->sub); diff --git a/src/confd/src/infix-factory.c b/src/confd/src/infix-factory.c index be2396023e..8cecfe6b01 100644 --- a/src/confd/src/infix-factory.c +++ b/src/confd/src/infix-factory.c @@ -15,11 +15,6 @@ #include "core.h" -static const struct srx_module_requirement reqs[] = { - { .dir = YANG_PATH_, .name = "infix-factory-default", .rev = "2023-06-28" }, - { NULL } -}; - static int rpc(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath, const sr_val_t *input, const size_t input_cnt, sr_event_t event, unsigned request_id, sr_val_t **output, size_t *output_cnt, void *priv) @@ -42,11 +37,6 @@ static int rpc(sr_session_ctx_t *session, uint32_t sub_id, const char *xpath, int infix_factory_init(struct confd *confd) { int rc; - - rc = srx_require_modules(confd->conn, reqs); - if (rc) - goto fail; - REGISTER_RPC(confd->session, "/infix-factory-default:factory-default", rpc, NULL, &confd->fsub); return SR_ERR_OK; fail: diff --git a/src/klish-plugin-infix/src/infix.c b/src/klish-plugin-infix/src/infix.c index 1c523bcf18..f2d9265f2c 100644 --- a/src/klish-plugin-infix/src/infix.c +++ b/src/klish-plugin-infix/src/infix.c @@ -43,7 +43,7 @@ struct infix_ds infix_config[] = { { "running-config", "running", SR_DS_RUNNING, 1, NULL }, { "candidate-config", "candidate", SR_DS_CANDIDATE, 1, NULL }, { "operational-config", "operational", SR_DS_OPERATIONAL, 1, NULL }, - { "factory-config", NULL, SR_DS_FACTORY_DEFAULT, 0, "/etc/factory-config.cfg" }, + { "factory-config", "factory-default", SR_DS_FACTORY_DEFAULT, 0, NULL } }; static void cd_home(kcontext_t *ctx) From 72a71985c80fb53e50c7d97bf08133b084216eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 13 May 2024 16:30:14 +0200 Subject: [PATCH 03/20] Bump sysrepo, netopeer2, libyang and libnetconf This also adds support in sysrepot to install factory config on boot, default is only to allow it when installing the module, we can not do that anymore, since the modules is installed during build and the factory config (or failure) can only be determed when booted. --- buildroot | 2 +- ...add-support-for-running-in-foregroun.patch | 70 ++++++++ ...NE-to-return-any-error-to-sysrepocfg.patch | 151 +++++++++++++++++ ...3-Allow-to-copy-from-factory-default.patch | 25 +++ ...sysrepoctl-to-install-factory-config.patch | 158 ++++++++++++++++++ 5 files changed, 405 insertions(+), 1 deletion(-) create mode 100644 patches/sysrepo/2.2.170/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch create mode 100644 patches/sysrepo/2.2.170/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch create mode 100644 patches/sysrepo/2.2.170/0003-Allow-to-copy-from-factory-default.patch create mode 100644 patches/sysrepo/2.2.170/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch diff --git a/buildroot b/buildroot index 1d96daca15..9dcd908bd1 160000 --- a/buildroot +++ b/buildroot @@ -1 +1 @@ -Subproject commit 1d96daca1516cbd74546c58d82da965628987c10 +Subproject commit 9dcd908bd1f82f62a1d8c807d1701deb9c9afe23 diff --git a/patches/sysrepo/2.2.170/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch b/patches/sysrepo/2.2.170/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch new file mode 100644 index 0000000000..6d3fda2160 --- /dev/null +++ b/patches/sysrepo/2.2.170/0001-sysrepo-plugind-add-support-for-running-in-foregroun.patch @@ -0,0 +1,70 @@ +From 2b284c1addeecb767bcd7dc280b27411c81cbb74 Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg +Date: Tue, 28 Mar 2023 10:37:53 +0200 +Subject: [PATCH 1/4] sysrepo-plugind: add support for running in foreground + with syslog + +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 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/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch b/patches/sysrepo/2.2.170/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch new file mode 100644 index 0000000000..306474c1da --- /dev/null +++ b/patches/sysrepo/2.2.170/0002-Allow-SR_EV_DONE-to-return-any-error-to-sysrepocfg.patch @@ -0,0 +1,151 @@ +From 4861639df0ce14178dbcec4d9ba93f502a1d122d Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg +Date: Tue, 7 May 2024 15:41:53 +0200 +Subject: [PATCH 2/4] Allow SR_EV_DONE to return any error to sysrepocfg + +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 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/0003-Allow-to-copy-from-factory-default.patch b/patches/sysrepo/2.2.170/0003-Allow-to-copy-from-factory-default.patch new file mode 100644 index 0000000000..bd76995cb6 --- /dev/null +++ b/patches/sysrepo/2.2.170/0003-Allow-to-copy-from-factory-default.patch @@ -0,0 +1,25 @@ +From ff0e3f4197fabaf3de5e013b065a6d9765dfdb07 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/4] Allow to copy from factory default + +--- + 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/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch b/patches/sysrepo/2.2.170/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch new file mode 100644 index 0000000000..04acc03b12 --- /dev/null +++ b/patches/sysrepo/2.2.170/0004-Add-z-switch-to-sysrepoctl-to-install-factory-config.patch @@ -0,0 +1,158 @@ +From a047f4b535f363cd97f02e80e2c5aec36f1cc081 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/4] Add -z switch to sysrepoctl to install factory config + from a json file + +This to be able to load the yang modules during build time instead on boot. +--- + src/executables/sysrepoctl.c | 20 +++++++++++++-- + src/sysrepo.c | 49 ++++++++++++++++++++++++++++++++++++ + src/sysrepo.h | 10 +++++++- + 3 files changed, 76 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/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 + From 9640e18fa842ad2034ef34a1b4102ee4832b3932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Fri, 17 May 2024 13:39:43 +0200 Subject: [PATCH 04/20] libnetconf: Add support for passwd accounts This was removed when the new version of ietf-netconf-server was introduced with the new version of libnetconf. --- ...or-system-authentication-as-fallback.patch | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 patches/libnetconf2/3.0.17/0001-Add-support-for-system-authentication-as-fallback.patch 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 new file mode 100644 index 0000000000..83dcbaa77c --- /dev/null +++ b/patches/libnetconf2/3.0.17/0001-Add-support-for-system-authentication-as-fallback.patch @@ -0,0 +1,59 @@ +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 + From 58da340b84a67dba261f4b4dd3ad8b926e69d8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Fri, 17 May 2024 13:49:50 +0200 Subject: [PATCH 05/20] Refactor gen-key to generate SSH accepted keys. --- src/confd/bin/gen-hostkeys | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/confd/bin/gen-hostkeys b/src/confd/bin/gen-hostkeys index 76037057de..7c42169bed 100755 --- a/src/confd/bin/gen-hostkeys +++ b/src/confd/bin/gen-hostkeys @@ -1,15 +1,14 @@ #!/bin/sh +KEYNAME=$(mktemp -u) + +ssh-keygen -f ${KEYNAME} -t rsa -N "" > /dev/null + +PUBKEY=$(awk '{print $2}' "${KEYNAME}.pub") -# generate a new key PRIVPEM=$(openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -outform PEM 2>/dev/null) # remove header/footer and newlines PRIVKEY=$(echo "$PRIVPEM" | grep -v -- "-----" | tr -d "\n") -# get public key -PUBPEM=$(echo "$PRIVPEM" | openssl rsa -pubout 2>/dev/null) -# remove header/footer and newlines -PUBKEY=$(echo "$PUBPEM" | grep -v -- "-----" | tr -d "\n") - # generate edit config cat < Date: Fri, 17 May 2024 14:36:32 +0200 Subject: [PATCH 06/20] FRR: Fix compatibility with newer libyang only minor. --- patches/frr/8.5.4/0001-libyang-compat.patch | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 patches/frr/8.5.4/0001-libyang-compat.patch diff --git a/patches/frr/8.5.4/0001-libyang-compat.patch b/patches/frr/8.5.4/0001-libyang-compat.patch new file mode 100644 index 0000000000..7b6093e4ce --- /dev/null +++ b/patches/frr/8.5.4/0001-libyang-compat.patch @@ -0,0 +1,22 @@ +diff --git a/lib/yang.c b/lib/yang.c +index ef1cf898a..c780b8e8c 100644 +--- a/lib/yang.c ++++ b/lib/yang.c +@@ -647,7 +647,7 @@ struct yang_data *yang_data_list_find(const struct list *list, + } + + /* Make libyang log its errors using FRR logging infrastructure. */ +-static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path) ++static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path, uint64_t line) + { + int priority = LOG_ERR; + +@@ -742,7 +742,7 @@ struct ly_ctx *yang_ctx_new_setup(bool embedded_modules, bool explicit_compile) + void yang_init(bool embedded_modules, bool defer_compile) + { + /* Initialize libyang global parameters that affect all containers. */ +- ly_set_log_clb(ly_log_cb, 1); ++ ly_set_log_clb(ly_log_cb); + ly_log_options(LY_LOLOG | LY_LOSTORE); + + /* Initialize libyang container for native models. */ From a80b302e660ed022822c5933d59d25a7c55b0fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Fri, 17 May 2024 15:12:06 +0200 Subject: [PATCH 07/20] netopeer2: Add a custom PAM configuration file The one installed with netopeer2 includes files that exist on ubuntu but not in buildroot. --- board/common/rootfs/etc/pam.d/netopeer2.conf | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 board/common/rootfs/etc/pam.d/netopeer2.conf diff --git a/board/common/rootfs/etc/pam.d/netopeer2.conf b/board/common/rootfs/etc/pam.d/netopeer2.conf new file mode 100644 index 0000000000..ca894fe8c4 --- /dev/null +++ b/board/common/rootfs/etc/pam.d/netopeer2.conf @@ -0,0 +1,20 @@ +#%PAM-1.0 +auth requisite pam_nologin.so +auth [success=1 default=ignore] pam_unix.so nullok +auth requisite pam_deny.so +auth required pam_permit.so + +account requisite pam_nologin.so +account [success=1 default=ignore] pam_unix.so +account requisite pam_deny.so +account required pam_permit.so + +password [success=1 default=ignore] pam_unix.so +password requisite pam_deny.so +password required pam_permit.so + +session required pam_loginuid.so +session include common-session +session optional pam_keyinit.so force revoke +session optional pam_lastlog.so showfailed +session optional pam_motd.so From 427b790628f27f4990773c274a06349ac28fed8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Fri, 17 May 2024 22:27:36 +0200 Subject: [PATCH 08/20] test: Refactor ipv4 address More robust and less code duplication --- test/case/ietf_interfaces/ipv4_address.py | 75 +++-------------------- test/infamy/iface.py | 4 +- 2 files changed, 11 insertions(+), 68 deletions(-) diff --git a/test/case/ietf_interfaces/ipv4_address.py b/test/case/ietf_interfaces/ipv4_address.py index c897507bc2..f28992171f 100755 --- a/test/case/ietf_interfaces/ipv4_address.py +++ b/test/case/ietf_interfaces/ipv4_address.py @@ -1,70 +1,15 @@ #!/usr/bin/env python3 import copy - import infamy +import infamy.iface as iface + +from infamy.util import until #Set of parameters needed to add/remove IPv4 addresses from interface new_ip_address = "10.10.10.20" new_prefix_length = 24 -def print_ip_addresses(target): - running = target.get_config_dict("/ietf-interfaces:interfaces") - interfaces = running.get("interfaces", {}).get("interface", []) - - for interface in interfaces: - name = interface["name"] - - if "ipv4" in interface: - ipv4_addresses = interface["ipv4"].get("address", []) - for ipv4_address in ipv4_addresses: - address = ipv4_address.get("ip") - prefix_length = ipv4_address.get("prefix-length") - print(f"Interface: {name}, IPv4 Address: {address}/{prefix_length}") - else: - print(f"Interface: {name}, No IPv4 Address") - - if "ipv6" in interface: - ipv6_addresses = interface["ipv6"].get("address", []) - for ipv6_address in ipv6_addresses: - address = ipv6_address.get("ip") - prefix_length = ipv6_address.get("prefix-length") - print(f"Interface: {name}, IPv6 Address: {address}/{prefix_length}") - else: - print(f"Interface: {name}, No IPv6 Address") - -def assert_ipv4_address_in_interface(target, ip_address, interface_name, prefix_length): - running = target.get_config_dict("/ietf-interfaces:interfaces") - interfaces = running.get("interfaces", {}).get("interface", []) - - found = False - - for interface in interfaces: - name = interface["name"] - - if name == interface_name: - if "ipv4" in interface: - ipv4_addresses = interface["ipv4"].get("address", []) - for ipv4_address in ipv4_addresses: - address = ipv4_address.get("ip") - length = ipv4_address.get("prefix-length") - if address == ip_address and length == prefix_length: - found = True - break - - assert found, f"IP address {ip_address}/{prefix_length} not found for interface {interface_name}" - -def assert_ipv4_removed(target, interface_name): - running = target.get_config_dict("/ietf-interfaces:interfaces") - interfaces = running.get("interfaces", {}).get("interface", []) - - for interface in interfaces: - name = interface["name"] - if name == interface_name: - assert "ipv4" not in interface, f"IPv4 address not removed from interface {interface_name}" - return - print(f"No interface with the name {interface_name}") - with infamy.Test() as test: with test.step("Setup"): env = infamy.Env(infamy.std_topology("1x1")) @@ -72,7 +17,7 @@ def assert_ipv4_removed(target, interface_name): _, interface_name = env.ltop.xlate("target", "mgmt") with test.step("Get initial IP addresses"): - print_ip_addresses(target) + print(iface.get_ipv4_address(target, interface_name)) with test.step("Configure IP address"): config = { @@ -92,23 +37,21 @@ def assert_ipv4_removed(target, interface_name): target.put_config_dict("ietf-interfaces", config) with test.step("Get updated IP addresses"): - print_ip_addresses(target) - assert_ipv4_address_in_interface(target, new_ip_address, interface_name, new_prefix_length) + until(lambda: iface.address_exist(target, interface_name, new_ip_address, proto='static')) with test.step(f"Remove IPv4 addresses from {interface_name}"): # Get current interface configuration running = target.get_config_dict("/ietf-interfaces:interfaces") new = copy.deepcopy(running) - for iface in new["interfaces"]["interface"]: - if iface["name"] == interface_name and "ipv4" in iface: - del iface["ipv4"] + for i in new["interfaces"]["interface"]: + if i["name"] == interface_name and "ipv4" in i: + del i["ipv4"] break target.put_diff_dicts("ietf-interfaces", running, new) with test.step("Get updated IP addresses"): - print_ip_addresses(target) - assert_ipv4_removed(target, interface_name) + until(lambda: iface.address_exist(target, interface_name, new_ip_address) == False) test.succeed() diff --git a/test/infamy/iface.py b/test/infamy/iface.py index 18e1bb6407..d9012a9d74 100644 --- a/test/infamy/iface.py +++ b/test/infamy/iface.py @@ -34,13 +34,13 @@ def interface_exist(target, iface): """Verify that the target interface exists""" return _iface_get_param(target, iface, "name") is not None -def address_exist(target, iface, address, proto="dhcp"): +def address_exist(target, iface, address, prefix_length = 24, proto="dhcp"): """Check if 'address' is set on iface""" addrs = get_ipv4_address(target, iface) if not addrs: return False for addr in addrs: - if addr['origin'] == proto and addr['ip'] == address: + if addr['origin'] == proto and addr['ip'] == address and addr['prefix-length'] == prefix_length: return True def get_ipv4_address(target, iface): From 01df19e4597c730ec9d0bccb63c985397bd769c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 20 May 2024 10:56:34 +0200 Subject: [PATCH 09/20] confd: Always use model prefix for intentityrefs This is a hardened requirement i latest libyang(/sysrepo) --- src/confd/src/cni.c | 8 ++++---- src/confd/src/ietf-routing.c | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/confd/src/cni.c b/src/confd/src/cni.c index 8636b8e671..ffe1fa9009 100644 --- a/src/confd/src/cni.c +++ b/src/confd/src/cni.c @@ -368,15 +368,15 @@ static int iface_gen_cni(const char *ifname, struct lyd_node *cif) const char *iftype = lydx_get_cattr(cif, "type"); if (iftype && !strcmp(iftype, "infix-if-type:bridge")) - type = "bridge"; + type = "infix-interfaces:bridge"; else - type = "host"; + type = "infix-interfaces:host"; } - if (!strcmp(type, "host")) + if (!strcmp(type, "infix-interfaces:host")) return cni_host(net, ifname) ?: 1; - if (!strcmp(type, "bridge")) + if (!strcmp(type, "infix-interfaces:bridge")) return cni_bridge(net, ifname) ?: 1; ERROR("Unknown container network type %s, skipping.", type); diff --git a/src/confd/src/ietf-routing.c b/src/confd/src/ietf-routing.c index 4b5b7edbed..586651b644 100644 --- a/src/confd/src/ietf-routing.c +++ b/src/confd/src/ietf-routing.c @@ -104,13 +104,14 @@ int parse_ospf_areas(sr_session_ctx_t *session, struct lyd_node *areas, FILE *fp area_type = lydx_get_cattr(area, "area-type"); default_cost = lydx_get_cattr(area, "default-cost"); summary = lydx_get_bool(area, "summary"); + if (area_type) { int stub_or_nssa = 0; - if (!strcmp(area_type, "nssa-area")) { + if (!strcmp(area_type, "ietf-ospf:nssa-area")) { stub_or_nssa = 1; fprintf(fp, " area %s nssa %s\n", area_id, !summary ? "no-summary" : ""); - } else if (!strcmp(area_type, "stub-area")) { + } else if (!strcmp(area_type, "ietf-ospf:stub-area")) { stub_or_nssa = 1; fprintf(fp, " area %s stub %s\n", area_id, !summary ? "no-summary" : ""); } @@ -358,7 +359,7 @@ static int change_control_plane_protocols(sr_session_ctx_t *session, uint32_t su const char *type; type = lydx_get_cattr(cplane, "type"); - if (!strcmp(type, "static")) { + if (!strcmp(type, "ietf-routing:static")) { staticd_enabled = parse_static_routes(session, lydx_get_child(cplane, "static-routes"), fp); } else if (!strcmp(type, "ietf-ospf:ospfv2")) { parse_ospf(session, lydx_get_child(cplane, "ospf")); From 2b367b2bcd1fbb34107210fa4ade5c134d5d71b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 20 May 2024 11:05:40 +0200 Subject: [PATCH 10/20] ospf-status: Return {} if no status can be retreived (ospfd is disabled) This helps yanger to generate a valid configuration. --- src/statd/python/ospf_status/ospf_status.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/statd/python/ospf_status/ospf_status.py b/src/statd/python/ospf_status/ospf_status.py index 07bf843f2a..101975117e 100755 --- a/src/statd/python/ospf_status/ospf_status.py +++ b/src/statd/python/ospf_status/ospf_status.py @@ -13,9 +13,12 @@ def main(): iface_out=subprocess.check_output("vtysh -c 'show ip ospf interface json'", shell=True) ospf_out=subprocess.check_output("vtysh -c 'show ip ospf json'", shell=True) neighbor_out=subprocess.check_output("vtysh -c 'show ip ospf neighbor detail json'", shell=True) - interfaces=json.loads(iface_out) - ospf=json.loads(ospf_out) - neighbors=json.loads(neighbor_out) + try: + interfaces=json.loads(iface_out) + ospf=json.loads(ospf_out) + neighbors=json.loads(neighbor_out) + except json.JSONDecodeError: + return {} # OSPFD is most likely not running for ifname,iface in interfaces["interfaces"].items(): iface["name"] = ifname From 5edddf71d7b4849d61db3bf0000cfd5df7f96b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 20 May 2024 11:08:18 +0200 Subject: [PATCH 11/20] yanger: Change behavior to always genereate a valid YANG Before we generated an invalid YANG model but it was still accepted by libyang, but now, since the upgrade it is not. --- src/statd/python/yanger/yanger.py | 35 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/statd/python/yanger/yanger.py b/src/statd/python/yanger/yanger.py index 2d03cb3522..c3d7680ac3 100755 --- a/src/statd/python/yanger/yanger.py +++ b/src/statd/python/yanger/yanger.py @@ -325,17 +325,27 @@ def add_ospf_routes(ospf): insert(ospf, "ietf-ospf:local-rib", "ietf-ospf:route", routes) -def add_ospf(ospf): +def add_ospf(control_protocols): """Populate OSPF status""" cmd = ['/usr/libexec/statd/ospf-status'] data = run_json_cmd(cmd, "") - ospf["ietf-ospf:router-id"] = data["routerId"] - ospf["ietf-ospf:address-family"] = "ipv4" + if data == {}: + return # No OSPF data available + + control_protocol={} + control_protocol["type"] = "ietf-ospf:ospfv2" + control_protocol["name"] = "default" + control_protocol["ietf-ospf:ospf"] = {} + control_protocol["ietf-ospf:ospf"]["ietf-ospf:areas"] = {} + + + control_protocol["ietf-ospf:ospf"]["ietf-ospf:router-id"] = data.get("routerId") + control_protocol["ietf-ospf:ospf"]["ietf-ospf:address-family"] = "ipv4" areas=[] - for area_id,values in data["areas"].items(): + for area_id,values in data.get("areas", {}).items(): area={} area["ietf-ospf:area-id"] = area_id area["ietf-ospf:interfaces"] = {} @@ -401,8 +411,9 @@ def add_ospf(ospf): area["ietf-ospf:interfaces"]["ietf-ospf:interface"] = interfaces areas.append(area) - insert(ospf, "ietf-ospf:areas", "area", areas) - add_ospf_routes(ospf) + add_ospf_routes(control_protocol["ietf-ospf:ospf"]); + control_protocol["ietf-ospf:ospf"]["ietf-ospf:areas"]["ietf-ospf:area"] = areas + insert(control_protocols, "control-plane-protocol", [control_protocol]) def get_bridge_port_pvid(ifname): data = run_json_cmd(['bridge', '-j', 'vlan', 'show', 'dev', ifname], @@ -856,20 +867,10 @@ def main(): yang_data = { "ietf-routing:routing": { "control-plane-protocols": { - "control-plane-protocol": [ - { - "type": "ietf-ospf:ospfv2", - "name": "default", - "ietf-ospf:ospf": { - "ietf-ospf:areas": - { - } - } - }] } } } - add_ospf(yang_data['ietf-routing:routing']['control-plane-protocols']['control-plane-protocol'][0]["ietf-ospf:ospf"]) + add_ospf(yang_data['ietf-routing:routing']['control-plane-protocols']) elif args.model == 'ietf-hardware': yang_data = { From d0e8e4c74f6a97c6e5b7aecad6cac6fc40020b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 20 May 2024 11:10:01 +0200 Subject: [PATCH 12/20] infamy: route: ospf: Adopt to changes done in 2c88e1bdf5 Now there is no guarantee that the control-plane-protocol array exist in operational. --- test/infamy/route.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/infamy/route.py b/test/infamy/route.py index f2373850b0..a981b5e432 100644 --- a/test/infamy/route.py +++ b/test/infamy/route.py @@ -40,8 +40,8 @@ def ipv6_route_exist(target, prefix, nexthop=None,source_protocol=None): def _get_ospf_status(target): - xpath="/ietf-routing:routing/control-plane-protocols/control-plane-protocol/ietf-ospf:ospf" - rib = target.get_data(xpath)["routing"]["control-plane-protocols"]["control-plane-protocol"] + xpath="/ietf-routing:routing/control-plane-protocols" + rib = target.get_data(xpath)["routing"]["control-plane-protocols"].get("control-plane-protocol", {}) for p in rib: if p["type"] == "ietf-ospf:ospfv2": return p["ospf"] From ec9fe8bb869507f4df222743647377cbc050bc3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Mon, 20 May 2024 15:29:17 +0200 Subject: [PATCH 13/20] confd: Update SHM path Do not use netopeer-created shm-path --- package/confd/confd.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/confd/confd.mk b/package/confd/confd.mk index 56e1afc638..8654f2b43f 100644 --- a/package/confd/confd.mk +++ b/package/confd/confd.mk @@ -11,12 +11,11 @@ CONFD_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/confd CONFD_LICENSE = BSD-3-Clause CONFD_LICENSE_FILES = LICENSE CONFD_REDISTRIBUTE = NO -CONFD_DEPENDENCIES = host-sysrepo netopeer2 augeas jansson libite sysrepo libsrx libglib2 +CONFD_DEPENDENCIES = host-sysrepo augeas jansson libite sysrepo libsrx libglib2 CONFD_AUTORECONF = YES -CONFD_SYSREPO_SHM_PREFIX = sr_buildroot$(subst /,_,$(CONFIG_DIR))_netopeer2 +CONFD_SYSREPO_SHM_PREFIX = sr_buildroot$(subst /,_,$(CONFIG_DIR))_confd -echo "prefix: $(CONFD_SYSREPO_SHM_PREFIX)" define CONFD_CONF_ENV CFLAGS="$(INFIX_CFLAGS)" endef @@ -383,8 +382,9 @@ define CONFD_PERMISSIONS endef define CONFD_CLEANUP - rm -f /dev/shm/$(NETOPEER2_SYSREPO_SHM_PREFIX)* + rm -f /dev/shm/$(CONFD_SYSREPO_SHM_PREFIX)* endef +CONFD_PRE_INSTALL_TARGET_HOOKS += CONFD_CLEANUP CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_EXTRA CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_YANG_MODULES CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_CLEANUP From 9bab6422fa0da4f1b105571ad47b2347b5d53e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Tue, 21 May 2024 08:16:05 +0200 Subject: [PATCH 14/20] libyang: Add upstream segfault patch --- .../UPSTREAM-Fix-netopeer2-segfault.patch | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 patches/libyang/2.2.8/UPSTREAM-Fix-netopeer2-segfault.patch diff --git a/patches/libyang/2.2.8/UPSTREAM-Fix-netopeer2-segfault.patch b/patches/libyang/2.2.8/UPSTREAM-Fix-netopeer2-segfault.patch new file mode 100644 index 0000000000..f104136cb2 --- /dev/null +++ b/patches/libyang/2.2.8/UPSTREAM-Fix-netopeer2-segfault.patch @@ -0,0 +1,73 @@ +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 */ From 535e5f448c933cc81b0b878e0c9021965a2c5e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Tue, 21 May 2024 10:48:35 +0200 Subject: [PATCH 15/20] test: ipv4_autoconf: Increace possible delay when waiting for link local No reason to be that narrow (10s) change to 30s --- test/case/infix_interfaces/ipv4_autoconf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/case/infix_interfaces/ipv4_autoconf.py b/test/case/infix_interfaces/ipv4_autoconf.py index 1ae2163932..4acf539be3 100755 --- a/test/case/infix_interfaces/ipv4_autoconf.py +++ b/test/case/infix_interfaces/ipv4_autoconf.py @@ -43,6 +43,6 @@ def has_linklocal(target, iface): }) with test.step("Wait for linklocal address on interface"): - until(lambda: has_linklocal(target, tport), attempts=10) + until(lambda: has_linklocal(target, tport), attempts=30) test.succeed() From 1ec1a2acebea737e5966849f6c06517f6ee75adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Wed, 22 May 2024 10:05:38 +0200 Subject: [PATCH 16/20] Update Changelog regarding updated YANG models --- doc/ChangeLog.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index 35785726e6..8eb82d2bf1 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -6,6 +6,7 @@ All notable changes to the project are documented in this file. [v24.05.0][UNRELEASED] ---------------------- +> **Note:** After upgrade a factory reset is needed ### Changes - Default web landing page refactored into a Buildroot package to make @@ -22,6 +23,12 @@ All notable changes to the project are documented in this file. - Update documentation for use of VETH pairs in containers - Issue #454: create bridges in `factory-config` with IGMP/MLD snooping enabled by default +- The following YANG models have been updated to newer draft versions: + `ietf-crypto-types`, `ietf-keystore`, `ietf-netconf-server`, `ietf-ssh-common`, + `ietf-ssh-server`, `ietf-tcp-client`, `ietf-tcp-common`, `ietf-tcp-server`, + `ietf-tcp-server`, `ietf-tcp-server`, `ietf-tcp-server`. + In these there are a lot of breaking changes, most likely + you will need to redo your configuration from `factory-config`. ### Fixes - Add missing LICENSE hash for factory reset tool From c3a2f66abaf1c09eeb096627c3087aa80b342eda Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 24 May 2024 07:01:40 +0200 Subject: [PATCH 17/20] confd: simplify sysrepo datastore makedev permissions --- package/confd/confd.mk | 339 +---------------------------------------- 1 file changed, 2 insertions(+), 337 deletions(-) diff --git a/package/confd/confd.mk b/package/confd/confd.mk index 8654f2b43f..3748b74bff 100644 --- a/package/confd/confd.mk +++ b/package/confd/confd.mk @@ -42,343 +42,8 @@ define CONFD_INSTALL_YANG_MODULES USE_CONTAINERS=$(BR2_PACKAGE_PODMAN) SYSREPO_SHM_PREFIX=$(CONFD_SYSREPO_SHM_PREFIX) SYSREPOCTL_EXECUTABLE="$(HOST_DIR)/bin/sysrepoctl" SYSREPOCFG_EXECUTABLE="$(HOST_DIR)/bin/sysrepocfg" SEARCH_PATH="$(TARGET_DIR)/usr/share/yang/modules/confd/" $(@D)/scripts/setup.sh endef define CONFD_PERMISSIONS -# generated using chatGPT -/etc/sysrepo/data/iana-ssh-mac-algs.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-nmda.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-with-defaults.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-acm.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/libnetconf2-netconf-server.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-acm.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-factory-default.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-factory-default.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-tls-cipher-suite-algs.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-client.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-keystore.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-dot1q-types.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-ethernet-interface.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-monitoring.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tls-common.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tls-server.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-system.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-nmda.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-server.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-system.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-factory-default.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-key-exchange-algs.startup f 660 root wheel - - - - - -/etc/sysrepo/data/libnetconf2-netconf-server.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-server.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-routing.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-datastores.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-interfaces.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-network-instance.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-server.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-client.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-routing.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-routing.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-schema-mount.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-crypto-types.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ip.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-crypto-types.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-services.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-dot1ab-lldp.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-lldp.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-schema-mount.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-factory-default.startup f 660 root wheel - - - - - -/etc/sysrepo/data/notifications.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-ip.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-plugind.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-hardware.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-subscribed-notifications.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-key-chain.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ipv6-unicast-routing.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-keystore.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-monitoring.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-lldp.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-interfaces.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-system.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-schema-mount.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-dot1q-types.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-if-type.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-ethernet-interface.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-library.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-with-defaults.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-encryption-algs.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-interfaces.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-routing.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-truststore.startup f 660 root wheel - - - - - -/etc/sysrepo/data/iana-hardware.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-crypt-hash.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-dot1q-types.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-hardware.startup f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-plugind.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ssh-common.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-subscribed-notifications.startup f 660 root wheel - - - - - -/etc/sysrepo/data/iana-if-type.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-if-type.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ipv4-unicast-routing.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-with-defaults.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-dot1q-types.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-library.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-common.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-subscribed-notifications.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-interfaces.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ipv4-unicast-routing.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-monitoring.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-public-key-algs.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-plugind.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-containers.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-hardware.startup f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-key-exchange-algs.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-dot1ab-lldp.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-ethernet-interface.startup f 660 root wheel - - - - - -/etc/sysrepo/data/notifications.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-routing.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-ethernet-interface.startup f 660 root wheel - - - - - -/etc/sysrepo/data/iana-timezones.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-datastores.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-x509-cert-to-name.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-factory-default.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-dot1ab-lldp.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-acm.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-factory-default.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-containers.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/iana-tls-cipher-suite-algs.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-push.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-common.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-factory-default.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-if-type.startup f 660 root wheel - - - - - -/etc/sysrepo/data/nc-notifications.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tls-server.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/yang.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ip.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-hardware.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-push.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/notifications.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-notifications.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-public-key-algs.startup f 660 root wheel - - - - - -/etc/sysrepo/data/nc-notifications.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-interfaces.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-factory-default.startup f 660 root wheel - - - - - -/etc/sysrepo/data/iana-tls-cipher-suite-algs.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-hardware.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-encryption-algs.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-crypt-hash.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-network-instance.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-crypto-types.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-datastores.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-hardware.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-monitoring.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-datastores.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-hardware.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-ethernet-interface.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/yang.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-notifications.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ssh-common.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tls-common.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-ethernet-interface.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-mac-algs.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-server.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-services.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-x509-cert-to-name.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/iana-timezones.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-datastores.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/libnetconf2-netconf-server.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tls-common.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-library.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-notifications.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-server.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-mac-algs.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-monitoring.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-server.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-crypto-types.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-public-key-algs.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-shell-type.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-routing.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-nmda.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-monitoring.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-truststore.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-shell-type.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-ethernet-interface.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/iana-tls-cipher-suite-algs.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-interfaces.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tls-server.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ipv6-unicast-routing.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-lldp.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-network-instance.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-ip.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/nc-notifications.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-client.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-routing.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ssh-common.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-keystore.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-dot1ab-lldp.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-notifications.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-client.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-origin.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-system.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-library.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-factory-default.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-timezones.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-subscribed-notifications.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-key-chain.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ipv4-unicast-routing.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/iana-crypt-hash.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-encryption-algs.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-notifications.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/iana-hardware.startup f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-encryption-algs.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ospf.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-key-exchange-algs.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-nmda.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-timezones.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ip.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-containers.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-ethernet-interface.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-interfaces.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-origin.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/libnetconf2-netconf-server.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-push.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-nmda.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ssh-common.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-monitoring.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ip.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-acm.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-if-type.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tls-common.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-dhcp-client.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-hardware.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-system.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ssh-common.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-monitoring.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tls-server.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-ip.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-with-defaults.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-system.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ssh-server.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ipv4-unicast-routing.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-ethernet-interface.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/yang.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-hardware.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-x509-cert-to-name.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-common.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-if-type.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-server.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-origin.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-key-chain.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-common.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-system.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-x509-cert-to-name.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/nc-notifications.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-keystore.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/iana-hardware.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-common.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-containers.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-server.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-interfaces.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ssh-server.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-key-chain.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-truststore.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-factory-default.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-if-type.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tls-server.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-keystore.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-routing.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ssh-server.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-plugind.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-client.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-shell-type.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-lldp.startup f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-mac-algs.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-interfaces.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-services.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-subscribed-notifications.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-if-type.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-factory-default.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-public-key-algs.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-if-type.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-mac-algs.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-factory-default.startup f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-monitoring.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tls-common.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-hardware.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-dhcp-client.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-system.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-if-type.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-truststore.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-schema-mount.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-dhcp-client.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-network-instance.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-tcp-server.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ospf.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-truststore.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-crypt-hash.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-routing.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ipv6-unicast-routing.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/yang.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-routing.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/notifications.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-ip.startup f 660 root wheel - - - - - -/etc/sysrepo/data/libnetconf2-netconf-server.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-schema-mount.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-factory-default.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/yang.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-dot1ab-lldp.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-monitoring.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-key-chain.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-hardware.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ip.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-dhcp-client.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ipv6-unicast-routing.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-timezones.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-system.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-network-instance.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-hardware.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-ip.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ipv6-unicast-routing.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-services.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-origin.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-library.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ospf.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-acm.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-push.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-containers.startup f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-encryption-algs.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ssh-server.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-ethernet-interface.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-services.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ieee802-dot1q-types.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-origin.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-public-key-algs.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ospf.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-shell-type.startup f 660 root wheel - - - - - -/etc/sysrepo/data/iana-crypt-hash.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-interfaces.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-yang-push.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/notifications.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/nc-notifications.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-server.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ospf.startup f 660 root wheel - - - - - -/etc/sysrepo/data/infix-lldp.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-x509-cert-to-name.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-factory-default.factory-default f 660 root wheel - - - - - -/etc/sysrepo/data/infix-shell-type.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-key-exchange-algs.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-tls-cipher-suite-algs.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-system.startup f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-netconf-with-defaults.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/iana-ssh-key-exchange-algs.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-factory-default.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/infix-dhcp-client.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ipv4-unicast-routing.running.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-ssh-server.operational.perm f 660 root wheel - - - - - -/etc/sysrepo/data/sysrepo-plugind.candidate.perm f 660 root wheel - - - - - -/etc/sysrepo/data/ietf-crypto-types.startup f 660 root wheel - - - - - +/etc/sysrepo/data/ r 660 root wheel - - - - - +/etc/sysrepo/data d 770 root wheel - - - - - endef define CONFD_CLEANUP From 0348e000db6134958f04a46f23901e19cae56c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Fri, 24 May 2024 09:37:37 +0200 Subject: [PATCH 18/20] confd: Add sysrepo and netopeer as a dependency. And remove not needed environment variable --- package/confd/confd.mk | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/package/confd/confd.mk b/package/confd/confd.mk index 3748b74bff..5cdbb72b8b 100644 --- a/package/confd/confd.mk +++ b/package/confd/confd.mk @@ -11,7 +11,7 @@ CONFD_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/confd CONFD_LICENSE = BSD-3-Clause CONFD_LICENSE_FILES = LICENSE CONFD_REDISTRIBUTE = NO -CONFD_DEPENDENCIES = host-sysrepo augeas jansson libite sysrepo libsrx libglib2 +CONFD_DEPENDENCIES = host-sysrepo sysrepo netopeer2 augeas jansson libite sysrepo libsrx libglib2 CONFD_AUTORECONF = YES CONFD_SYSREPO_SHM_PREFIX = sr_buildroot$(subst /,_,$(CONFIG_DIR))_confd @@ -26,11 +26,6 @@ else CONFD_CONF_OPTS += --disable-containers endif - -CONFD_MAKE_ENV = \ - SYSREPOCTL_EXECUTABLE=$(HOST_DIR)/bin/sysrepoctl \ - SYSREPO_SHM_PREFIX=$(CONFD_SYSREPO_SHM_PREFIX) - define CONFD_INSTALL_EXTRA cp $(CONFD_PKGDIR)/confd.conf $(FINIT_D)/available/ ln -sf ../available/confd.conf $(FINIT_D)/enabled/confd.conf From b7a83c1d40754b31f96ebd310740f49fd092320c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Fri, 24 May 2024 09:39:20 +0200 Subject: [PATCH 19/20] libsrx: Remove srx_require_module API Not needed anymore since all YANG modules should be loaded at build. --- src/confd/src/core.c | 1 - src/confd/src/ietf-hardware.c | 1 - src/confd/src/ietf-interfaces.c | 1 - src/confd/src/ietf-routing.c | 1 - src/confd/src/ietf-system.c | 2 +- src/confd/src/infix-containers.c | 1 - src/confd/src/infix-dhcp.c | 11 -------- src/confd/src/infix-factory.c | 1 - src/confd/src/infix-services.c | 12 -------- src/libsrx/src/Makefile.am | 3 +- src/libsrx/src/common.h | 2 +- src/libsrx/src/srx_module.c | 48 -------------------------------- src/libsrx/src/srx_module.h | 20 ------------- 13 files changed, 3 insertions(+), 101 deletions(-) delete mode 100644 src/libsrx/src/srx_module.c delete mode 100644 src/libsrx/src/srx_module.h diff --git a/src/confd/src/core.c b/src/confd/src/core.c index 3fade65f55..fa478b33be 100644 --- a/src/confd/src/core.c +++ b/src/confd/src/core.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -#include #include #include "core.h" diff --git a/src/confd/src/ietf-hardware.c b/src/confd/src/ietf-hardware.c index 53b20328eb..3714395494 100644 --- a/src/confd/src/ietf-hardware.c +++ b/src/confd/src/ietf-hardware.c @@ -3,7 +3,6 @@ #include #include -#include #include #include #include diff --git a/src/confd/src/ietf-interfaces.c b/src/confd/src/ietf-interfaces.c index 858a1a7fee..fce1c2d2b7 100644 --- a/src/confd/src/ietf-interfaces.c +++ b/src/confd/src/ietf-interfaces.c @@ -8,7 +8,6 @@ #include #include -#include #include #include "core.h" diff --git a/src/confd/src/ietf-routing.c b/src/confd/src/ietf-routing.c index 586651b644..ecf28eb0d6 100644 --- a/src/confd/src/ietf-routing.c +++ b/src/confd/src/ietf-routing.c @@ -2,7 +2,6 @@ #include #include -#include #include #include "core.h" diff --git a/src/confd/src/ietf-system.c b/src/confd/src/ietf-system.c index f7a20e932f..7fa0e66baf 100644 --- a/src/confd/src/ietf-system.c +++ b/src/confd/src/ietf-system.c @@ -12,7 +12,7 @@ #include #include -#include + #include #include "base64.h" diff --git a/src/confd/src/infix-containers.c b/src/confd/src/infix-containers.c index 9b99d580a7..415dff3c9c 100644 --- a/src/confd/src/infix-containers.c +++ b/src/confd/src/infix-containers.c @@ -10,7 +10,6 @@ #include #include -#include #include #include "core.h" diff --git a/src/confd/src/infix-dhcp.c b/src/confd/src/infix-dhcp.c index 43d63e2bd0..431a468c84 100644 --- a/src/confd/src/infix-dhcp.c +++ b/src/confd/src/infix-dhcp.c @@ -9,7 +9,6 @@ #include #include -#include #include #include "core.h" @@ -18,12 +17,6 @@ #define XPATH "/infix-dhcp-client:dhcp-client" #define CACHE_TEMPLATE "/var/lib/misc/%s.cache" -static const struct srx_module_requirement reqs[] = { - { .dir = YANG_PATH_, .name = MODULE, .rev = "2024-01-30" }, - { NULL } -}; - - static char *ip_cache(const char *ifname, char *str, size_t len) { @@ -407,10 +400,6 @@ int infix_dhcp_init(struct confd *confd) { int rc; - rc = srx_require_modules(confd->conn, reqs); - if (rc) - goto fail; - REGISTER_CHANGE(confd->session, MODULE, XPATH, 0, change, confd, &confd->sub); REGISTER_CHANGE(confd->cand, MODULE, XPATH"//.", SR_SUBSCR_UPDATE, cand, confd, &confd->sub); diff --git a/src/confd/src/infix-factory.c b/src/confd/src/infix-factory.c index 8cecfe6b01..c793a71f6c 100644 --- a/src/confd/src/infix-factory.c +++ b/src/confd/src/infix-factory.c @@ -10,7 +10,6 @@ #include #include -#include #include #include "core.h" diff --git a/src/confd/src/infix-services.c b/src/confd/src/infix-services.c index 70ff6039ae..356766ca08 100644 --- a/src/confd/src/infix-services.c +++ b/src/confd/src/infix-services.c @@ -10,7 +10,6 @@ #include #include -#include #include #include "core.h" @@ -51,13 +50,6 @@ struct mdns_svc { { ssh, "ssh", "_ssh._tcp", 22, "Secure shell command line interface (CLI)", NULL }, }; -static const struct srx_module_requirement reqs[] = { - { .dir = YANG_PATH_, .name = "infix-services", .rev = "2024-04-08" }, - { .dir = YANG_PATH_, .name = "ieee802-dot1ab-lldp", .rev = "2022-03-15" }, - { .dir = YANG_PATH_, .name = "infix-lldp", .rev = "2023-08-23" }, - { NULL } -}; - /* * On hostname changes we need to update the mDNS records, in particular * the ones advertising an adminurl (standarized by Apple), because they @@ -295,10 +287,6 @@ int infix_services_init(struct confd *confd) { int rc; - rc = srx_require_modules(confd->conn, reqs); - if (rc) - goto fail; - REGISTER_CHANGE(confd->session, "infix-services", "/infix-services:mdns", 0, mdns_change, confd, &confd->sub); REGISTER_MONITOR(confd->session, "ietf-system", "/ietf-system:system/hostname", diff --git a/src/libsrx/src/Makefile.am b/src/libsrx/src/Makefile.am index 1b9b1cc3fe..b92a5153ce 100644 --- a/src/libsrx/src/Makefile.am +++ b/src/libsrx/src/Makefile.am @@ -6,12 +6,11 @@ libsrx_la_LDFLAGS = $(AM_LDFLAGS) -version-info 0:0:0 libsrx_la_SOURCES = common.c common.h \ helpers.c helpers.h \ lyx.c lyx.h \ - srx_module.c srx_module.h \ srx_val.c srx_val.h \ systemv.c systemv.h pkgincludedir = $(includedir)/srx -pkginclude_HEADERS = common.h helpers.h lyx.h srx_module.h srx_val.h systemv.h +pkginclude_HEADERS = common.h helpers.h lyx.h srx_val.h systemv.h pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libsrx.pc diff --git a/src/libsrx/src/common.h b/src/libsrx/src/common.h index cda9a5b909..426b7ab6f0 100644 --- a/src/libsrx/src/common.h +++ b/src/libsrx/src/common.h @@ -6,7 +6,7 @@ #include #include #include -#include "srx_module.h" + #include "common.h" extern int debug; diff --git a/src/libsrx/src/srx_module.c b/src/libsrx/src/srx_module.c deleted file mode 100644 index 94631ce2b7..0000000000 --- a/src/libsrx/src/srx_module.c +++ /dev/null @@ -1,48 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause */ - -#include -#include - -#include "common.h" -#include "srx_module.h" - -sr_error_t srx_require_module(sr_conn_ctx_t *conn, const struct srx_module_requirement *mr) -{ - sr_error_t err = SR_ERR_OK; - char *path; - int len; - - len = asprintf(&path, "%s%s%s.yang", mr->name, mr->rev ? "@" : "", mr->rev ? : ""); - if (len == -1) { - ERROR("failed asprintf(): %s", strerror(errno)); - return SR_ERR_SYS; - } - - err = sr_install_module2(conn, path, mr->dir, mr->features, NULL, - "root", "wheel", 0660, NULL, NULL, 0); - free(path); - if (err == SR_ERR_EXISTS) { - /* Probably loaded as a dependency */ - err = 0; - - /* Ensure all requested features are enabled */ - for (int i = 0; mr->features[i]; i++) { - err = sr_enable_module_feature(conn, mr->name, mr->features[i]); - if (err) { - ERROR("failed enabling %s:%s, error %d", mr->name, mr->features[i], err); - } - } - } - - return err; -} - -sr_error_t srx_require_modules(sr_conn_ctx_t *conn, const struct srx_module_requirement *mrs) -{ - sr_error_t err = SR_ERR_OK; - - for (; mrs->name && !err; mrs++) - err = srx_require_module(conn, mrs); - - return err; -} diff --git a/src/libsrx/src/srx_module.h b/src/libsrx/src/srx_module.h deleted file mode 100644 index a544e209de..0000000000 --- a/src/libsrx/src/srx_module.h +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause */ - -#ifndef CONFD_SR_EXT_H_ -#define CONFD_SR_EXT_H_ - -#include - -struct srx_module_requirement { - const char *dir; - const char *name; - const char *rev; - const char **features; -}; - -sr_error_t srx_require_module(sr_conn_ctx_t *conn, - const struct srx_module_requirement *mr); -sr_error_t srx_require_modules(sr_conn_ctx_t *conn, - const struct srx_module_requirement *mrs); - -#endif /* CONFD_SR_EXT_H_ */ From 2cf0c27f6decf45708899300df0c9849f885e942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Fri, 24 May 2024 09:40:11 +0200 Subject: [PATCH 20/20] setup.sh: Document the origin of this script. --- src/confd/scripts/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/confd/scripts/setup.sh b/src/confd/scripts/setup.sh index 366268c694..2973eb9b75 100755 --- a/src/confd/scripts/setup.sh +++ b/src/confd/scripts/setup.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash -#set -x +set -x +# This is based on scripts/setup.sh from Netopeer2/libnetconf2 # env variables NP2_MODULE_DIR, NP2_MODULE_PERMS must be defined and NP2_MODULE_OWNER, NP2_MODULE_GROUP will be used if # defined when executing this script! #if [ -z "$NP2_MODULE_DIR" -o -z "$NP2_MODULE_PERMS" ]; then @@ -72,7 +73,6 @@ MODULES=( if [ -n "$USE_CONTAINERS" ]; then CONTAINERS=" -e containers"; MODULES+=("infix-containers@2024-03-27.yang") - fi MODULES+=("infix-interfaces@2024-01-15.yang $CONTAINERS -e vlan-filtering")