summaryrefslogtreecommitdiff
path: root/utilities
Commit message (Collapse)AuthorAgeFilesLines
* dpctl: Support flush conntrack by conntrack 5-tupleYi-Hung Wei2017-12-071-2/+2
| | | | | | | | | | | | | | | | | With this patch, "flush-conntrack" in ovs-dpctl and ovs-appctl accept a conntrack 5-tuple to delete the conntrack entry specified by the 5-tuple. For example, user can use the following command to flush a conntrack entry in zone 5. $ ovs-dpctl flush-conntrack zone=5 \ 'ct_nw_src=10.1.1.2,ct_nw_dst=10.1.1.1,ct_nw_proto=17,ct_tp_src=2,ct_tp_dst=1' $ ovs-appctl dpctl/flush-conntrack zone=5 \ 'ct_nw_src=10.1.1.2,ct_nw_dst=10.1.1.1,ct_nw_proto=17,ct_tp_src=2,ct_tp_dst=1' VMWare-BZ: #1983178 Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Justin Pettit <jpettit@ovn.org>
* 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>
* ovs-ctl: Don't remember vport-* kernel modulesGurucharan Shetty2017-11-131-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From OVS 2.8, ovs-vswitchd, when it starts, will load the kernel modules for tunnels. It has logic inside it to choose either upstream kernel module or vport-* kernel module. So, when we run 'force-reload-kmod' to upgrade to OVS 2.8 from a previous version, we do not need to remember the vport-* kernel module that was previously loaded. It is not really harmful to load vport-* kernel module though. On RHEL7.x and OVS 2.8, we use the upstream "geneve" kernel module for tunnels. But, on RHEL 7.x we have hit a bug caused by iptables startup script which tries to remove all kernel modules related to linux conntrack. It fails to unload openvswitch kernel module because it has a reference count on it. But it succeeds in unloading vport-geneve and in turn the upstream "geneve" kernel module. This causes the tunnels to go down. With this patch, we avoid the above situation, by not loading vport-geneve kernel module. ovs-vswitchd when it starts will load upstream geneve. And when "iptables stop" runs, since "geneve" has nothing to do with conntrack, it spares it. Ideally, we should fix this by incrementing the refcount on the kernel modules. Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: William Tu <u9012063@gmail.com>
* ovs-lib: dont't purge corrupted DBMatteo Croce2017-11-031-1/+1
| | | | | | | | | | | | | | | | In ovs-lib there is a function named upgrade_db which tries to convert a database after OVS {up,down}grades. This function uses ovsdb-tool to check if the DB needs to be upgraded. If the upgrade fails, it purges the DB and create an empty one. ovsdb-tool returns "yes" or "no" to indicate if the DB needs upgrading, but if the DB is corrupted it returns a list of errors. Change a condition from "!= no" to "= yes" because in case of DB corruption upgrade_db would purge the existing DB without writing anything in the logs. Signed-off-by: Matteo Croce <mcroce@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Mark Michelson <mmichels@redhat.com>
* lib: Move lib/poll-loop.h to include/openvswitchXiao Liang2017-11-034-4/+4
| | | | | | | | Poll-loop is the core to implement main loop. It should be available in libopenvswitch. Signed-off-by: Xiao Liang <shaw.leon@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* lib: Move lib/rconn.h to include/openvswitchXiao Liang2017-10-311-1/+1
| | | | | | | | Rconn provides useful features over vconn. Make it available to library users. Signed-off-by: Xiao Liang <shaw.leon@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-save: Replace "echo -n" with "printf"Timothy Redaelli2017-10-271-2/+2
| | | | | | | | This is neeed since "echo -n" is not POSIX and may not work with some shells. Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Flavio Leitner <fbl@sysclose.org>
* ovs-save: Use a file to restore flows instead of heredocTimothy Redaelli2017-10-271-6/+7
| | | | | | | | | | | This patch makes ovs-save to use a file to restore flows instead of using shell script here-document. This is needed since eval + here-documents are much slower than reading a file with the rules directly. Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Flavio Leitner <fbl@sysclose.org>
* ovs-save: Use --bundle to restore flows (on OpenFlow 1.4+)Timothy Redaelli2017-10-271-3/+19
| | | | | | | | | | | | If possible, use OpenFlow 1.4 atomic bundle transaction to restore flows. The patch uses also the highest enabled OpenFlow version to do the queries. With the actual implementation, if you have the default OpenFlow version disabled then ovs-save fails. This patch also fixes that problem. Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Flavio Leitner <fbl@sysclose.org>
* ovs-ctl: Add delete-transient-ports commandTimothy Redaelli2017-10-272-10/+20
| | | | | | | | | Add a command to delete all ports that have the other_config:transient value set to true. Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-save: Handle different 'ip addr show' output.Gurucharan Shetty2017-10-201-0/+8
| | | | | | | | | | | | | | | | | | | | On RHEL 7.4 (with iproute-3.10.0-87), a DHCP provided ipv4 address has the "dynamic" keyword set. For e.g "ip addr show breth0 | grep inet" shows: inet 10.116.248.91/20 brd 10.116.255.255 scope global dynamic breth0 inet6 fe80::250:56ff:fea8:fdf0/64 scope link The keyword "dynamic" (according to 'man ip-address') is only used for ipv6, but in this case this is not true. Our current code will skip the ipv4 address restoration because of this. With this commit, we special case "dynamic" keyword to be valid in case of ipv4. VMware-BZ: #1982196 Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
* checkpatch: Reset line counter.Ilya Maximets2017-10-101-1/+2
| | | | | | | | Lines should be counted for each file separately. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* ovs-ctl.in: Call 'hostname -f' after vswitchd starts.Gurucharan Shetty2017-10-061-2/+7
| | | | | | | | | | | | | | | Currently we call 'hostname -f' when ovs-vswitchd is not running. If you are using ovs-vswitchd to provide your primary networking, then 'hostname -f' will "hang" till it times out. On the system this issue was discovered, this was as long as 40 seconds. This is a problem during OVS restarts or upgrades. This commit calls 'hostname -f' after ovs-vswitchd has started. VMware-BZ: #1972026 Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofproto-dpif: Mark packets as "untracked" after call to ct().Justin Pettit2017-08-211-4/+6
| | | | | | | | | | | | | | | | | | | Packet and Connection state is only available to the processing path that follows the "recirc_table" argument of the ct() action. The previous behavior made these states available until the end of the pipeline. This commit changes the behavior so that the Packet and Connection state are cleared for the current processing path whenever ct() is called (in addition to reaching the end of the pipeline.) A future commit will remove the behavior that a "send to controller" action causes all packets for that flow to be handled via the slow-path. The current behavior of connection tracking state makes that difficult due to datapath actions containing multiple OpenFlow rules that may contain different connection tracking states. This change will make that future commit possible. Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* checkpatch: Enforce bracing around conditionals.Joe Stringer2017-08-211-0/+6
| | | | | | | | | The coding style states that BSD-style brace placement should be used, and even single statements should be enclosed. Add checks to checkpatch for this, particularly for 'else' statements. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* checkpatch: Check for trailing operators.Joe Stringer2017-08-091-1/+13
| | | | | | | | The style guide states that lines should not end with '?' or ':'. Check for this and report an error. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* checkpatch: Fix matching on C filenames.Joe Stringer2017-08-091-4/+4
| | | | | | | | | Most of the prerequisite checks so far matched on filenames that ended in some character followed by 'c' or 'h', rather than a filename that ends in '.c' or '.h'. Fix this. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* checkpatch: Check for infix operator whitespace.Joe Stringer2017-08-091-0/+19
| | | | | | | | | | | | | | | | The 'Expressions' section of the coding style specifies that one space should be on either side of infix binary and ternary operators. This adds a check to checkpatch.py for most of these. The regex won't match if there are speech marks on the line, because the style should not apply to the contents of strings. This check is left at warning level because there isn't a good way to determine whether a line is within a multiline comment or string, so it will occasionally flag such lines which contain hyphenated words. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovs-vsctl-bashcomp: Make compatible with busybox "awk".Ben Pfaff2017-08-081-1/+1
| | | | | | | | | | | | | | | | | It seems that awk in busybox doesn't think that an empty string is part of a larger string, but that GNU awk does. This commit adds an extra test to make _ovs_vsctl_check_startswith_string work either way. This allows the following tests to pass with busybox awk: vsctl bashcomp unit tests 7: vsctl-bashcomp - basic verification ok 8: vsctl-bashcomp - argument completion ok Reported-by: Stuart Cardall <developer@it-offshore.co.uk> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Lance Richardson <lrichard@redhat.com>
* ovs-bugtool: Run the 'dmesg' command without condition.Gurucharan Shetty2017-08-071-3/+1
| | | | | | | | | | | | | | | | Currently we look for files with the name of "dmesg" in "/var/log". If it exists, we don't run the command "dmesg". This is unreliable as the file does not always contain the latest dmesg information. Since OVS kernel module emits information to dmesg, we need this information to debug bugs. So always run the "dmesg" command and collect its output. Signed-off-by: Gurucharan Shetty <guru@ovn.org> Reviewed-by: Greg Rose <gvrose8192@gmail.com> Tested-by: Greg Rose <gvrose8192@gmail.com> Acked-by: Ben Pfaff <blp@ovn.org>
* ovs-bugtool: Collect OVS logs with "--ovs" option.Gurucharan Shetty2017-08-071-1/+1
| | | | | | | | | | | | | ovs-bugtool collects a lot of data. This can be time consuming and can end up collecting a lot of redundant data. A option "--ovs" was added a while ago to only collect OVS relevent data. We missed adding the OVS logs to this filter. Signed-off-by: Gurucharan Shetty <guru@ovn.org> Reviewed-by: Greg Rose <gvrose8192@gmail.com> Tested-by: Greg Rose <gvrose8192@gmail.com> Acked-by: Ben Pfaff <blp@ovn.org>
* ovs-ofctl: Avoid unnecessary flow replacement in "replace-flows" command.Ben Pfaff2017-08-031-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ovs-ofctl "diff-flows" and "replace-flows" command compare the flows in two flow tables. Until now, the "replace-flows" command has considered certain almost meaningless differences related to the version of OpenFlow used to add a flow as significant, which caused it to replace a flow by an identical-in-practice version, e.g. in the following, the "replace-flows" command prints a FLOW_MOD that adds the flow that was already added previously: $ cat > flows actions=resubmit(,1) $ ovs-vsctl add-br br0 $ ovs-ofctl del-flows br0 $ ovs-ofctl add-flows br0 flows $ ovs-ofctl -vvconn replace-flows br0 flows 2>&1 | grep FLOW_MOD Re-adding an existing flow has some effects, for example, it resets the flow's duration, so it's better to avoid it. This commit fixes the problem using the same trick previously used for a similar problem with the "diff-flows" command, which was fixed in commit 98f7f427bf8b ("ovs-ofctl: Avoid printing false differences on "ovs-ofctl diff-flows"."). Reported-by: Kevin Lin <kevin@quilt.io> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovs-ctl: Remove a leftover restore_interfaces in restartTimothy Redaelli2017-08-031-3/+0
| | | | | | | | | | | | Since commit c416eaf8c247 ("ovs-ctl: Remove code for upgrading from Open vSwitch 1.9 and earlier.") the kernel configuration of the specified network interfaces is not saved anymore for restart command so there is no need to try to restore it. CC: Ben Pfaff <blp@ovn.org> Fixes: c416eaf8c247 ("ovs-ctl: Remove code for upgrading from Open vSwitch 1.9 and earlier.") Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Eliminate most shadowing for local variable names.Ben Pfaff2017-08-021-2/+1
| | | | | | | | | | | | | | Shadowing is when a variable with a given name in an inner scope hides a different variable with the same name in a surrounding scope. This is generally undesirable because it can confuse programmers. This commit eliminates most of it. Found with -Wshadow=local in GCC 7. The repo is not really ready to enable this option by default because of a few cases that are harder to fix, and harmless, such as nested use of CMAP_FOR_EACH. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* OF support and translation of generic encap and decapJan Scheurich2017-08-021-5/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds support for the OpenFlow actions generic encap and decap (as specified in ONF EXT-382) to the OVS control plane. CLI syntax for encap action with properties: encap(<header>) encap(<header>(<prop>=<value>,<tlv>(<class>,<type>,<value>),...)) For example: encap(ethernet) encap(nsh(md_type=1)) encap(nsh(md_type=2,tlv(0x1000,10,0x12345678),tlv(0x2000,20,0xfedcba9876543210))) CLI syntax for decap action: decap() decap(packet_type(ns=<pt_ns>,type=<pt_type>)) For example: decap() decap(packet_type(ns=0,type=0xfffe)) decap(packet_type(ns=1,type=0x894f)) The first header supported for encap and decap is "ethernet" to convert packets between packet_type (1,Ethertype) and (0,0). This commit also implements a skeleton for the translation of generic encap and decap actions in ofproto-dpif and adds support to encap and decap an Ethernet header. In general translation of encap commits pending actions and then rewrites struct flow in accordance with the new packet type and header. In the case of encap(ethernet) it suffices to change the packet type from (1, Ethertype) to (0,0) and set the dl_type accordingly. A new pending_encap flag in xlate ctx is set to mark that an corresponding datapath encap action must be triggered at the next commit. In the case of encap(ethernet) ofproto generetas a push_eth action. The general case for translation of decap() is to emit a datapath action to decap the current outermost header and then recirculate the packet to reparse the inner headers. In the special case of an Ethernet packet, decap() just changes the packet type from (0,0) to (1, dl_type) without a need to recirculate. The emission of the pop_eth action for the datapath is postponed to the next commit. Hence encap(ethernet) and decap() on an Ethernet packet are OF octions that only incur a cost in the dataplane when a modifed packet is actually committed, e.g. because it is sent out. They can freely be used for normalizing the packet type in the OF pipeline without degrading performance. Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Yi Yang <yi.y.yang@intel.com> Signed-off-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Co-authored-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* dpctl: Add new 'ct-bkts' command.Antonio Fischetti2017-08-021-0/+1
| | | | | | | | | | | | | | | | | With the command: ovs-appctl dpctl/ct-bkts shows the number of connections per bucket. By using a threshold: ovs-appctl dpctl/ct-bkts gt=N for each bucket shows the number of connections when they are greater than N. Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Co-authored-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Signed-off-by: Darrell Ball <dlu998@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* checkpatch: Print commit hashes and names.Ilya Maximets2017-07-261-2/+7
| | | | | | | | It's better to see real commits instead of 'HEAD~n'. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Russell Bryant <russell@ovn.org>
* checkpatch: Allow checking more than one file.Ilya Maximets2017-07-261-5/+10
| | | | | | | | | | | | | Currently to check more than one patch or file it's required to invoke script for each file separately. Fix that by iterating over all the passed filenames. Note: If '-f' option passed, all the files treated as usual files. Without '-f' all the files treated as patch files. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Russell Bryant <russell@ovn.org>
* checkpatch: Print results while checking HEAD and stdin.Ilya Maximets2017-07-261-8/+25
| | | | | | | | | Currently, result status printed only for patch files. It'll be nice to have results for other checking types. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Russell Bryant <russell@ovn.org>
* checkpatch: Don't allow Gerrit Change-Ids.Ilya Maximets2017-07-261-0/+6
| | | | | | | | | Local Gerrit Change-Ids are not welcome in common repository. Inspired by checkpatch.pl from Linux Kernel. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Russell Bryant <russell@ovn.org>
* checkpatch: Suggest ovs_assert() to author.Bhanuprakash Bodireddy2017-07-121-0/+1
| | | | | | | | Suggest the author to use the OVS wrapper of the assert function. Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* Fix some -Wimplicit-fallthrough warnings building with GCC 7Timothy Redaelli2017-07-111-0/+2
| | | | | | | | | | -Wimplicit-fallthrough warns when a switch case falls through and since this warning is enabled by -Wextra it breaks building with --enable-Werror. Added "/* fall through */" comment when needed in order to avoid the warning. Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* dpctl: add CT Stats for Connections per protocol.Antonio Fischetti2017-07-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Adds CT stats to report number of connections grouped by protocol. By using utilities/ovs-appctl dpctl/ct-stats-show it can display something like: Connections Stats: Total: 1808 TCP: 1808 With the verbose options: utilities/ovs-appctl dpctl/ct-stats-show verbose it can display: Connections Stats: Total: 2671 TCP: 2671 Conn per TCP states: [ESTABLISHED]=1000 [CLOSING]=1 [TIME_WAIT]=1670 Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Co-authored-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Fix coding style and some typos.Antonio Fischetti2017-07-111-2/+4
| | | | | | | Fixes some lines exceeding 80 chars and a couple of typos. Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* make logs not readable by otherTimothy Redaelli2017-07-102-3/+4
| | | | | | | | | | | The Open vSwitch log directory and files are currently set world readable. However, since only Open vSwitch users and processes need to access this directory and these files there is no need to allow the world to access them, since it can result in the exposure of sensitive information. Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* checkpatch: Use default encoding from email library.Joe Stringer2017-07-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | There are three paths for running the core checkpatch path: From a file, from stdin, or reading from git output. Currently, the file version of this calls the "email" library's decode routine which translates the stream into a bytes array, which we later call decode() to turn it back into a regular string. This works on python2 and python3, but the other paths don't work in python3 due to the following error: $ utilities/checkpatch.py -1 == Checking HEAD~0 == Traceback (most recent call last): File "utilities/checkpatch.py", line 491, in <module> if ovs_checkpatch_parse(patch, revision): File "utilities/checkpatch.py", line 324, in ovs_checkpatch_parse for line in text.decode().split('\n'): AttributeError: 'str' object has no attribute 'decode' Rather than performing this extra encode/decode, strip these out from this path so that the stdin and git variants of checkpatch can work in python3. Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ofp-parse: Fix small memory leak when calling parse_ofp_meter_mod_str().Justin Pettit2017-07-051-0/+4
| | | | | | | | | | | | The function parse_ofp_meter_mod_str() allocates a buffer called 'bands', which parse_ofp_meter_mod_str__() then steals for the member 'mm->meter.bands'. Calling functions didn't free that stolen value and the comments for those function didn't indicate that was necessary. Found by valgrind. Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovs-ctl: Fix typo in a commentTimothy Redaelli2017-06-291-1/+1
| | | | | | | s/conenct/connect/ Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Russell Bryant <russell@ovn.org>
* userspace: Introduce packet_type in OF 1.5 packet-outZoltán Balogh2017-06-271-0/+1
| | | | | | | | | | | | | Introducing packet_type in OF 1.5 packet-out. Partly based on Jean Tourrilhes's work. Add test cases for OF1.5 packet-out Add negative test case for OF1.5 packet-out Signed-off-by: Jean Tourrilhes <jt@labs.hpe.com> Signed-off-by: Zoltan Balogh <zoltan.balogh@ericsson.com> Co-authored-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-dpctl: New --names option to use port names in flow dumps.Ben Pfaff2017-06-232-1/+28
| | | | | | | | | | | | | | | Until now, printing names in "ovs-dpctl dump-flows" was tied to the overall output verbosity, which in practice meant that to see port names a user had to see a distracting amount of verbosity. This decouples names from verbosity. I'd like to make showing names the default for interactive usage, but so far names aren't accepted in input so that would frustrate cut-and-paste, which is an important use of "ovs-dpctl dump-flows" output. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jan Scheurich <jan.scheurich@ericsson.com> Tested-by: Jan Scheurich <jan.scheurich@ericsson.com>
* Use @PYTHON@ directly instead of "#! /usr/bin/env"Timothy Redaelli2017-06-219-9/+9
| | | | | | | | | | | 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>
* checkpatch: Fix skipping of the most recent commit.Ilya Maximets2017-06-151-1/+1
| | | | | | | | | | | | | | | | 'range(n_patches, 0, -1)' generates list starting from 'n_patches' and not including zero. This leads to checking of N most recent commits starting from the second one. New version will generate right list starting from 'n_patches - 1' and including zero. So, the most recent commit (HEAD~0) will be checked and desired behavior will be achieved. Also, 'reversed' looks better than 'range(n_patches - 1, -1, -1)' Fixes: a1fccabce2cb ("checkpatch: Support checking recent commits in the current repo.") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* checkpatch: Support checking recent commits in the current repo.Ben Pfaff2017-06-141-16/+49
| | | | | Requested-by: Miguel Angel Ajo <majopela@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-ofctl: New option "--no-stats" for "ovs-ofctl dump-flows".Ben Pfaff2017-06-142-5/+21
| | | | | | | | | | | It's pretty common to want to omit statistics from output, to make it easier to read. This commit adds an ovs-ofctl option to make that easy. A lot of the OVS internal tests could use this, too, in place of ofctl_strip. This commit adopts it for a subset. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* ovs-ofctl: Avoid read overrun in ofperr_decode_msg().Ben Pfaff2017-06-141-4/+6
| | | | | | | | | | | | | | | | | | | vconn_add_bundle_error() was keeping at most 64 bytes of an OpenFlow error message, then it was passing it to ofperr_decode_msg(), which assumed that the full message was available. This led to a buffer overread. There's no good reason why it was only keeping the first 64 bytes, so this commit changes it to keep the whole error message, sidestepping the problem. struct vconn_bundle_error only existed for this special case, so remove it in favor of a chain of ofpbufs. Found via gcc's address sanitizer. Reported-by: Lance Richardson <lrichard@redhat.com> Fixes: 506c1ddb3404 ("vconn: Better bundle error management.") Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahlame <jarno@ovn.org>
* checkpatch: Also allow .at files to have leading tabs.Ben Pfaff2017-06-081-2/+8
| | | | | | | | | Autotest .at files often have lines with samples of expected output from various programs, which fairly often includes leading tabs, so this warning causes false positives there. Signed-off-by: Ben Pfaff <blp@ovn.org> Reviewed-by: Aaron Conole <aconole@redhat.com>
* ovs-ofctl: Close pcap file at end of ofctl_ofp_parse_pcap().Ben Pfaff2017-06-011-0/+1
| | | | | | | | | | Seem wise even if not mandatory. Found by Coverity. Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14763047&defectInstanceId=4305314&mergedDefectId=180420 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* checkpatch: Also exempt Makefile.am from leading whitespace checks.Ben Pfaff2017-06-011-1/+1
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Reviewed-by: Greg Rose <gvrose8192@gmail.com>
* checkpatch: Fix typo for use as filter.Ben Pfaff2017-06-011-1/+1
| | | | | | | | ovs_checkpatch_parse() takes 2 arguments, not sys.exit(). Oops. Fixes: 95bd35d3db19 ("checkpatch: Implement -f option more usefully.") Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* checkpatch: Omit some checks on comment lines.Ben Pfaff2017-06-011-0/+12
| | | | | | | | | | | Comments are more freeform than code, so this patch tries to ignore many checks on comment lines. It assumes that any line that begins with "/*" or "* " is a comment line. (Without a following space, "*" might be something like "*x = 1;".) Suggested-by: Joe Stringer <joe@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>