X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=ovsdb%2Fovsdb-server.c;h=45d7a774d38c1b6a3b5b6b8df5f9a6283cb0cdad;hb=59348dba2c4c8cc43a70b1c0265e536ef177c1ab;hp=243243d2e08bf7b13ff1e1024878c0fb78d64db7;hpb=78876719e0eaf181a6775417ad41ec5852efa863;p=sliver-openvswitch.git diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 243243d2e..45d7a774d 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -45,18 +45,21 @@ #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, @@ -84,8 +87,6 @@ main(int argc, char *argv[]) proctitle_init(argc, argv); set_program_name(argv[0]); - time_init(); - vlog_init(); signal(SIGPIPE, SIG_IGN); process_init(); @@ -129,6 +130,8 @@ main(int argc, char *argv[]) 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) { @@ -206,6 +209,7 @@ parse_db_string_column(const struct ovsdb *db, *tablep = table; } +#if HAVE_OPENSSL static const char * query_db_string(const struct ovsdb *db, const char *name) { @@ -218,7 +222,7 @@ query_db_string(const struct ovsdb *db, const char *name) parse_db_string_column(db, name, &table, &column); - HMAP_FOR_EACH (row, struct ovsdb_row, hmap_node, &table->rows) { + HMAP_FOR_EACH (row, hmap_node, &table->rows) { const struct ovsdb_datum *datum; size_t i; @@ -232,6 +236,7 @@ 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, @@ -243,7 +248,7 @@ query_db_remotes(const char *name, const struct ovsdb *db, parse_db_string_column(db, name, &table, &column); - HMAP_FOR_EACH (row, struct ovsdb_row, hmap_node, &table->rows) { + HMAP_FOR_EACH (row, hmap_node, &table->rows) { const struct ovsdb_datum *datum; size_t i; @@ -276,11 +281,13 @@ reconfigure_from_db(struct ovsdb_jsonrpc_server *jsonrpc, 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 @@ -311,6 +318,18 @@ ovsdb_server_compact(struct unixctl_conn *conn, const char *args OVS_UNUSED, } } +/* "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, @@ -433,6 +452,7 @@ usage(void) 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();