summaryrefslogtreecommitdiff
path: root/debian/ovs-monitor-ipsec
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2012-03-02 18:33:48 -0800
committerEthan Jackson <ethan@nicira.com>2012-03-09 13:37:39 -0800
commit7b2d10c52926cf604273b8935c7bce07fe7868d0 (patch)
treeb6d58aa2235fd6b7f205b1735b0965e393702687 /debian/ovs-monitor-ipsec
parenta256b6e5a98ed6368a83a82a79d4f69f8040c68d (diff)
downloadopenvswitch-7b2d10c52926cf604273b8935c7bce07fe7868d0.tar.gz
ovs-monitor-ipsec: Add unixctl support.
With this patch, users can query a running ovs-monitor-ipsec daemon's version, or ask it to exit using ovs-appctl. Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'debian/ovs-monitor-ipsec')
-rwxr-xr-xdebian/ovs-monitor-ipsec21
1 files changed, 21 insertions, 0 deletions
diff --git a/debian/ovs-monitor-ipsec b/debian/ovs-monitor-ipsec
index 981f0a2c8..e89e70922 100755
--- a/debian/ovs-monitor-ipsec
+++ b/debian/ovs-monitor-ipsec
@@ -37,11 +37,19 @@ from ovs.db import types
import ovs.util
import ovs.daemon
import ovs.db.idl
+import ovs.unixctl
import ovs.vlog
vlog = ovs.vlog.Vlog("ovs-monitor-ipsec")
root_prefix = '' # Prefix for absolute file names, for testing.
setkey = "/usr/sbin/setkey"
+exiting = False
+
+
+def unixctl_exit(conn, unused_argv, unused_aux):
+ global exiting
+ exiting = True
+ conn.reply(None)
# Class to configure the racoon daemon, which handles IKE negotiation
@@ -447,12 +455,22 @@ def main():
ovs.daemon.daemonize()
+ ovs.unixctl.command_register("exit", "", 0, 0, unixctl_exit, None)
+ error, unixctl_server = ovs.unixctl.UnixctlServer.create(None)
+ if error:
+ ovs.util.ovs_fatal(error, "could not create unixctl server", vlog)
+
ipsec = IPsec()
interfaces = {}
while True:
+ unixctl_server.run()
+ if exiting:
+ break
+
if not idl.run():
poller = ovs.poller.Poller()
+ unixctl_server.wait(poller)
idl.wait(poller)
poller.block()
continue
@@ -499,6 +517,9 @@ def main():
update_ipsec(ipsec, interfaces, new_interfaces)
interfaces = new_interfaces
+ unixctl_server.close()
+ idl.close()
+
if __name__ == '__main__':
try: