netopeer2 icon indicating copy to clipboard operation
netopeer2 copied to clipboard

Server crash when filtering list

Open awesomenode opened this issue 3 years ago • 2 comments

Hi!

I accidentally changed the order of the filter nodes when retrieving a list with a <get> operation, and netopeer2 crashed.

For example, using the test schema I've attached, the following <get> crashed the server:

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="12">
  <get>
    <filter type="subtree">
      <t:basics xmlns:t="urn:com:test">
        <t:animals>
          <t:weight/>
          <t:species>dog</t:species>
        </t:animals>
      </t:basics>
    </filter>
  </get>
</rpc>

Server output:

[INF]: NP: Session 1: thread 1 event new RPC.
[INF]: LY: Parsing opaque list node "animals" with missing/invalid keys.
[INF]: SR: Published event "rpc" "/ietf-netconf:get" with ID 3 priority 0 for 1 subscribers.
[INF]: SR: Processing "/ietf-netconf:get" "rpc" event with ID 3 priority 0 (remaining 1 subscribers).
[INF]: SR: Successful processing of "rpc" event with ID 3 priority 0 (remaining 0 subscribers).
[INF]: SR: Event "rpc" with ID 3 priority 0 succeeded.
[INF]: NP: Session 1: thread 0 event new RPC.
[INF]: LY: Parsing opaque term node "weight" with invalid value "".
Segmentation fault

I'm using the lastest devel versions of libyang/sysrepo/libnetconf2/netopeer2. test.zip

Thanks!

awesomenode avatar Mar 03 '22 12:03 awesomenode

Should be fixed in latest libyang, forgot to reference this issue...

michalvasko avatar Mar 03 '22 12:03 michalvasko

Hi!

Yes the server doesn't like the <rpc> tag in the request. While waiting for this to be fixed you can try this:

<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="12"> <filter type="subtree"> <t:basics xmlns:t="urn:com:test"> <t:animals> <t:weight/> <t:species>dog</t:species> </t:animals> </t:basics> </filter> </get>

BabisChat avatar Mar 04 '22 10:03 BabisChat