OpenClovis / OpenYuma

Fork of the defacto standard Yuma project since it went proprietary. Netconf is a management protocol (similar to SNMP) defined in RFC4741.
68 stars 51 forks source link

Packet handling error in packets containing non-self closing tags #4

Open czeni opened 10 years ago

czeni commented 10 years ago

When messages sended to the netconfd are containing start/end XML tags instead of self-closing tags the netconfd processes these incorrectly. In my case i use a custom Java implementation for the client. I send a cancel-toast RPC to the loaded toaster module, although i don't requested a make-toast prior. So i should recieve an rpc-error message, but instead of i got an rpc-ok. Here is the XML messages which logged by the netconfd:

Request:

<nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:message-id="1"><cancel-toast xmlns="http://netconfcentral.org/ns/toaster"></cancel-toast> </nc:rpc>]]>]]>

Reply:

<?xml version="1.0" encoding="UTF-8"?> <rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <ok/> </rpc-reply>]]>]]>

According to the server log the netconfd processes this type of messages incorrectly and it actually invoke the server side cancel-toast RPC.

After i noticed this issue i correced and rewrote the third-party netconf library to use self closing tag. Then i got the expected rpc-error message.

And here is the server log (--log-level=debug3): https://gist.github.com/czeni/d7cfa79ffdae8508eefe

cmavr8 commented 10 years ago

So, is this a bug in netconfd or a guidline for module developers? I've been away from netconf for a year, but I still have feelings for it :P

czeni commented 10 years ago

I guess both :), but i don't know the yuma well to tell whose responibility is that. However, i think this behavior is a serios flaw, because responding with an rpc-ok instead of rpc-error could mean a serious functional issue, so it should worth to deal with this. So i reported it, rewrote the library to use self-closing tags and from now use this workaround. I also reported this issue to the writers of the the third-party Java library.

AndrewStoneOpenClovis commented 10 years ago

Are you saying that <cancel-toast></cancel-toast> returns rpc-ok but <cancel-toast/> returns rpc-error?

czeni commented 10 years ago

Yes, if i don't call the make-toast method prior.