mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 09:15:47 +00:00
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>
This commit is contained in:
@@ -150,7 +150,13 @@ namespace Renci.SshNet.NetConf
|
||||
var nsMgr = new XmlNamespaceManager(ServerCapabilities.NameTable);
|
||||
nsMgr.AddNamespace("nc", "urn:ietf:params:xml:ns:netconf:base:1.0");
|
||||
|
||||
_usingFramingProtocol = ServerCapabilities.SelectSingleNode("/nc:hello/nc:capabilities/nc:capability[text()='urn:ietf:params:netconf:base:1.1']", nsMgr) != null;
|
||||
const string xpath = "/nc:hello/nc:capabilities/nc:capability[text()='urn:ietf:params:netconf:base:1.1']";
|
||||
|
||||
// This will currently evaluate to false since we (the client) do not advertise 1.1 capability.
|
||||
// Despite some code existing for the 1.1 framing protocol, it is thought to be incorrect or
|
||||
// incomplete. The NETCONF code is practically untested at the time of writing.
|
||||
_usingFramingProtocol = ServerCapabilities.SelectSingleNode(xpath, nsMgr) != null
|
||||
&& ClientCapabilities.SelectSingleNode(xpath, nsMgr) != null;
|
||||
|
||||
_ = _serverCapabilitiesConfirmed.Set();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user