Skip to content

Commit

Permalink
ovs-ofctl: Add --unixctl command line option.
Browse files Browse the repository at this point in the history
This matches the option offered by some other Open vSwitch daemons.  I
intend to use it in tests in an upcoming commit.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Justin Pettit <[email protected]>
  • Loading branch information
blp committed Jul 28, 2014
1 parent c803536 commit 1994501
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions manpages.mk
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,15 @@ utilities/ovs-ofctl.8: \
lib/daemon.man \
lib/ofp-version.man \
lib/ssl.man \
lib/unixctl.man \
lib/vconn-active.man \
lib/vlog.man
utilities/ovs-ofctl.8.in:
lib/common.man:
lib/daemon.man:
lib/ofp-version.man:
lib/ssl.man:
lib/unixctl.man:
lib/vconn-active.man:
lib/vlog.man:

Expand Down
1 change: 1 addition & 0 deletions utilities/ovs-ofctl.8.in
Original file line number Diff line number Diff line change
Expand Up @@ -2119,6 +2119,7 @@ These options currently affect only \fBdump\-flows\fR output.
\fBovs\-ofctl\fR detaches only when executing the \fBmonitor\fR or \
\fBsnoop\fR commands.
.so lib/daemon.man
.so lib/unixctl.man
.SS "Public Key Infrastructure Options"
.so lib/ssl.man
.so lib/vlog.man
Expand Down
13 changes: 12 additions & 1 deletion utilities/ovs-ofctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ static int verbosity;
* "snoop" command? */
static bool timestamp;

/* --unixctl-path: Path to use for unixctl server, for "monitor" and "snoop"
commands. */
static char *unixctl_path;

/* --sort, --rsort: Sort order. */
enum sort_order { SORT_ASC, SORT_DESC };
struct sort_criterion {
Expand Down Expand Up @@ -150,6 +154,7 @@ parse_options(int argc, char *argv[])
OPT_TIMESTAMP,
OPT_SORT,
OPT_RSORT,
OPT_UNIXCTL,
DAEMON_OPTION_ENUMS,
OFP_VERSION_OPTION_ENUMS,
VLOG_OPTION_ENUMS
Expand All @@ -164,6 +169,7 @@ parse_options(int argc, char *argv[])
{"timestamp", no_argument, NULL, OPT_TIMESTAMP},
{"sort", optional_argument, NULL, OPT_SORT},
{"rsort", optional_argument, NULL, OPT_RSORT},
{"unixctl", required_argument, NULL, OPT_UNIXCTL},
{"help", no_argument, NULL, 'h'},
DAEMON_LONG_OPTIONS,
OFP_VERSION_LONG_OPTIONS,
Expand Down Expand Up @@ -254,6 +260,10 @@ parse_options(int argc, char *argv[])
add_sort_criterion(SORT_DESC, optarg);
break;

case OPT_UNIXCTL:
unixctl_path = optarg;
break;

DAEMON_OPTION_HANDLERS
OFP_VERSION_OPTION_HANDLERS
VLOG_OPTION_HANDLERS
Expand Down Expand Up @@ -362,6 +372,7 @@ usage(void)
" -t, --timeout=SECS give up after SECS seconds\n"
" --sort[=field] sort in ascending order\n"
" --rsort[=field] sort in descending order\n"
" --unixctl=SOCKET set control socket name\n"
" -h, --help display this help message\n"
" -V, --version display version information\n");
exit(EXIT_SUCCESS);
Expand Down Expand Up @@ -1438,7 +1449,7 @@ monitor_vconn(struct vconn *vconn, bool reply_to_echo_requests)

daemon_save_fd(STDERR_FILENO);
daemonize_start();
error = unixctl_server_create(NULL, &server);
error = unixctl_server_create(unixctl_path, &server);
if (error) {
ovs_fatal(error, "failed to create unixctl server");
}
Expand Down

0 comments on commit 1994501

Please sign in to comment.