fix(netconf-proto): handle empty containers in copy_buffer_till functions - #28
Open
riccardo-negri wants to merge 1 commit into
Open
fix(netconf-proto): handle empty containers in copy_buffer_till functions#28riccardo-negri wants to merge 1 commit into
riccardo-negri wants to merge 1 commit into
Conversation
riccardo-negri
force-pushed
the
fix-netconf
branch
from
August 5, 2026 09:09
5221e4b to
bae4dd3
Compare
riccardo-negri
force-pushed
the
fix-netconf
branch
3 times, most recently
from
August 5, 2026 09:35
debf069 to
b9632a8
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes NETCONF XML subtree copying so self-closing/empty containers (e.g. <data/> or <data></data>) no longer cause copy_buffer_till* to scan to EOF and surface misleading parsing errors, restoring correct behavior for empty <get> / <get-config> replies.
Changes:
- Add a
parent_has_child()guard tocopy_buffer_tillandcopy_buffer_till_with_namespacesto return empty content for empty/self-closing containers. - Add unit tests covering empty/self-closing containers for both primitives.
- Add an end-to-end
RpcReplytest ensuring<data/>and<data></data>parse as empty data.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/netconf-proto/src/xml_utils.rs | Guards the copy primitives against empty/self-closing containers and adds targeted unit tests. |
| crates/netconf-proto/src/protocol.rs | Adds an end-to-end RPC reply test for empty <data> forms. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ustorbeck
previously approved these changes
Aug 5, 2026
riccardo-negri
force-pushed
the
fix-netconf
branch
from
August 6, 2026 08:07
eeac6e6 to
5ea85b8
Compare
A `<get>` reply whose filter matched nothing comes back as a self-closing `<data/>` (e.g. IOS-XR when a queried dynamic subscription is absent from the operational datastore). `copy_buffer_till` then found no `</data>` end tag to copy up to and scanned to EOF, surfacing the misleading `SSH codec error NETCONF XML parsing error: 'Found EOF while expecting data'` and failing the YANG Library fetch. The same latent defect existed at every copy_buffer_till / copy_buffer_till_with_namespaces call site (empty subtree filter, `<config/>`, `<rpc/>`, `<rpc-reply/>`, ...): none guarded against an empty or self-closing container. Guard both primitives with parent_has_child() -- mirroring collect_xml_sequence* -- so all seven call sites return empty content instead of running to EOF. Add unit tests for the two primitives and an end-to-end rpc-reply test covering both the `<data/>` and `<data></data>` forms.
riccardo-negri
force-pushed
the
fix-netconf
branch
from
August 6, 2026 08:08
5ea85b8 to
7a6cf6b
Compare
riccardo-negri
enabled auto-merge (rebase)
August 6, 2026 08:08
rodonile
approved these changes
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
<get>reply whose filter matched nothing comes back as aself-closing
<data/>(e.g. IOS-XR when a queried dynamic subscriptionis absent from the operational datastore).
copy_buffer_tillthen foundno
</data>end tag to copy up to and scanned to EOF, surfacing themisleading
SSH codec error NETCONF XML parsing error: 'Found EOF while expecting data'and failing the YANG Library fetch.The same latent defect existed at every copy_buffer_till /
copy_buffer_till_with_namespaces call site (empty subtree filter,
<config/>,<rpc/>,<rpc-reply/>, ...): none guarded against anempty or self-closing container. Guard both primitives with
parent_has_child() -- mirroring collect_xml_sequence* -- so all seven
call sites return empty content instead of running to EOF.
Add unit tests for the two primitives and an end-to-end rpc-reply test
covering both the
<data/>and<data></data>forms.