From c0d7d630be963b66bf6534d9ea16bc5845dc2521 Mon Sep 17 00:00:00 2001 From: Han Ding Date: Fri, 20 May 2022 17:54:42 +0800 Subject: ovs-tcpdump: Fix error when stopping ovs-tcpdump. Sometimes we need to dump packets on more than two interfaces in a bridge at the same time. Then when we stop dumping in order, ovs-tcpdump print traceback and fail to delete mirror interface for some interface. For example: br-int has two interface tap1 and br-int. We use ovs-tcpdump dump tap1 first and dump br-int next. Then stopping tap1 ovs-tcpdump first, and stopping br-int second. When we stop ovs-tcpdump for br-int, the screen show the error like this: __main__.OVSDBException: Unable to delete Mirror m_br-int Signed-off-by: Han Ding Acked-by: Mike Pattrick Signed-off-by: Ilya Maximets --- utilities/ovs-tcpdump.in | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'utilities') diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in index 82d1bedfa..b3dc65440 100755 --- a/utilities/ovs-tcpdump.in +++ b/utilities/ovs-tcpdump.in @@ -165,6 +165,9 @@ class OVSDB(object): self._idl_conn = idl.Idl(db_sock, schema) OVSDB.wait_for_db_change(self._idl_conn) # Initial Sync with DB + def close_idl(self): + self._idl_conn.close() + def _get_schema(self): error, strm = Stream.open_block(Stream.open(self._db_sock)) if error: @@ -500,6 +503,8 @@ def main(): pass sys.exit(1) + ovsdb.close_idl() + pipes = _doexec(*([dump_cmd, '-i', mirror_interface] + tcpdargs)) try: while pipes.poll() is None: @@ -512,6 +517,7 @@ def main(): if pipes.poll() is None: pipes.terminate() + ovsdb = OVSDB(db_sock) ovsdb.destroy_mirror(interface, ovsdb.port_bridge(interface)) ovsdb.destroy_port(mirror_interface, ovsdb.port_bridge(interface)) if tap_created is True: -- cgit v1.2.1