vswitch: Fix uninitialized variable.
[openvswitch] / vswitchd / ovs-brcompatd.c
index 34162f3eb1d831ad4cdd95efaeffdfb7ad01fd30..beaefb2e2d88e19faa4fba1c8b49163eb4dbe3b8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2009 Nicira Networks
+/* Copyright (c) 2008, 2009, 2010 Nicira Networks
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -755,7 +755,7 @@ handle_fdb_query_cmd(const struct ovsrec_open_vswitch *ovs,
         struct mac *mac = &local_macs[n_local_macs];
         struct netdev *netdev;
 
-        error = netdev_open(iface_name, NETDEV_ETH_TYPE_NONE, &netdev);
+        error = netdev_open_default(iface_name, &netdev);
         if (netdev) {
             if (!netdev_get_etheraddr(netdev, mac->addr)) {
                 n_local_macs++;
@@ -1144,6 +1144,7 @@ main(int argc, char *argv[])
     struct ovsdb_idl *idl;
     int retval;
 
+    proctitle_init(argc, argv);
     set_program_name(argv[0]);
     time_init();
     vlog_init();
@@ -1153,13 +1154,14 @@ main(int argc, char *argv[])
     remote = parse_options(argc, argv);
     signal(SIGPIPE, SIG_IGN);
     process_init();
+    ovsrec_init();
 
     die_if_already_running();
     daemonize_start();
 
     retval = unixctl_server_create(NULL, &unixctl);
     if (retval) {
-        ovs_fatal(retval, "could not listen for vlog connections");
+        exit(EXIT_FAILURE);
     }
 
     if (brc_open(&brc_sock)) {
@@ -1190,7 +1192,7 @@ main(int argc, char *argv[])
         ovs = ovsrec_open_vswitch_first(idl);
         brc_recv_update(ovs);
 
-        if (!ovs && ovsdb_idl_get_seqno(idl)) {
+        if (!ovs && ovsdb_idl_has_ever_connected(idl)) {
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
             VLOG_WARN_RL(&rl, "%s: database does not contain any Open vSwitch "
                          "configuration", remote);
@@ -1223,7 +1225,6 @@ main(int argc, char *argv[])
             ovsdb_idl_txn_wait(txn);
             poll_block();
         }
-        ovsdb_idl_txn_destroy(txn);
             
         switch (status) {
         case TXN_INCOMPLETE:
@@ -1239,16 +1240,19 @@ main(int argc, char *argv[])
         
         case TXN_TRY_AGAIN:
             /* xxx Handle this better! */
-            printf("xxx We need to try again!\n");
+            VLOG_ERR("OVSDB transaction needs retry");
             break;
 
         case TXN_ERROR:
-            /* xxx Is this what we want to do? */
-            ovs_fatal(0, "transaction error");
-                
+            /* xxx Handle this better! */
+            VLOG_ERR("OVSDB transaction failed: %s",
+                     ovsdb_idl_txn_get_error(txn));
+            break;
+
         default:
             NOT_REACHED();
         }
+        ovsdb_idl_txn_destroy(txn);
 
         nl_sock_wait(brc_sock, POLLIN);
         ovsdb_idl_wait(idl);