X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=vswitchd%2Fovs-vswitchd.c;h=6478156031e4d431a3f1942c994b8faea170bd1d;hb=c1c9c9c4b636ab2acf2f75024c282a9a497ca9a9;hp=c1acfc414e03e1241a48af7e5bbc2ea9c03062bc;hpb=a0bc29a541fc7dc6e20137d5558e2094d614e6ab;p=sliver-openvswitch.git diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index c1acfc414..647815603 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -50,6 +50,8 @@ #include "vlog.h" #define THIS_MODULE VLM_vswitchd +static unixctl_cb_func ovs_vswitchd_exit; + static const char *parse_options(int argc, char *argv[]); static void usage(void) NO_RETURN; @@ -61,7 +63,7 @@ main(int argc, char *argv[]) struct ovsdb_idl *idl; const char *remote; bool need_reconfigure; - bool inited; + bool inited, exiting; unsigned int idl_seqno; int retval; @@ -82,6 +84,7 @@ main(int argc, char *argv[]) if (retval) { exit(EXIT_FAILURE); } + unixctl_command_register("exit", ovs_vswitchd_exit, &exiting); daemonize_complete(); @@ -90,7 +93,8 @@ main(int argc, char *argv[]) need_reconfigure = false; inited = false; - for (;;) { + exiting = false; + while (!exiting) { if (signal_poll(sighup)) { vlog_reopen_log_file(); } @@ -252,3 +256,12 @@ usage(void) leak_checker_usage(); exit(EXIT_SUCCESS); } + +static void +ovs_vswitchd_exit(struct unixctl_conn *conn, const char *args OVS_UNUSED, + void *exiting_) +{ + bool *exiting = exiting_; + *exiting = true; + unixctl_command_reply(conn, 200, NULL); +}