mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 01:05:42 +00:00
Fix netconf framing protocol (#946)
* 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. * fix NETCONF to comply with RFC6242 for framing protocol * netcconf client - fix null ptr exception on dispose * netcconf client - provide example usage in xml doc * add comment --------- Co-authored-by: Jason Larke <jason.larke@curtin.edu.au> Co-authored-by: Todd Schavey <todd.schavey@ge.com> Co-authored-by: Robert Hague <rh@johnstreetcapital.com> Co-authored-by: Rob Hague <rob.hague00@gmail.com>
This commit is contained in:
@@ -208,6 +208,13 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Sends the receive RPC.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// var rpcXmlTemplate = "<rpc xmlns='urn:ietf:params:xml:ns:netconf:base:1.0' message-id='1'>{0}</rpc>"'
|
||||
/// rpc.LoadXml(String.Format(rpcXmlTemplate, "<get-config><source><running/></source></get-config>"));
|
||||
/// var rpcResponse = client.SendReceiveRpc(rpc);
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <param name="rpc">The RPC.</param>
|
||||
/// <returns>
|
||||
/// Reply message to RPC request.
|
||||
@@ -226,6 +233,12 @@ namespace Renci.SshNet
|
||||
/// <summary>
|
||||
/// Sends the receive RPC.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// var rpcXmlTemplate = "<rpc xmlns='urn:ietf:params:xml:ns:netconf:base:1.0' message-id='1'>{0}</rpc>"'
|
||||
/// var rpcResponse = client.SendReceiveRpc(String.Format(rpcXmlTemplate, "<get-config><source><running/></source></get-config>"));
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <param name="xml">The XML.</param>
|
||||
/// <returns>
|
||||
/// Reply message to RPC request.
|
||||
|
||||
@@ -152,6 +152,10 @@ namespace Renci.SshNet.NetConf
|
||||
|
||||
const string xpath = "/nc:hello/nc:capabilities/nc:capability[text()='urn:ietf:params:netconf:base:1.1']";
|
||||
|
||||
// Per RFC6242 section 4.1, If the :base:1.1 capability is advertised by both
|
||||
// peers, the chunked transfer mechanism is used for the remainder of the NETCONF
|
||||
// session. Otherwise, the old end-of-message based mechanism(see Section 4.3) is used.
|
||||
|
||||
// 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.
|
||||
|
||||
Reference in New Issue
Block a user