From: Martin Fong <[email protected]>

Signed-off-by: Martin Fong <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
---
I already applied this to master; it came from
https://github.com/openvswitch/ovs/pull/260.

 utilities/ovs-tcpdump.8.in |  3 +++
 utilities/ovs-tcpdump.in   | 12 +++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/utilities/ovs-tcpdump.8.in b/utilities/ovs-tcpdump.8.in
index 79820e46690d..aca61e2bc74f 100644
--- a/utilities/ovs-tcpdump.8.in
+++ b/utilities/ovs-tcpdump.8.in
@@ -42,6 +42,9 @@ be dumped.
 The name of the interface which should be the destination of the mirrored
 packets. The default is miINTERFACE
 .
+.IP "\fB\-\-span\fR"
+If specified, mirror all ports (optional).
+.
 .SH "SEE ALSO"
 .
 .BR ovs\-appctl (8),
diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 17b5d48f1638..22f249f584ce 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:
-- 
2.16.1

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

Reply via email to