X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=vswitchd%2Fovs-vswitchd.c;h=2a86972657af4636dd53757a5ca0a2c1ebd6344d;hb=c5432756f10792f548d9365481564cf821d48651;hp=a71eecccc820054f7fe91b425a52e13ea442c6b3;hpb=5a08f9b04417ad1dc343861f3be3975a5cbd074c;p=sliver-openvswitch.git diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index a71eecccc..2a8697265 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -30,9 +30,12 @@ #include "command-line.h" #include "compiler.h" #include "daemon.h" +#include "dirs.h" +#include "dpif.h" #include "dummy.h" #include "leak-checker.h" #include "netdev.h" +#include "openflow/openflow.h" #include "ovsdb-idl.h" #include "poll-loop.h" #include "process.h" @@ -52,7 +55,7 @@ VLOG_DEFINE_THIS_MODULE(vswitchd); static unixctl_cb_func ovs_vswitchd_exit; -static const char *parse_options(int argc, char *argv[]); +static char *parse_options(int argc, char *argv[]); static void usage(void) NO_RETURN; int @@ -60,7 +63,7 @@ main(int argc, char *argv[]) { struct unixctl_server *unixctl; struct signal *sighup; - const char *remote; + char *remote; bool exiting; int retval; @@ -79,15 +82,19 @@ main(int argc, char *argv[]) if (retval) { exit(EXIT_FAILURE); } - unixctl_command_register("exit", ovs_vswitchd_exit, &exiting); + unixctl_command_register("exit", "", 0, 0, ovs_vswitchd_exit, &exiting); bridge_init(remote); + free(remote); + exiting = false; while (!exiting) { if (signal_poll(sighup)) { vlog_reopen_log_file(); } + bridge_run_fast(); bridge_run(); + bridge_run_fast(); unixctl_server_run(unixctl); netdev_run(); @@ -107,7 +114,7 @@ main(int argc, char *argv[]) return 0; } -static const char * +static char * parse_options(int argc, char *argv[]) { enum { @@ -117,6 +124,7 @@ parse_options(int argc, char *argv[]) LEAK_CHECKER_OPTION_ENUMS, OPT_BOOTSTRAP_CA_CERT, OPT_ENABLE_DUMMY, + OPT_DISABLE_SYSTEM, DAEMON_OPTION_ENUMS }; static struct option long_options[] = { @@ -130,6 +138,7 @@ parse_options(int argc, char *argv[]) {"peer-ca-cert", required_argument, NULL, OPT_PEER_CA_CERT}, {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT}, {"enable-dummy", no_argument, NULL, OPT_ENABLE_DUMMY}, + {"disable-system", no_argument, NULL, OPT_DISABLE_SYSTEM}, {NULL, 0, NULL, 0}, }; char *short_options = long_options_to_short_options(long_options); @@ -143,12 +152,11 @@ parse_options(int argc, char *argv[]) } switch (c) { - case 'H': case 'h': usage(); case 'V': - OVS_PRINT_VERSION(OFP_VERSION, OFP_VERSION); + ovs_print_version(OFP_VERSION, OFP_VERSION); exit(EXIT_SUCCESS); case OPT_MLOCKALL: @@ -178,6 +186,10 @@ parse_options(int argc, char *argv[]) dummy_enable(); break; + case OPT_DISABLE_SYSTEM: + dp_blacklist_provider("system"); + break; + case '?': exit(EXIT_FAILURE); @@ -190,21 +202,27 @@ parse_options(int argc, char *argv[]) argc -= optind; argv += optind; - if (argc != 1) { - VLOG_FATAL("database socket is only non-option argument; " + switch (argc) { + case 0: + return xasprintf("unix:%s/db.sock", ovs_rundir()); + + case 1: + return xstrdup(argv[0]); + + default: + VLOG_FATAL("at most one non-option argument accepted; " "use --help for usage"); } - - return argv[0]; } static void usage(void) { printf("%s: Open vSwitch daemon\n" - "usage: %s [OPTIONS] DATABASE\n" - "where DATABASE is a socket on which ovsdb-server is listening.\n", - program_name, program_name); + "usage: %s [OPTIONS] [DATABASE]\n" + "where DATABASE is a socket on which ovsdb-server is listening\n" + " (default: \"unix:%s/db.sock\").\n", + program_name, program_name, ovs_rundir()); stream_usage("DATABASE", true, false, true); daemon_usage(); vlog_usage(); @@ -216,8 +234,8 @@ usage(void) } static void -ovs_vswitchd_exit(struct unixctl_conn *conn, const char *args OVS_UNUSED, - void *exiting_) +ovs_vswitchd_exit(struct unixctl_conn *conn, int argc OVS_UNUSED, + const char *argv[] OVS_UNUSED, void *exiting_) { bool *exiting = exiting_; *exiting = true;