summaryrefslogtreecommitdiff
path: root/utilities/ovs-tcpdump.in
Commit message (Collapse)AuthorAgeFilesLines
* ovs-tcpdump: handle large interface names on linuxAaron Conole2017-11-131-1/+15
| | | | | | | | | | | | | Linux has a fixed size interface name, which will not change. This means that attempts to dump interfaces whose names are larger than the max size will result in an error making the tap device. This commit brings a new function. When the generated name would be too large, use a random number prefixed by 'ovsmi' instead. Reported-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Use @PYTHON@ directly instead of "#! /usr/bin/env"Timothy Redaelli2017-06-211-1/+1
| | | | | | | | | | | In some installed python scripts /usr/bin/env is unnecessarily used in shebang, replace it directly with @PYTHON@. This will also avoid implicit dependency to /usr/bin/env in RPM distributions and it will correctly add implicit dependency to /usr/bin/python instead. Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Joe Stringer <joe@ovn.org>
* Adapt to flake8-import-orderxurong000379972017-03-081-1/+3
| | | | | | | | | | https://review.openstack.org/#/c/432906/ flake8-import-order adds 3 new flake8 warnings: I100: Your import statements are in the wrong order. I101: The names in your from import are in the wrong order. I201: Missing newline between sections or imports. Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-tcpdump: Set mirror port mtuAaron Conole2017-03-081-2/+16
| | | | | | | | | | | When using ovs-tcpdump to mirror interfaces with MTU larger than the default, Open vSwitch will lower the interfaces we are interested in monitoring. Instead, probe the MTU and set the mirrored port's MTU value correctly. Fixes: 314ce6479a83 ("ovs-tcpdump: Add a tcpdump wrapper utility") Reported-by: Dan Williams <dcbw@redhat.com> Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* treewide: Fix recent flake8-check.Joe Stringer2016-12-081-0/+1
| | | | | | | | | Without this patch, I see errors like this on master: ../ofproto/ipfix-gen-entities:115:1: E305 expected 2 blank lines after class or function definition, found 1 Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
* ovs-tcpdump: Do not import unused "select" module.Ben Pfaff2016-11-231-1/+0
| | | | | | | | Fixes the following flake8 warning: utilities/ovs-tcpdump.in:21:1: F401 'select' imported but unused Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* ovs-tcpdump: Fix error handling when parsing parameter.nickcooper-zhangtonghao2016-11-221-1/+3
| | | | | | Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* ovs-tcpdump: destroy_mirror should really destroy the mirror.nickcooper-zhangtonghao2016-11-221-2/+3
| | | | | | Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* ovs-tcpdump: should't halt when dumping traffic.nickcooper-zhangtonghao2016-11-221-3/+0
| | | | | | | | | when sys.stdin is passed to tcpdump via pipe, it will cause tcpdump to halt. Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* ovs-tcpdump: Remove the newline from readline().nickcooper-zhangtonghao2016-11-221-1/+1
| | | | | | | | | | When using ovs-tcpdump, we always get the white line. Remove newline from readline() and ovs-tcpdump will format the output as tcpdump tool. Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* utilities/ovs-tcpdump.in: Poll the process statusAaron Conole2016-07-011-2/+6
| | | | | | | | | | | | | | | | Some options (such as -c X), when passed to tcpdump will cause it to halt. When this occurs, ovs-tcpdump will not recognize that such an event has happened, and will spew newlines across the screen running forever. To fix this, ovs-tcpdump can poll and then raise a KeyboardInterrupt event. Now, when the underlying dump-cmd (such as tcpdump, tshark, etc.) actually signals exit, ovs-tcpdump follows the SIGINT path, telling the database to clean up. Exit is signalled by either returning, 'killing', or closing the output descriptor. Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* utilities/ovs-tcpdump.in: Fix port lookupsAaron Conole2016-07-011-2/+1
| | | | | | | | | | | The original implementation of ovs-tcpdump conflated interfaces and ports needlessly. This commit changes ovs-tcpdump to only consider the port name when looking up the corresponding bridge. Reported-by: Jean-Tsung Hsiao <jhsiao@redhat.com> Tested-by: Jean-Tsung Hsiao <jhsiao@redhat.com> Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-tcpdump: Add a tcpdump wrapper utilityAaron Conole2016-06-231-0/+453
Currently, there is some documentation which describes setting up and using port mirrors for bridges. This documentation is helpful to setup a packet capture for specific ports. However, a utility to do such packet capture would be valuable, both as an exercise in documenting the steps an additional time, and as a way of providing an out-of-the-box experience for running a capture. This commit adds a tcpdump-wrapper utility for such purpose. It uses the Open vSwitch python library to add/remove ports and mirrors to/from the Open vSwitch database. It will create a tcpdump instance listening on the mirror port (allowing the user to specify additional arguments), and dump data to the screen (or otherwise). Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Flavio Leitner <fbl@sysclose.org>