fix(yang-push): use system-chosen source IP for NETCONF SSH - #5
Merged
riccardo-negri merged 1 commit intoJul 28, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes NETCONF SSH schema-fetch failures when YANG Push notifications arrive via an anycast collector address by no longer forcing the SSH client’s TCP socket to bind to that collector IP as its source address. Instead, it lets the OS routing stack choose an appropriate unicast source address based on the destination, while keeping interface pinning (SO_BINDTODEVICE) unchanged.
Changes:
- Pass
Noneforlocal_addresswhen buildingNetconfSshConnectConfiginfetch_from_device. - Pass
Noneforlocal_addresswhen buildingNetconfSshConnectConfiginfetch_from_device_by_id.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
riccardo-negri
force-pushed
the
netconf-avoid-explicit-ip-bind
branch
from
July 28, 2026 08:14
b7431bb to
4b00cd6
Compare
YANG Push notifications arrive on the anycast address (e.g. 1.1.1.45). The YANG schema fetcher was reusing that collector address as the explicit local bind address for the NETCONF SSH connection. When the NETCONF server is only reachable via the site-local unicast address (.46 or .47), the connection fails because the source IP is wrong. Solution Remove the explicit socket.bind(local_addr) for NETCONF SSH connections in the schema fetcher by passing None as local_address in both fetch_from_device and fetch_from_device_by_id. The Linux routing stack now selects the correct unicast source address based on the destination. SO_BINDTODEVICE / local_interface is unchanged — interface selection still works as before. Files changed: - crates/yang-push/src/cache/fetcher.rs: pass None instead of Some(collector) for local_address in both NetconfSshConnectConfig::new call sites.
riccardo-negri
force-pushed
the
netconf-avoid-explicit-ip-bind
branch
from
July 28, 2026 08:19
4b00cd6 to
4c31b4b
Compare
ustorbeck
approved these changes
Jul 28, 2026
riccardo-negri
merged commit Jul 28, 2026
ba41aa2
into
network-analytics:main
17 of 19 checks passed
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.
YANG Push notifications arrive on the anycast address (e.g. 1.1.1.45). The YANG schema fetcher was reusing that collector address as the explicit local bind address for the NETCONF SSH connection. When the NETCONF server is only reachable via the site-local unicast address (.46 or .47), the connection fails because the source IP is wrong.
Solution
Remove the explicit socket.bind(local_addr) for NETCONF SSH connections in the schema fetcher by passing None as local_address in both fetch_from_device and fetch_from_device_by_id. The Linux routing stack now selects the correct unicast source address based on the destination.
SO_BINDTODEVICE / local_interface is unchanged — interface selection still works as before.
Files changed: