Skip to content

NETCONF Incorrect Client Hello Response #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kennedyjd opened this issue Nov 17, 2017 · 3 comments · Fixed by #639
Closed

NETCONF Incorrect Client Hello Response #342

kennedyjd opened this issue Nov 17, 2017 · 3 comments · Fixed by #639

Comments

@kennedyjd
Copy link

Hello,
In src\Renci.SshNet\Netconf\NetConfSession.cs, lines 41 - 42 is missing the client request for the 1.1 protocol. The code should read:

            ClientCapabilities.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                                                "<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
                                                    "<capabilities>" +
                                                        "<capability>" +
                                                            "urn:ietf:params:netconf:base:1.0" +
                                                        "</capability>" +
                                                        "<capability>" +
                                                            "urn:ietf:params:netconf:base:1.1" +
                                                        "</capability>" +
                                                    "</capabilities>" +
                                                "</hello>");

Without adding the second capability, line 134 is invalid:

            _usingFramingProtocol = (ServerCapabilities.SelectSingleNode("/nc:hello/nc:capabilities/nc:capability[text()='urn:ietf:params:netconf:base:1.1']", nsMgr) != null);

The reason is that the server will not be using framing if the client does not state that it is supported. Line 138 uses this flag to handle chunking with the framing protocol, though the server correctly responds without framing.

Thanks,

-- Joe

@harveechen
Copy link

Yes, I also find this. Wish to update it.

@Hevace
Copy link

Hevace commented Apr 3, 2018

Thank you @kennedyjd this resolved my problem as well.

@mpenrico-polatis
Copy link

mpenrico-polatis commented Oct 25, 2018

I spotted the same problem and made the same fix in a local copy before spotting this issue (and #405) and I also changed the line that sets the _usingFramingProtocol property in the NetConfSession class to set it only if both the server AND the client report the :netconf:base:1.1 capability (as per RFC6241 section 8.1).

I also note that there should be some extra code to make the NetConfSession class more compliant with RFC6241 - e.g. if it receives a <hello> from the server with no session-id then the session should be terminated straight away.

Michael.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants