Commit 08e9e5337383 fixed proper initialization of the dns-resolve
module, and made DNS resolution asynchronous.

A side effect of that change revealed a long standing logic bug
which broke ovsdb-server listener configuration using DNS names.

Reported-at: https://bugs.launchpad.net/bugs/1998781
Fixes: 08e9e5337383 ("ovsdb: raft: Fix inability to read the database with DNS 
host names.")
Fixes: 771680d96fb6 ("DNS: Add basic support for asynchronous DNS resolving")
Signed-off-by: Frode Nordahl <[email protected]>
---
 ovsdb/jsonrpc-server.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c
index 916a1f414..1e92785a6 100644
--- a/ovsdb/jsonrpc-server.c
+++ b/ovsdb/jsonrpc-server.c
@@ -267,9 +267,25 @@ ovsdb_jsonrpc_server_add_remote(struct 
ovsdb_jsonrpc_server *svr,
     int error;
 
     error = jsonrpc_pstream_open(name, &listener, options->dscp);
-    if (error && error != EAFNOSUPPORT) {
-        VLOG_ERR_RL(&rl, "%s: listen failed: %s", name, ovs_strerror(error));
-        return NULL;
+    if (error) {
+        switch (error) {
+        case EAFNOSUPPORT:
+            /* Not a listener, attempt creation of active jsonrpc sesssion */
+            break;
+        case ENODATA:
+            /* DNS resolution in progress, or the name does currently not
+             * resolve, need to try again later */
+            VLOG_DBG_RL(&rl,
+                        "%s: listen failed: DNS resolution in progress"
+                        "or host not found",
+                        name);
+            return NULL;
+        default:
+            VLOG_ERR_RL(&rl, "%s: listen failed: %s", name,
+                        ovs_strerror(error));
+            return NULL;
+        }
+        /* FALL THROUGH */
     }
 
     remote = xmalloc(sizeof *remote);
-- 
2.37.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to