vswitchd: Incoming LACP packets should un-default links.
[openvswitch] / vswitchd / ovs-vswitchd.c
index a027b8cfe83d339f6cb7ea23b0c1a826136185cf..2181e82e67da2d2ae41e62a518d5992282d007a2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2009, 2010 Nicira Networks
+/* Copyright (c) 2008, 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.
@@ -31,6 +31,7 @@
 #include "compiler.h"
 #include "daemon.h"
 #include "dpif.h"
+#include "dummy.h"
 #include "leak-checker.h"
 #include "netdev.h"
 #include "ovsdb-idl.h"
 #include "signals.h"
 #include "stream-ssl.h"
 #include "stream.h"
+#include "stress.h"
 #include "svec.h"
 #include "timeval.h"
 #include "unixctl.h"
 #include "util.h"
 #include "vconn.h"
+#include "vlog.h"
 #include "vswitchd/vswitch-idl.h"
 
-#include "vlog.h"
-#define THIS_MODULE VLM_vswitchd
+VLOG_DEFINE_THIS_MODULE(vswitchd);
 
 static unixctl_cb_func ovs_vswitchd_exit;
 
@@ -66,6 +68,7 @@ main(int argc, char *argv[])
 
     proctitle_init(argc, argv);
     set_program_name(argv[0]);
+    stress_init_command();
     remote = parse_options(argc, argv);
     signal(SIGPIPE, SIG_IGN);
     sighup = signal_register(SIGHUP);
@@ -81,8 +84,6 @@ main(int argc, char *argv[])
     }
     unixctl_command_register("exit", ovs_vswitchd_exit, &exiting);
 
-    daemonize_complete();
-
     bridge_init(remote);
     exiting = false;
     while (!exiting) {
@@ -99,8 +100,13 @@ main(int argc, char *argv[])
         unixctl_server_wait(unixctl);
         dp_wait();
         netdev_wait();
+        if (exiting) {
+            poll_immediate_wake();
+        }
         poll_block();
     }
+    bridge_exit();
+    unixctl_server_destroy(unixctl);
 
     return 0;
 }
@@ -114,7 +120,9 @@ parse_options(int argc, char *argv[])
         OPT_FAKE_PROC_NET,
         VLOG_OPTION_ENUMS,
         LEAK_CHECKER_OPTION_ENUMS,
-        OPT_BOOTSTRAP_CA_CERT
+        OPT_BOOTSTRAP_CA_CERT,
+        OPT_ENABLE_DUMMY,
+        DAEMON_OPTION_ENUMS
     };
     static struct option long_options[] = {
         {"help",        no_argument, 0, 'h'},
@@ -129,6 +137,7 @@ parse_options(int argc, char *argv[])
         {"peer-ca-cert", required_argument, 0, OPT_PEER_CA_CERT},
         {"bootstrap-ca-cert", required_argument, 0, OPT_BOOTSTRAP_CA_CERT},
 #endif
+        {"enable-dummy", no_argument, 0, OPT_ENABLE_DUMMY},
         {0, 0, 0, 0},
     };
     char *short_options = long_options_to_short_options(long_options);
@@ -185,6 +194,10 @@ parse_options(int argc, char *argv[])
             break;
 #endif
 
+        case OPT_ENABLE_DUMMY:
+            dummy_enable();
+            break;
+
         case '?':
             exit(EXIT_FAILURE);