#include "buffer.h"
#include "command-line.h"
#include "compiler.h"
+#include "daemon.h"
#include "fault.h"
#include "flow.h"
#include "learning-switch.h"
static struct mac_learning *local_ml;
/* -f, --fail: Behavior when the connection to the controller fails. */
-static enum fail_mode fail_mode;
+static enum fail_mode fail_mode = FAIL_OPEN;
/* -d, --fail-open-delay: Number of seconds after which to fail open, when
* fail_mode is FAIL_OPEN. */
fatal(retval, "Could not listen for vlog connections");
}
+ daemonize();
+
relay_create(rconn_new(argv[optind], 1), rconn_new(argv[optind + 1], 1),
false);
for (;;) {
{"fail", required_argument, 0, 'f'},
{"fail-open-delay", required_argument, 0, 'd'},
{"listen", required_argument, 0, 'l'},
+ {"detach", no_argument, 0, 'D'},
+ {"pidfile", optional_argument, 0, 'P'},
{"verbose", optional_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
}
break;
+ case 'D':
+ set_detach();
+ break;
+
+ case 'P':
+ set_pidfile(optarg ? optarg : "secchan.pid");
+ break;
+
case 'l':
if (listen_vconn_name) {
fatal(0, "-l or --listen may be only specified once");
static void
usage(void)
{
- printf("%s: Secure Channel, a relay for OpenFlow messages.\n"
- "usage: %s [OPTIONS] LOCAL REMOTE\n"
- "where LOCAL and REMOTE are active OpenFlow connection methods.\n",
+ printf("%s: secure channel, a relay for OpenFlow messages.\n"
+ "usage: %s [OPTIONS] nl:DP_IDX CONTROLLER\n"
+ "where nl:DP_IDX is a datapath that has been added with dpctl\n"
+ "and CONTROLLER is an active OpenFlow connection method.\n",
program_name, program_name);
vconn_usage(true, true);
printf("\nNetworking options:\n"
" -f, --fail=open|closed when controller connection fails:\n"
- " closed (default): drop all packets\n"
- " open: act as learning switch\n"
+ " closed: drop all packets\n"
+ " open (default): act as learning switch\n"
" -d, --fail-open-delay=SECS number of seconds after which to\n"
" fail open if --fail=open (default: 30)\n"
" -l, --listen=METHOD allow management connections on METHOD\n"
" (a passive OpenFlow connection method)\n"
"\nOther options:\n"
+ " -D, --detach run in background as daemon\n"
+ " -P, --pidfile[=FILE] create pidfile (default: %s/secchan.pid)\n"
+ " -v, --verbose=MODULE:FACILITY:LEVEL configure logging levels\n"
" -v, --verbose set maximum verbosity level\n"
" -h, --help display this help message\n"
- " -V, --version display version information\n");
+ " -V, --version display version information\n",
+ RUNDIR);
exit(EXIT_SUCCESS);
}