diff options
author | Martin Fong <mwfong@csl.sri.com> | 2018-11-09 12:16:02 -0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-12-12 09:59:57 -0800 |
commit | 0475db71c650be8a626265002bb15fb7eac58333 (patch) | |
tree | c976691c904c5e64b71990e9ce9257d6018f62c3 /utilities/ovs-tcpdump.in | |
parent | 2220548113d054439afc626d2a606ed27e3b7176 (diff) | |
download | openvswitch-0475db71c650be8a626265002bb15fb7eac58333.tar.gz |
ovs-tcpdump: Add --span to mirror all ports on bridge.
Signed-off-by: Martin Fong <mwfong@csl.sri.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'utilities/ovs-tcpdump.in')
-rwxr-xr-x | utilities/ovs-tcpdump.in | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in index 17b5d48f1..22f249f58 100755 --- a/utilities/ovs-tcpdump.in +++ b/utilities/ovs-tcpdump.in @@ -111,6 +111,7 @@ The following options are available: -i, --interface Open vSwitch interface to mirror and tcpdump --mirror-to The name for the mirror port to use (optional) Default 'miINTERFACE' + --span If specified, mirror all ports (optional) """ % {'prog': sys.argv[0]}) sys.exit(0) @@ -312,13 +313,14 @@ class OVSDB(object): self._txn = None return result - def bridge_mirror(self, intf_name, mirror_intf_name, br_name): + def bridge_mirror(self, intf_name, mirror_intf_name, br_name, + mirror_select_all=False): txn = self._start_txn() mirror = txn.insert(self.get_table('Mirror')) mirror.name = 'm_%s' % intf_name - mirror.select_all = False + mirror.select_all = mirror_select_all mirrored_port = self._find_row_by_name('Port', intf_name) @@ -404,6 +406,9 @@ def main(): mirror_interface = nxt skip_next = True continue + elif cur in ['--span']: + mirror_select_all = True + continue tcpdargs.append(cur) if interface is None: @@ -445,7 +450,8 @@ def main(): try: ovsdb.make_port(mirror_interface, ovsdb.port_bridge(interface)) ovsdb.bridge_mirror(interface, mirror_interface, - ovsdb.port_bridge(interface)) + ovsdb.port_bridge(interface), + mirror_select_all) except OVSDBException as oe: print("ERROR: Unable to properly setup the mirror: %s." % str(oe)) try: |