Then start the main Open vSwitch daemon, telling it to connect to the
same Unix domain socket:
- % ovs-vswitchd unix:/usr/local/var/run/openvswitch/db.sock \
- --pidfile --detach
+ % ovs-vswitchd --pidfile --detach
Now you may use ovs-vsctl to set up bridges and other Open vSwitch
features. For example, to create a bridge named br0 and add ports
ovs\-vswitchd \- Open vSwitch daemon
.
.SH SYNOPSIS
-.B ovs\-vswitchd
-\fIdatabase\fR
+\fBovs\-vswitchd \fR[\fIdatabase\fR]
.
.SH DESCRIPTION
A daemon that manages and controls any number of Open vSwitch switches
on the local machine.
.PP
-The mandatory \fIdatabase\fR argument normally takes the form
-\fBunix:\fIfile\fR, where \fIfile\fR is the name of a Unix domain
-socket on which \fBovsdb\-server\fR is listening. However, all of the
-following forms are accepted:
+The \fIdatabase\fR argument specifies how \fBovs\-vswitchd\fR connects
+to \fBovsdb\-server\fR. The default is \fBunix:@RUNDIR@/db.sock\fR.
+The following forms are accepted:
.so ovsdb/remote-active.man
.so ovsdb/remote-passive.man
.PP
#include "command-line.h"
#include "compiler.h"
#include "daemon.h"
+#include "dirs.h"
#include "dummy.h"
#include "leak-checker.h"
#include "netdev.h"
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
{
struct unixctl_server *unixctl;
struct signal *sighup;
- const char *remote;
+ char *remote;
bool exiting;
int retval;
unixctl_command_register("exit", ovs_vswitchd_exit, &exiting);
bridge_init(remote);
+ free(remote);
+
exiting = false;
while (!exiting) {
if (signal_poll(sighup)) {
return 0;
}
-static const char *
+static char *
parse_options(int argc, char *argv[])
{
enum {
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();