Skip to content

Commit 0effbd7

Browse files
declspecJason LarkeRob-Hague
authored
Updated NETCONF framing protocol detection to check both client & server capabilities (#639)
* Updated NETCONF framing protocol detection to check both client & server capabilities This fixes an issue where the NetConfSession would expect the framing protocol to be used if ServerCapabilities contained 1.1, however the server would actually be using the legacy protocol as the client only advertises support for 1.0. * add comment --------- Co-authored-by: Jason Larke <jason.larke@curtin.edu.au> Co-authored-by: Rob Hague <rob.hague00@gmail.com>
1 parent 1b71e8f commit 0effbd7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Renci.SshNet/Netconf/NetConfSession.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,13 @@ protected override void OnDataReceived(byte[] data)
150150
var nsMgr = new XmlNamespaceManager(ServerCapabilities.NameTable);
151151
nsMgr.AddNamespace("nc", "urn:ietf:params:xml:ns:netconf:base:1.0");
152152

153-
_usingFramingProtocol = ServerCapabilities.SelectSingleNode("/nc:hello/nc:capabilities/nc:capability[text()='urn:ietf:params:netconf:base:1.1']", nsMgr) != null;
153+
const string xpath = "/nc:hello/nc:capabilities/nc:capability[text()='urn:ietf:params:netconf:base:1.1']";
154+
155+
// This will currently evaluate to false since we (the client) do not advertise 1.1 capability.
156+
// Despite some code existing for the 1.1 framing protocol, it is thought to be incorrect or
157+
// incomplete. The NETCONF code is practically untested at the time of writing.
158+
_usingFramingProtocol = ServerCapabilities.SelectSingleNode(xpath, nsMgr) != null
159+
&& ClientCapabilities.SelectSingleNode(xpath, nsMgr) != null;
154160

155161
_ = _serverCapabilitiesConfirmed.Set();
156162
}

0 commit comments

Comments
 (0)