Skip to content
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

Can clixon_netconf receive netconf packets as a server? #93

Closed
bearfirstrun opened this issue Aug 22, 2019 · 10 comments
Closed

Can clixon_netconf receive netconf packets as a server? #93

bearfirstrun opened this issue Aug 22, 2019 · 10 comments
Labels

Comments

@bearfirstrun
Copy link

Hi @olofhagsand
I have a problem now, can you help me?

I want to use clixon_netconf as the server, netopeer_cli as the client on two devices. I run the following command on netopeer(client), but always the connection is failed:
netopeer-cli
netconf> connect --login root --port 22 192.168.10.2
root@192.168.10.2 password:
libnetconf ERROR: Input channel error (end of file)
connect: connecting to the 192.168.10.2:22 as user "root" failed.

I have registered the subsystem netconf in /etc/ssh/sshd_config and installed openssh and libssh. But after netopeer_cli sends hello message ,it recieves hello message, then ERROR(This part of code is in libnetconf).

In the file netconfi_main.c, sockfd=0(stdin) is listened always.
So can netconf be used as a server to receive netconf client messages? Can clixon_netconf only receive input from the terminal?
If clixon_netconf can be used as a netconf server, why it report an error?

Any kind of help would be appreciable.

Regards,
bearfirstrun

@olofhagsand
Copy link
Member

There seems to be multiple issues.
First, have you registered clixon_netconf as a ssh subserver server properly as described in:
https://github.com/clicon/clixon/blob/master/doc/FAQ.md#how-do-i-use-netconf
ie with:

Subsystem netconf /usr/local/bin/clixon_netconf -f /usr/local/etc/example.xml

Second, clixon_netconf is designed to be used as a subsystem with redirected stdin/stdout. It could be extended as a proper server (as clixon_restconf / clixon_backend), it would just be to add proper daemon spawning code (ie needs implementation)

Third, for debugging, run clixon_netconf with -D 1 and check syslog to get error messages to see (maybe) where the error is.

Fourth, I havent run netopeer in this way. Can you provide simple instructions to run it in this way?

@bearfirstrun
Copy link
Author

Hi, @olofhagsand
I have registered netconf as a ssh subsystem correctly and restart ssh service. On the both device, I installed openssh and libssh.

I run clixon_netconf with -D 1 and then connect , but the clixon_netconf process has no response. Even after I kill the clixon_netconf process, the connect operation still has the same error. In addition, netopeer_cli sends the netconf hello message to ssh port 22, while clixon_netconf listens on stdin. Can clixon_netconf receive the hello message? I'm confused. So , I guess the problem is due to the operations of establishing ssh channel and request netconf subsystem, and hello-replay. But actually I dont know why?

My simple instruction:
dev1 dev2
--------------------- ---------------------
| openssh/libssh | | openssh/libssh |
| | | clixon_backend |
| netopeer_cli | | clixon_netconf |
| 192.168.10.3 | ---------------------- | 192.168.10.2 |
--------------------- ---------------------
dev1/2 : centos 7
perform clixon_backend
perform clixon_netconf : blocking
perform netopeer_cli: netconf> connect --login root --port 22 192.168.10.2
root@192.168.10.2 password:
then , error: libnetconf ERROR: Input channel error (end of file)
connect: connecting to the 192.168.10.2:22 as user "root" failed.
debug netopeer_cli, errror occurs atfer netopeer_cli sending hello successfully.
clixon_netconf is still blocking.

@olofhagsand
Copy link
Member

olofhagsand commented Aug 23, 2019 via email

@bearfirstrun
Copy link
Author

Hi, @olofhagsand
Thank you very much for your help.

I still haven't found the cause of the problem above, but when clixon is installed by an RPM package, the connection is successful.

Now I need your help with another difficulty :
When I make pkg-rpm, the size of debuginfo.rpm generated is 0 , why is this ?
What could I do to use debuginfo.rpm to debug clixon_netconf program ?

Thank you again!

@bearfirstrun
Copy link
Author

I'm really sorry to bother you. The difficulty just now has been solved. I add in the clixon.spec file:
%configure --with-cligen=%{cligen_prefix} --enable-debug
then , xxx-debuginfo-xxx_dirty_xxx.rpm is generated.
Is this right?
Thank you!

@dcornejo
Copy link
Contributor

yes, you do need the --enable-debug to get the symbols. I have seen it in other software that CentOS will create empty debuginfo rpms if there are no symbols, and this appears to be the case here.

So, are you now up and running?

@bearfirstrun
Copy link
Author

Hi, @olofhagsand
I installed clixon by building RPM and connection is OK.
The previous problem still exists. I plan to solve it later.
Now, I find a mistake. I'm not sure whether it is a bug ?
In function "netconf_create_hello" of clixon/apps/netconf/netconf_hello.c
cprintf(cb, "urn:ietf:params:netconf:capability:candidate:1:0");
Should the above code be changed to :
cprintf(cb, "urn:ietf:params:netconf:capability:candidate:1.0");
That is 1:0 ---> 1.0 ?

Thank you!

@bearfirstrun
Copy link
Author

HI, @dcornejo
Sorry, I didn't notice the name before. Please see my above reply.
Thank you!

@olofhagsand
Copy link
Member

Oops. Yes thanks for detecting, I will submit a patch on master asap.

olofhagsand added a commit that referenced this issue Sep 4, 2019
…on_netconf receive netconf packets as a server? #93](#93)
@olofhagsand
Copy link
Member

Outdated discussion

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

No branches or pull requests

3 participants