#include "trigger.h"
#include "util.h"
#include "unixctl.h"
-
#include "vlog.h"
-#define THIS_MODULE VLM_ovsdb_server
+VLOG_DEFINE_THIS_MODULE(ovsdb_server)
+
+#if HAVE_OPENSSL
/* SSL configuration. */
static char *private_key_file;
static char *certificate_file;
static char *ca_cert_file;
static bool bootstrap_ca_cert;
+#endif
static unixctl_cb_func ovsdb_server_exit;
static unixctl_cb_func ovsdb_server_compact;
+static unixctl_cb_func ovsdb_server_reconnect;
static void parse_options(int argc, char *argv[], char **file_namep,
struct shash *remotes, char **unixctl_pathp,
proctitle_init(argc, argv);
set_program_name(argv[0]);
- time_init();
- vlog_init();
signal(SIGPIPE, SIG_IGN);
process_init();
unixctl_command_register("exit", ovsdb_server_exit, &exiting);
unixctl_command_register("ovsdb-server/compact", ovsdb_server_compact,
file);
+ unixctl_command_register("ovsdb-server/reconnect", ovsdb_server_reconnect,
+ jsonrpc);
exiting = false;
while (!exiting) {
*tablep = table;
}
+#if HAVE_OPENSSL
static const char *
query_db_string(const struct ovsdb *db, const char *name)
{
return NULL;
}
}
+#endif /* HAVE_OPENSSL */
static void
query_db_remotes(const char *name, const struct ovsdb *db,
ovsdb_jsonrpc_server_set_remotes(jsonrpc, &resolved_remotes);
shash_destroy(&resolved_remotes);
+#if HAVE_OPENSSL
/* Configure SSL. */
- stream_ssl_set_private_key_file(query_db_string(db, private_key_file));
- stream_ssl_set_certificate_file(query_db_string(db, certificate_file));
+ stream_ssl_set_key_and_cert(query_db_string(db, private_key_file),
+ query_db_string(db, certificate_file));
stream_ssl_set_ca_cert_file(query_db_string(db, ca_cert_file),
bootstrap_ca_cert);
+#endif
}
static void
}
}
+/* "ovsdb-server/reconnect": makes ovsdb-server drop all of its JSON-RPC
+ * connections and reconnect. */
+static void
+ovsdb_server_reconnect(struct unixctl_conn *conn, const char *args OVS_UNUSED,
+ void *jsonrpc_)
+{
+ struct ovsdb_jsonrpc_server *jsonrpc = jsonrpc_;
+
+ ovsdb_jsonrpc_server_reconnect(jsonrpc);
+ unixctl_command_reply(conn, 200, NULL);
+}
+
static void
parse_options(int argc, char *argv[], char **file_namep,
struct shash *remotes, char **unixctl_pathp,
vlog_usage();
printf("\nOther options:\n"
" --run COMMAND run COMMAND as subprocess then exit\n"
+ " --unixctl=SOCKET override default control socket name\n"
" -h, --help display this help message\n"
" -V, --version display version information\n");
leak_checker_usage();