summaryrefslogtreecommitdiff
path: root/ovsdb
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@ovn.org>2022-03-10 23:33:17 +0100
committerIlya Maximets <i.maximets@ovn.org>2022-03-30 16:59:02 +0200
commit08e9e5337383afd16a225334cb2549a027280537 (patch)
treef44083d488afa2c2ad25188385d899e29431186c /ovsdb
parentd96d14b14733c557d11768ebfe3f92d858b0a79f (diff)
downloadopenvswitch-08e9e5337383afd16a225334cb2549a027280537.tar.gz
ovsdb: raft: Fix inability to read the database with DNS host names.
Clustered OVSDB allows to use DNS names as addresses of raft members. However, if DNS resolution fails during the initial database read, this causes a fatal failure and exit of the ovsdb-server process. Also, if DNS name of a joining server is not resolvable for one of the followers, this follower will reject append requests for a new server to join until the name is successfully resolved. This makes a follower effectively non-functional while DNS is unavailable. To fix the problem relax the address verification. Allowing validation to pass if only name resolution failed and the address is valid otherwise. This will allow addresses to be added to the database, so connections could be established later when the DNS is available. Additionally fixing missed initialization of the dns-resolve module. Without it, DNS requests are blocking. This causes unexpected delays in runtime. Fixes: 771680d96fb6 ("DNS: Add basic support for asynchronous DNS resolving") Reported-at: https://bugzilla.redhat.com/2055097 Acked-by: Dumitru Ceara <dceara@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ovsdb')
-rw-r--r--ovsdb/ovsdb-server.c3
-rw-r--r--ovsdb/raft-private.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index b975c17fc..a4f6bca73 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -26,6 +26,7 @@
#include "command-line.h"
#include "daemon.h"
#include "dirs.h"
+#include "dns-resolve.h"
#include "openvswitch/dynamic-string.h"
#include "fatal-signal.h"
#include "file.h"
@@ -329,6 +330,7 @@ main(int argc, char *argv[])
service_start(&argc, &argv);
fatal_ignore_sigpipe();
process_init();
+ dns_resolve_init(true);
bool active = false;
parse_options(argc, argv, &db_filenames, &remotes, &unixctl_path,
@@ -511,6 +513,7 @@ main(int argc, char *argv[])
run_command, process_status_msg(status));
}
}
+ dns_resolve_destroy();
perf_counters_destroy();
service_stop();
return 0;
diff --git a/ovsdb/raft-private.c b/ovsdb/raft-private.c
index 30760233e..4145c8729 100644
--- a/ovsdb/raft-private.c
+++ b/ovsdb/raft-private.c
@@ -36,7 +36,10 @@ raft_address_validate(const char *address)
return NULL;
} else if (!strncmp(address, "ssl:", 4) || !strncmp(address, "tcp:", 4)) {
struct sockaddr_storage ss;
- if (!inet_parse_active(address + 4, -1, &ss, true)) {
+ bool dns_failure = false;
+
+ if (!inet_parse_active(address + 4, -1, &ss, true, &dns_failure)
+ && !dns_failure) {
return ovsdb_error(NULL, "%s: syntax error in address", address);
}
return NULL;