datapath: Backport ip4_dst_hoplimit() from 2.6.38.
[openvswitch] / ovsdb / ovsdb-server.c
index 41f1146cc105f0d87899e33e9e331fc9bbab7b9c..8d44d84857ca866ec8a736b6d0e956dd99ea338a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010 Nicira Networks
+/* Copyright (c) 2009, 2010, 2011 Nicira Networks
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -171,7 +171,7 @@ main(int argc, char *argv[])
     }
     ovsdb_jsonrpc_server_destroy(jsonrpc);
     ovsdb_destroy(db);
-    shash_destroy(&remotes);
+    shash_destroy_free_data(&remotes);
     unixctl_server_destroy(unixctl);
 
     if (run_process && process_exited(run_process)) {
@@ -242,8 +242,7 @@ parse_db_string_column(const struct ovsdb *db,
     *tablep = table;
 }
 
-#if HAVE_OPENSSL
-static const char *
+static OVS_UNUSED const char *
 query_db_string(const struct ovsdb *db, const char *name)
 {
     if (!name || strncmp(name, "db:", 3)) {
@@ -269,7 +268,6 @@ query_db_string(const struct ovsdb *db, const char *name)
         return NULL;
     }
 }
-#endif /* HAVE_OPENSSL */
 
 static struct ovsdb_jsonrpc_options *
 add_remote(struct shash *remotes, const char *target)
@@ -471,7 +469,7 @@ update_remote_row(const struct ovsdb_row *row, struct ovsdb_txn *txn,
     struct ovsdb_row *rw_row;
     const char *target;
     const struct ovsdb_jsonrpc_remote_status *status;
-    char *keys[3], *values[3];
+    char *keys[4], *values[4];
     size_t n = 0;
 
     /* Get the "target" (protocol/host/port) spec. */
@@ -497,8 +495,14 @@ update_remote_row(const struct ovsdb_row *row, struct ovsdb_txn *txn,
 
     keys[n] = xstrdup("state");
     values[n++] = xstrdup(status->state);
-    keys[n] = xstrdup("time_in_state");
-    values[n++] = xasprintf("%u", status->state_elapsed);
+    if (status->sec_since_connect != UINT_MAX) {
+        keys[n] = xstrdup("sec_since_connect");
+        values[n++] = xasprintf("%u", status->sec_since_connect);
+    }
+    if (status->sec_since_disconnect != UINT_MAX) {
+        keys[n] = xstrdup("sec_since_disconnect");
+        values[n++] = xasprintf("%u", status->sec_since_disconnect);
+    }
     if (status->last_error) {
         keys[n] = xstrdup("last_error");
         values[n++] =
@@ -595,7 +599,7 @@ reconfigure_from_db(struct ovsdb_jsonrpc_server *jsonrpc,
         }
     }
     ovsdb_jsonrpc_server_set_remotes(jsonrpc, &resolved_remotes);
-    shash_destroy(&resolved_remotes);
+    shash_destroy_free_data(&resolved_remotes);
 
 #if HAVE_OPENSSL
     /* Configure SSL. */
@@ -658,7 +662,8 @@ parse_options(int argc, char *argv[], char **file_namep,
         OPT_RUN,
         OPT_BOOTSTRAP_CA_CERT,
         VLOG_OPTION_ENUMS,
-        LEAK_CHECKER_OPTION_ENUMS
+        LEAK_CHECKER_OPTION_ENUMS,
+        DAEMON_OPTION_ENUMS
     };
     static struct option long_options[] = {
         {"remote",      required_argument, 0, OPT_REMOTE},