Skip to content

Conversation

jeremie6wind
Copy link
Contributor

@jeremie6wind jeremie6wind commented Oct 3, 2025

Hi,
I had these 2 issues with libnetconf 4.0.1:

First patch:
src/io.c: Sometimes I get ret = 0 and an empty buf so ly_in_new_memory failed.
I propose to return if ret is 0?

Second patch:
Replacing the netconf server endpoint may fail:
For instance if the endpoint name is ssh1, we try to replace it with an endpoint name called ssh2.
nc_server_config_listen_all_endpoints first tries to create ssh1 whereas it is supposed to be deleted.
It fails and return.
Then it does not try to create ssh2.

For instance I tried to apply these 2 configs:

<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<netconf-server xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-server">
    <listen>
        <endpoints>
            <endpoint>
                <name>ssh1</name>
                <ssh>
                    <tcp-server-parameters>
                        <local-address>127.0.0.1</local-address>
                        <local-port>830</local-port>
                    </tcp-server-parameters>
                    <ssh-server-parameters>
                      <server-identity>
                        <host-key>
                          <name>default-key</name>
                          <public-key>
                            <central-keystore-reference>genkey</central-keystore-reference>
                          </public-key>
                        </host-key>
                      </server-identity>
                    </ssh-server-parameters>
                </ssh>
            </endpoint>
        </endpoints>
    </listen>
</netconf-server>
</config>

then:

<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<netconf-server xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-server">
    <listen>
        <endpoints>
            <endpoint>
                <name>ssh2</name>
                <ssh>
                    <tcp-server-parameters>
                        <local-address>127.0.0.2</local-address>
			            <local-port>830</local-port>
                    </tcp-server-parameters>
                    <ssh-server-parameters>
                      <server-identity>
                        <host-key>
                          <name>default-key</name>
                          <public-key>
                            <central-keystore-reference>genkey</central-keystore-reference>
                          </public-key>
                        </host-key>
                      </server-identity>
                    </ssh-server-parameters>
                </ssh>
            </endpoint>
        </endpoints>
    </listen>
</netconf-server>
</config>

I get these errors:
[ERR]: LN: Endpoint "ssh1" was not found.
[ERR]: LN: Applying ietf-netconf-server configuration failed.

In the second patch, I tried to skip endpoints with the delete yang operation.

Thank you

Copy link
Collaborator

@Roytak Roytak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one small thing and will merge it then. Thank you.

if (n) {
/* go over all the endpoints */
LY_LIST_FOR(lyd_child(n), iter) {
struct lyd_meta *m;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We define all variables at the beginning of the given functions.

An endpoint may fail to be created if is after a deleted endpoint
depending on the order in the list of endpoints.
This patch don't try to create deleted endpoints. Skip the endpoint
with the 'delete' yang operation.
This fixes this error message:
> Endpoint "<endpoint name>" was not found.
> Applying ietf-netconf-server configuration failed.
@Roytak Roytak merged commit 474aeca into CESNET:devel Oct 7, 2025
12 checks passed
@jlesk
Copy link

jlesk commented Oct 7, 2025

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants