CESNET / libnetconf2

C NETCONF library
BSD 3-Clause "New" or "Revised" License
203 stars 147 forks source link

ERR: Received an invalid message (Node "next-update-at" not found as a child of "edit-config" node.). #473

Closed lorandt1 closed 7 months ago

lorandt1 commented 8 months ago

RPC-exchange.txt Using

libnetconf2 3.0.8 and libyang 2.1.148:

  1. send RPC with msg id 41: - edit-config
  2. send RPC with msg id 42: - supervision-watchdog-reset
  3. receive rpc-reply for msg id 41 -> 2024-03-26T15:30:23.706Z Err: [127.0.0.1] Session 1: Received an invalid message (Node "next-update-at" not found as a child of "edit-config" node.).

    Based on image I think it is certainly normal to happen

Old libnetconf2 2.0.24 and libyang 2.0.112 could handle this case and reply with:

ERR(session, "Received a with an unexpected message-id %" PRIu64 " (expected %" PRIu64 ").", cur_msgid, msgid); return NC_MSG_REPLY_ERR_MSGID;

Then the client could still receive the reply of rpc with message id 41

RPC exchanges attached in RPC-exchange.txt. Thank you!

michalvasko commented 8 months ago

Should be fixed.

lorandt1 commented 8 months ago

Thanks again! May I ask when is planned a new libnetconf2 release ?

michalvasko commented 8 months ago

As soon as the current version becomes a bit more stable, there are still changes being made (mostly in sysrepo). A couple of weeks at most, I hope.

lorandt1 commented 7 months ago

1.patch After I took the changes from devel branch (1.patch contains the differences between the initial fix I received and the one from devel branch added via commit b25c56f) I faced a crash that occurs after a rpc-error for following rpc requst:

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
    <get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
        <filter type="xpath" xmlns:yanglib="urn:ietf:params:xml:ns:yang:ietf-yang-library" select="/yanglib:*"/>
    </get>
</rpc>

logsBeforeCrash.txt

michalvasko commented 7 months ago

I have tested on the current devel, CLI output:

> get --filter-xpath=/yanglib:*
ly ERROR: Failed to resolve prefix "yanglib".
ERROR
        type:     application
        tag:      operation-failed
        severity: error
        message:  Storing value failed.

and the server errors, which are better:

[ERR]: LY: Unexpected XPath expression end. (path "/ietf-netconf:get/filter/@ietf-netconf:select")
[ERR]: LY: Storing value failed. (path "/ietf-netconf:get/filter/@ietf-netconf:select")

so I cannot reproduce this.

lorandt1 commented 7 months ago

The crash didn't appear for me either using the current devel.