Bug fix. 59/6059/1
authorAlex Stancu <alexandru.stancu@highstreet-technologies.com>
Tue, 11 May 2021 11:44:49 +0000 (14:44 +0300)
committerAlex Stancu <alexandru.stancu@highstreet-technologies.com>
Tue, 11 May 2021 11:44:57 +0000 (14:44 +0300)
Allow SSH_CONNECTIONS=0 as long as TLS_CONNECTIONS > 0

Issue-ID: SIM-69
Change-Id: If923c9068bc8c0d50fbbf0430c0782c119a1e754
Signed-off-by: Alex Stancu <alexandru.stancu@highstreet-technologies.com>
ntsimulator/ntsim-ng/core/nc_config.c

index fdd1bd9..7700595 100644 (file)
@@ -630,15 +630,17 @@ static int configure_endpoints_connections(sr_session_ctx_t *session) {
         ssh_connections = framework_environment.settings.ssh_connections;
     }
 
-    if(ssh_connections == 0) {
-        log_error("ssh_connections must be at least 1\n");
+    if(ssh_connections + framework_environment.settings.tls_connections == 0) {
+        log_error("ssh_connections + tls_connections must be at least 1\n");
         return NTS_ERR_FAILED;
     }
 
-    rc = create_ssh_listen_endpoints(netconf_node, ssh_connections);
-    if(rc != NTS_ERR_OK) {
-        log_error("could not create %d SSH Listen endpoints on the NETCONF Server\n", ssh_connections);
-        return NTS_ERR_FAILED;
+    if (ssh_connections > 0) {
+        rc = create_ssh_listen_endpoints(netconf_node, ssh_connections);
+        if(rc != NTS_ERR_OK) {
+            log_error("could not create %d SSH Listen endpoints on the NETCONF Server\n", ssh_connections);
+            return NTS_ERR_FAILED;
+        }
     }
 
     // create the TLS endpoints in ietf-netconf-server