prior to the patch, the last monitor vconn copied to the deleted one,
causing the monitor fd to be leaked, the patch fixes it.

Also update tests to cover this issue.

Signed-off-by: Chander Wu <[email protected]>
---
 lib/rconn.c        | 1 +
 tests/ovs-ofctl.at | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/rconn.c b/lib/rconn.c
index 4afa21515..3815cfed5 100644
--- a/lib/rconn.c
+++ b/lib/rconn.c
@@ -1285,6 +1285,7 @@ close_monitor(struct rconn *rc, size_t idx, int retval)
     VLOG_DBG("%s: closing monitor connection to %s: %s",
              rconn_get_name(rc), vconn_get_name(rc->monitors[idx]),
              ovs_retval_to_string(retval));
+    vconn_close(rc->monitors[idx]);
     rc->monitors[idx] = rc->monitors[--rc->n_monitors];
 }
 
diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index c82af037e..8074a98e8 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -3561,8 +3561,8 @@ dnl setup controller for br0 before starting the 
controller
 AT_CHECK([ovs-vsctl -vsyslog:off set-controller br0 unix:testcontroller])
 
 dnl then start listening on the '.snoop' connection
-on_exit 'kill `cat ovs-ofctl-snoop.pid`'
-AT_CHECK([ovs-ofctl -vsyslog:off --detach --no-chdir 
--pidfile=ovs-ofctl-snoop.pid snoop br0 > snoopbr0.txt 2>&1])
+on_exit 'test -e ovs-ofctl-snoop.pid && kill `cat ovs-ofctl-snoop.pid`'
+AT_CHECK([ovs-ofctl -vsyslog:off --detach --no-chdir --unixctl=snoop.ctl 
--pidfile=ovs-ofctl-snoop.pid  snoop br0 > snoopbr0.txt 2>&1])
 
 dnl finally start the controller
 on_exit 'kill `cat ovs-testcontroller.pid`'
@@ -3574,6 +3574,9 @@ OVS_WAIT_UNTIL([grep -E "OFPT_FEATURES_REQUEST" 
snoopbr0.txt >/dev/null 2>&1])
 OVS_WAIT_UNTIL([grep -E "OFPT_FEATURES_REPLY" snoopbr0.txt >/dev/null 2>&1])
 OVS_WAIT_UNTIL([grep -E "OFPT_SET_CONFIG" snoopbr0.txt >/dev/null 2>&1])
 
+AT_CHECK([ovs-appctl -t $(pwd)/snoop.ctl exit])
+OVS_WAIT_WHILE([test -e ovs-ofctl-snoop.pid])
+
 dnl need to suppress the 'connection failed' WARN message in ovs-vswitchd
 dnl because we need ovs-vswitchd to have the controller config before starting
 dnl the controller to 'snoop' the OpenFlow messages from beginning
-- 
2.39.5

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to