libnetconf2 icon indicating copy to clipboard operation
libnetconf2 copied to clipboard

cmd_connect: Connecting to the localhost:830 as user "root" failed.

Open Rohit2387 opened this issue 5 years ago • 22 comments

 One sample application I have written to test ssh,with the help below API/callback but when tried to connect through netopper-cli connect timeout is happening 

Error:[root@clab601node01 build]# ./netopeer2-cli

connect nc ERROR: SSH connect timeout. cmd_connect: Connecting to the localhost:830 as user "root" failed.

    ret = nc_server_add_endpt("main_ssh", NC_TI_LIBSSH);
    ret = nc_server_endpt_set_address("main_ssh", "127.0.0.1");
    ret = nc_server_endpt_set_port("main_ssh", 830);
    ret = nc_server_ssh_add_authkey_path(TESTS_DIR"/data/key_ecdsa.pub", "test");
    ret = nc_server_ssh_endpt_add_hostkey("main_ssh", "key_rsa", -1);

Server is in listening: netstat -punta|grep -i a.out tcp 1 0 0.0.0.0:830 0.0.0.0:* LISTEN 9714/./a.out

Rohit2387 avatar Dec 11 '20 11:12 Rohit2387

To accept the session you must call nc_accept(), otherwise it will only listen.

michalvasko avatar Dec 11 '20 12:12 michalvasko

Ok so accept call i need to call only once for entire process lifetime?Will it automatically do creation of thread and synchr noization handling for each client request? For example like this:?

 void server_accept(void *arg)
{
    (void)arg;
    NC_MSG_TYPE msgtype;
    int ret;
    struct nc_pollsession *ps;
    struct nc_session *session;

    ps = nc_ps_new();
    msgtype = nc_accept(NC_ACCEPT_TIMEOUT, &session);
    nc_ps_add_session(ps, session);
    ret = nc_ps_poll(ps, NC_PS_POLL_TIMEOUT, NULL);
    nc_ps_clear(ps, 0, NULL);

    nc_ps_free(ps);
    
}

Or i need to use like mentioned in test? these extra API call?

    pthread_barrier_wait(&barrier);
    nc_thread_destroy();

Rohit2387 avatar Dec 11 '20 12:12 Rohit2387

Whatever questions you may have, they should be answered by looking at netopeer2-server. The main operation is handled by worker_thread(). But you should call nc_thread_destroy() if you want to avoid leaks at your program exit, you can skip it if you do not care.

So, the code you wrote should be fine for handling a single RPC on the accepted session. It seems you do not know how polling works but also have no idea what pthread_barrier_wait() does, that is a problem. I am sorry but if you decided to write your own NETCONF server, I will not help you with each step when something will not work for you, we are mostly providing support with issues when something does not work the way it should.

michalvasko avatar Dec 11 '20 12:12 michalvasko

OK ,thanks since documentation is not clear about how API usage should be worked due to which have some doubt. So if libnectonf already have thread handling to accept multiple request with mutex, semphore for critical section and conditional varaible for wakeup and sleep then fine. Otherwise application need to write a mechanism to poll/select for request and add the thread synch . Once this sample server i can put for others also who are interested only on transport layer for nectonf without db handling. By the way after doing accept also connection timeout. Let me debug and then comment.

Rohit2387 avatar Dec 11 '20 12:12 Rohit2387

Hi,

After debugging due to lpthread library issue thread was not working properly due to which it was not accepting request. Now connection is getting accepted but with below error: cmd_connect: Connecting to the localhost:830 as user "root" failed:

I have root as second argument: ret = nc_server_ssh_add_authkey_path(TESTS_DIR"/data/key_ecdsa.pub", "root");

If i change to tester also then also failing: ret = nc_server_ssh_add_authkey_path(TESTS_DIR"/data/key_ecdsa.pub", "tester");

NOTE: Both client and server i started with root to avoid binding issue for port and to avoid shared library access issue.(since default port i kept 803)

Rohit2387 avatar Dec 14 '20 07:12 Rohit2387

Easiest would be to enable some verbose output (nc_verbosity() with at least NC_VERB_VERBOSE) best for both server and the client (in netopeer2-cli you simply use the command verb verbose). But most likely the server is more relevant and it should print why it is refusing the connection. If you still do not see the specific error, you can try using nc_libssh_thread_verbosity() because the reason may easily be SSH-related.

michalvasko avatar Dec 14 '20 08:12 michalvasko

These traces indicate successful ssh connection?

./a.out

libyang[0]: Module not found or not implemented. (path: /ietf-netconf-monitoring) libyang[0]: Module not found or not implemented. (path: /ietf-netconf-monitoring) [2020/12/14 14:33:18.144195, 3] ssh_socket_pollcallback: Received POLLOUT in connecting state [2020/12/14 14:33:18.144265, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 2 [2020/12/14 14:33:18.146493, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:18.146527, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 2 [2020/12/14 14:33:18.148628, 3] callback_receive_banner: Received banner: SSH-2.0-libssh-0.7.1 [2020/12/14 14:33:18.148657, 1] ssh_server_connection_callback: SSH client banner: SSH-2.0-libssh-0.7.1 [2020/12/14 14:33:18.148669, 1] ssh_analyze_banner: Analyzing banner: SSH-2.0-libssh-0.7.1 [2020/12/14 14:33:18.148704, 3] packet_send2: packet: wrote [len=508,padding=10,comp=497,payload=497] [2020/12/14 14:33:18.148737, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:18.148751, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 4 [2020/12/14 14:33:18.150856, 3] ssh_packet_socket_callback: packet: read type 20 [len=436,padding=8,comp=427,payload=427] [2020/12/14 14:33:18.150889, 3] ssh_packet_process: Dispatching handler for packet type 20 [2020/12/14 14:33:18.150933, 3] crypt_set_algorithms_server: Set output algorithm aes256-ctr [2020/12/14 14:33:18.150956, 3] crypt_set_algorithms_server: Set input algorithm aes256-ctr [2020/12/14 14:33:18.150976, 3] crypt_set_algorithms_server: Set HMAC output algorithm to hmac-sha1 [2020/12/14 14:33:18.150994, 3] crypt_set_algorithms_server: Set HMAC input algorithm to hmac-sha1 [2020/12/14 14:33:18.151008, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2020/12/14 14:33:18.153135, 3] ssh_packet_socket_callback: packet: read type 30 [len=44,padding=6,comp=37,payload=37] [2020/12/14 14:33:18.153160, 3] ssh_packet_process: Dispatching handler for packet type 30 [2020/12/14 14:33:18.153170, 3] ssh_packet_kexdh_init: Received SSH_MSG_KEXDH_INIT [2020/12/14 14:33:18.160859, 2] ssh_server_curve25519_init: SSH_MSG_KEX_ECDH_REPLY sent [2020/12/14 14:33:18.160924, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:18.160971, 3] packet_send2: packet: wrote [len=604,padding=8,comp=595,payload=595] [2020/12/14 14:33:18.160987, 3] packet_send2: packet: wrote [len=12,padding=10,comp=1,payload=1] [2020/12/14 14:33:18.160997, 2] ssh_server_curve25519_init: SSH_MSG_NEWKEYS sent [2020/12/14 14:33:18.161030, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:18.161045, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2020/12/14 14:33:18.163140, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2020/12/14 14:33:18.165258, 3] ssh_packet_socket_callback: packet: read type 21 [len=12,padding=10,comp=1,payload=1] [2020/12/14 14:33:18.165279, 3] ssh_packet_process: Dispatching handler for packet type 21 [2020/12/14 14:33:18.165289, 2] ssh_packet_newkeys: Received SSH_MSG_NEWKEYS [2020/12/14 14:33:18.165327, 3] ssh_packet_socket_callback: Processing 52 bytes left in socket buffer [2020/12/14 14:33:18.165358, 3] ssh_packet_socket_callback: packet: read type 5 [len=28,padding=10,comp=17,payload=17] [2020/12/14 14:33:18.165369, 3] ssh_packet_process: Dispatching handler for packet type 5 [2020/12/14 14:33:18.165382, 3] ssh_packet_service_request: Received a SERVICE_REQUEST for service ssh-userauth [2020/12/14 14:33:18.165408, 3] ssh_message_service_reply_success: Sending a SERVICE_ACCEPT for service ssh-userauth [2020/12/14 14:33:18.165442, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:18.165457, 3] packet_send2: packet: wrote [len=28,padding=10,comp=17,payload=17] [2020/12/14 14:33:18.165468, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 7 [2020/12/14 14:33:18.165668, 3] ssh_packet_socket_callback: packet: read type 50 [len=44,padding=6,comp=37,payload=37] [2020/12/14 14:33:18.165685, 3] ssh_packet_process: Dispatching handler for packet type 50 [2020/12/14 14:33:18.165697, 3] ssh_packet_userauth_request: Auth request for service ssh-connection, method none for user 'tester' [2020/12/14 14:33:18.165714, 3] ssh_auth_reply_default: Sending a auth failure. methods that can continue: publickey,keyboard-interactive,password [2020/12/14 14:33:18.165749, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:18.165763, 3] packet_send2: packet: wrote [len=60,padding=14,comp=45,payload=45] [2020/12/14 14:33:18.165957, 3] ssh_packet_socket_callback: packet: read type 50 [len=76,padding=14,comp=61,payload=61] [2020/12/14 14:33:18.165975, 3] ssh_packet_process: Dispatching handler for packet type 50 [2020/12/14 14:33:18.165986, 3] ssh_packet_userauth_request: Auth request for service ssh-connection, method keyboard-interactive for user 'tester' [2020/12/14 14:33:18.166009, 3] packet_send2: packet: wrote [len=92,padding=10,comp=81,payload=81] [2020/12/14 14:33:18.166020, 2] ssh_message_auth_interactive_request: Warning: Got a keyboard-interactive response but it seems we didn't send the request. [2020/12/14 14:33:18.166051, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:21.287842, 3] ssh_packet_socket_callback: packet: read type 61 [len=28,padding=12,comp=15,payload=15] [2020/12/14 14:33:21.287892, 3] ssh_packet_process: Dispatching handler for packet type 61 [2020/12/14 14:33:21.287905, 3] ssh_packet_userauth_info_response: kbdint: 1 answers [2020/12/14 14:33:21.301042, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:21.301086, 3] packet_send2: packet: wrote [len=12,padding=10,comp=1,payload=1] [2020/12/14 14:33:21.301314, 3] ssh_packet_socket_callback: packet: read type 90 [len=44,padding=19,comp=24,payload=24] [2020/12/14 14:33:21.301334, 3] ssh_packet_process: Dispatching handler for packet type 90 [2020/12/14 14:33:21.301346, 3] ssh_packet_channel_open: Clients wants to open a session channel [2020/12/14 14:33:21.301365, 3] ssh_message_channel_request_open_reply_accept_channel: Accepting a channel request_open for chan 43 [2020/12/14 14:33:21.301401, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:21.301416, 3] packet_send2: packet: wrote [len=28,padding=10,comp=17,payload=17] [2020/12/14 14:33:21.301611, 3] ssh_packet_socket_callback: packet: read type 98 [len=44,padding=13,comp=30,payload=30] [2020/12/14 14:33:21.301629, 3] ssh_packet_process: Dispatching handler for packet type 98 [2020/12/14 14:33:21.301644, 3] ssh_message_handle_channel_request: Received a subsystem channel_request for channel (43:43) (want_reply=1) [2020/12/14 14:33:21.301660, 3] ssh_message_channel_request_reply_success: Sending a channel_request success to channel 43 [2020/12/14 14:33:21.301677, 3] packet_send2: packet: wrote [len=12,padding=6,comp=5,payload=5] [2020/12/14 14:33:21.301705, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:21.301817, 3] packet_send2: packet: wrote [len=956,padding=6,comp=949,payload=949] [2020/12/14 14:33:21.301832, 3] channel_write_common: channel_write wrote 940 bytes [2020/12/14 14:33:21.301866, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:21.301899, 3] packet_send2: packet: wrote [len=428,padding=18,comp=409,payload=409] [2020/12/14 14:33:21.301911, 3] channel_write_common: channel_write wrote 400 bytes [2020/12/14 14:33:21.301935, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:21.301956, 3] packet_send2: packet: wrote [len=28,padding=12,comp=15,payload=15] [2020/12/14 14:33:21.301968, 3] channel_write_common: channel_write wrote 6 bytes [2020/12/14 14:33:21.301989, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:21.305397, 3] ssh_packet_socket_callback: packet: read type 94 [len=220,padding=4,comp=215,payload=215] [2020/12/14 14:33:21.305419, 3] ssh_packet_process: Dispatching handler for packet type 94 [2020/12/14 14:33:21.305430, 3] channel_rcv_data: Channel receiving 206 bytes data in 0 (local win=32000 remote win=62654) [2020/12/14 14:33:21.305442, 3] channel_default_bufferize: placing 206 bytes into channel buffer (stderr=0) [2020/12/14 14:33:21.305460, 3] channel_rcv_data: Channel windows are now (local win=31794 remote win=62654) [2020/12/14 14:33:21.305479, 3] ssh_channel_read_timeout: Read (6) buffered : 206 bytes. Window: 31794 [2020/12/14 14:33:21.305522, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/14 14:33:21.305539, 3] packet_send2: packet: wrote [len=28,padding=18,comp=9,payload=9] [2020/12/14 14:33:21.305549, 2] grow_window: growing window (channel 43:43) to 1280000 bytes [2020/12/14 14:33:21.305561, 3] ssh_channel_read_timeout: Read (6) buffered : 200 bytes. Window: 1280000 [2020/12/14 14:33:21.305573, 3] ssh_channel_read_timeout: Read (6) buffered : 194 bytes. Window: 1280000 [2020/12/14 14:33:21.305584, 3] ssh_channel_read_timeout: Read (6) buffered : 188 bytes. Window: 1280000 [2020/12/14 14:33:21.305595, 3] ssh_channel_read_timeout: Read (6) buffered : 182 bytes. Window: 1280000 [2020/12/14 14:33:21.305606, 3] ssh_channel_read_timeout: Read (6) buffered : 176 bytes. Window: 1280000 [2020/12/14 14:33:21.305617, 3] ssh_channel_read_timeout: Read (6) buffered : 170 bytes. Window: 1280000 [2020/12/14 14:33:21.305628, 3] ssh_channel_read_timeout: Read (6) buffered : 164 bytes. Window: 1280000 [2020/12/14 14:33:21.305639, 3] ssh_channel_read_timeout: Read (6) buffered : 158 bytes. Window: 1280000 [2020/12/14 14:33:21.305650, 3] ssh_channel_read_timeout: Read (6) buffered : 152 bytes. Window: 1280000 [2020/12/14 14:33:21.305660, 3] ssh_channel_read_timeout: Read (6) buffered : 146 bytes. Window: 1280000 [2020/12/14 14:33:21.305671, 3] ssh_channel_read_timeout: Read (6) buffered : 140 bytes. Window: 1280000 [2020/12/14 14:33:21.305682, 3] ssh_channel_read_timeout: Read (6) buffered : 134 bytes. Window: 1280000 [2020/12/14 14:33:21.305693, 3] ssh_channel_read_timeout: Read (6) buffered : 128 bytes. Window: 1280000 [2020/12/14 14:33:21.305704, 3] ssh_channel_read_timeout: Read (6) buffered : 122 bytes. Window: 1280000 [2020/12/14 14:33:21.305714, 3] ssh_channel_read_timeout: Read (6) buffered : 116 bytes. Window: 1280000 [2020/12/14 14:33:21.305725, 3] ssh_channel_read_timeout: Read (6) buffered : 110 bytes. Window: 1280000 [2020/12/14 14:33:21.305736, 3] ssh_channel_read_timeout: Read (6) buffered : 104 bytes. Window: 1280000 [2020/12/14 14:33:21.305747, 3] ssh_channel_read_timeout: Read (6) buffered : 98 bytes. Window: 1280000 [2020/12/14 14:33:21.305758, 3] ssh_channel_read_timeout: Read (6) buffered : 92 bytes. Window: 1280000 [2020/12/14 14:33:21.305769, 3] ssh_channel_read_timeout: Read (6) buffered : 86 bytes. Window: 1280000 [2020/12/14 14:33:21.305779, 3] ssh_channel_read_timeout: Read (6) buffered : 80 bytes. Window: 1280000 [2020/12/14 14:33:21.305790, 3] ssh_channel_read_timeout: Read (6) buffered : 74 bytes. Window: 1280000 [2020/12/14 14:33:21.305801, 3] ssh_channel_read_timeout: Read (6) buffered : 68 bytes. Window: 1280000 [2020/12/14 14:33:21.305812, 3] ssh_channel_read_timeout: Read (6) buffered : 62 bytes. Window: 1280000 [2020/12/14 14:33:21.305822, 3] ssh_channel_read_timeout: Read (6) buffered : 56 bytes. Window: 1280000 [2020/12/14 14:33:21.305833, 3] ssh_channel_read_timeout: Read (6) buffered : 50 bytes. Window: 1280000 [2020/12/14 14:33:21.305843, 3] ssh_channel_read_timeout: Read (6) buffered : 44 bytes. Window: 1280000 [2020/12/14 14:33:21.305854, 3] ssh_channel_read_timeout: Read (6) buffered : 38 bytes. Window: 1280000 [2020/12/14 14:33:21.305865, 3] ssh_channel_read_timeout: Read (6) buffered : 32 bytes. Window: 1280000 [2020/12/14 14:33:21.305876, 3] ssh_channel_read_timeout: Read (6) buffered : 26 bytes. Window: 1280000 [2020/12/14 14:33:21.305886, 3] ssh_channel_read_timeout: Read (6) buffered : 20 bytes. Window: 1280000 [2020/12/14 14:33:21.305897, 3] ssh_channel_read_timeout: Read (6) buffered : 14 bytes. Window: 1280000 [2020/12/14 14:33:21.305908, 3] ssh_channel_read_timeout: Read (6) buffered : 8 bytes. Window: 1280000 [2020/12/14 14:33:21.305919, 3] ssh_channel_read_timeout: Read (6) buffered : 2 bytes. Window: 1280000 [2020/12/14 14:33:21.305929, 3] ssh_channel_read_timeout: Read (4) buffered : 0 bytes. Window: 1280000 [2020/12/14 14:33:21.305949, 3] ssh_packet_socket_callback: packet: read type 94 [len=28,padding=12,comp=15,payload=15] [2020/12/14 14:33:21.305960, 3] ssh_packet_process: Dispatching handler for packet type 94 [2020/12/14 14:33:21.305971, 3] channel_rcv_data: Channel receiving 6 bytes data in 0 (local win=1280000 remote win=62654) [2020/12/14 14:33:21.305981, 3] channel_default_bufferize: placing 6 bytes into channel buffer (stderr=0) [2020/12/14 14:33:21.305990, 3] channel_rcv_data: Channel windows are now (local win=1279994 remote win=62654) [2020/12/14 14:33:21.306002, 3] ssh_channel_read_timeout: Read (2) buffered : 2 bytes. Window: 1279994 session

But still failure in netooper2-cli: ./netopeer2-cli

connect --port 12324 --login tester Interactive SSH Authentication Type your password: Password: ly ERROR: Importing "ietf-netconf-acm" module into "ietf-netconf" failed. ly ERROR: Module "ietf-netconf" parsing failed. nc ERROR: Loading base NETCONF schema failed. cmd_connect: Connecting to the localhost:12324 as user "tester" failed.

Rohit2387 avatar Dec 14 '20 09:12 Rohit2387

Oh, you should have pasted the full netopeer2-cli error. Since your server does not support <get-schema> (in ietf-netconf-monitoring module), the client must load the base modules on its own and it seems it cannot find those modules. You can set the search directory using searchpath command, point to netopeer2/modules for example.

michalvasko avatar Dec 14 '20 09:12 michalvasko

OK,Can u give the example?

Rohit2387 avatar Dec 14 '20 09:12 Rohit2387

Example of what exactly? Using the searchpath command? It is netopeer2-cli command, I though it was obvious, sorry if not. But please do not ask me to give you examples of the CLI commands, those are trivial and every command has even its help.

michalvasko avatar Dec 14 '20 09:12 michalvasko

You mean the client and server both doesn't have common module? If i put all server module present inside client path then it should work? netopeer2-cli will read module from modules folder placed inside netopper2?

Rohit2387 avatar Dec 14 '20 09:12 Rohit2387

It seems still loading of module in not proper in server, i need to check and correct it ,still error when i start server. libyang[0]: Schema node not found. (path: /ietf-netconf:commit) libyang[0]: Invalid arguments (lys_set_private()).

Rohit2387 avatar Dec 14 '20 09:12 Rohit2387

Look, I am sorry but I just do not have time right now to explain to you all the details of setting up a server correctly. It is up to you since you decided to write your own and not use netopeer2-server. This last error is due to not having candidate capability supported in ietf-netconf, you can (obviously) support only RPCs that have their if-features satisfied.

michalvasko avatar Dec 14 '20 09:12 michalvasko

Thanks for your help,let me try to check further details through libnetconf2 and libyang API documention.

Rohit2387 avatar Dec 14 '20 09:12 Rohit2387

Intial debugging shows that after hello mesage it is not able to proceed further,it is geting hung in while loop. The session callback currently i added only printf.I need to check now what all things i should add in session callback to procedd further. Only once message type is coming as 3. and then inside while it is coming as 1. while (1) { /* try to accept new NETCONF sessions */ if (nc_server_endpt_count()) { msgtype = nc_accept(0, &ncs); printf("msgtype is %d\n",msgtype); if (msgtype == NC_MSG_HELLO) { np2srv_new_session_cb(NULL, ncs); } }

    /* listen for incoming requests on active NETCONF sessions */
    rc = nc_ps_poll(ps,NC_PS_POLL_TIMEOUT, &ncs);

    if ((rc )) {
        /* if there is no active session, timeout, or an error, rest for a while */
        sleep(1);
        continue;
    }

Rohit2387 avatar Dec 14 '20 10:12 Rohit2387

HI,

i used libyang master and libnectonf2 master package for testing. But below error is coming. Is this due to some version diffenrece?or issue with some yang module feature not enable in server? nc ERROR: Session 2: failed to send the RPC. ly ERROR: Importing "ietf-netconf-acm" module into "ietf-netconf" failed. ly ERROR: Module "ietf-netconf" parsing failed. nc ERROR: Loading base NETCONF schema failed.

Rohit2387 avatar Dec 15 '20 05:12 Rohit2387

Did you increase the verbosity? Is this a server or client error?

michalvasko avatar Dec 15 '20 07:12 michalvasko

client

Rohit2387 avatar Dec 15 '20 08:12 Rohit2387

Client side traces:

ly VERBOSE: Resolving derived type "union" failed, it will be attempted later. ly VERBOSE: Resolving derived type "union" failed, it will be attempted later. ly VERBOSE: Resolving "ietf-inet-types" unresolved schema nodes and their constraints... ly VERBOSE: All "ietf-inet-types" schema nodes and constraints resolved. ly VERBOSE: Module "ietf-inet-types@2013-07-15" successfully parsed as implemented. ly VERBOSE: Reading module "ietf-yang-types". ly VERBOSE: Module "ietf-yang-types@2013-07-15" successfully parsed as implemented. [2020/12/15 14:42:02.573753, 2] grow_window: growing window (channel 43:43) to 1280000 bytes nc VERBOSE: Session 2: capability for support found. nc VERBOSE: Session 2: capability for yang-library support found. ly VERBOSE: Module "ietf-netconf-monitoring@2010-10-04" successfully parsed as implemented. nc VERBOSE: Session 2: retreiving data for schema "ietf-netconf", revision "2013-09-29". nc VERBOSE: Session 2: reading schema from server via get-schema. [2020/12/15 14:42:02.576093, 2] channel_rcv_change_window: Adding 1248206 bytes to channel (43:43) (from 31782 bytes) nc ERROR: Session 2: SSH channel unexpectedly closed. nc ERROR: Session 2: failed to send the RPC. ly ERROR: Importing "ietf-netconf-acm" module into "ietf-netconf" failed. ly ERROR: Module "ietf-netconf" parsing failed.

Rohit2387 avatar Dec 15 '20 09:12 Rohit2387

Then this is some problem on the server side, it "unexpectedly closed" the channel.

michalvasko avatar Dec 15 '20 09:12 michalvasko

Server side traces: [2020/12/15 15:25:31.531266, 3] ssh_packet_process: Dispatching handler for packet type 94 [2020/12/15 15:25:31.531277, 3] channel_rcv_data: Channel receiving 6 bytes data in 0 (local win=1280000 remote win=62755) [2020/12/15 15:25:31.531287, 3] channel_default_bufferize: placing 6 bytes into channel buffer (stderr=0) [2020/12/15 15:25:31.531310, 3] channel_rcv_data: Channel windows are now (local win=1279994 remote win=62755) [2020/12/15 15:25:31.531333, 3] ssh_channel_read_timeout: Read (2) buffered : 2 bytes. Window: 1279994 msgtype is 3 [ERR]: nc_ps_add_session: invalid argument (ps). [ERR]: nc_ps_add_session: invalid argument (ps). [ERR]: nc_ps_add_session: invalid argument (ps). [2020/12/15 15:25:31.531429, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/15 15:25:31.531446, 3] packet_send2: packet: wrote [len=12,padding=6,comp=5,payload=5] [2020/12/15 15:25:31.531456, 3] ssh_channel_send_eof: Sent a EOF on client channel (43:43) [2020/12/15 15:25:31.531473, 3] packet_send2: packet: wrote [len=12,padding=6,comp=5,payload=5] [2020/12/15 15:25:31.531483, 3] ssh_channel_close: Sent a close on client channel (43:43) [2020/12/15 15:25:31.531508, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/12/15 15:25:31.531538, 3] packet_send2: packet: wrote [len=28,padding=11,comp=16,payload=16]

Rohit2387 avatar Dec 15 '20 09:12 Rohit2387

Working now np2srv.nc_ps was having NULL value.Due to which it is failing.Thanks.

Rohit2387 avatar Dec 15 '20 10:12 Rohit2387