summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* nsh: Fix "shadow" warnings while compiling with clang.Damijan Skvarc2019-06-091-6/+12
| | | | | | | | | | | | Because of the macro implementation of htonX() and ntohX(), using one in the argument of the other yields warnings. This commit avoids the issue by using a temporary variable. This does not fix a bug, only suppresses a warning. Submitted-at: https://github.com/openvswitch/ovs/pull/283 Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* sparse: Re-allow sparse builds with dpdk.Ilya Maximets2019-06-064-58/+45
| | | | | | | | | | | | | Few structures from rte_flow.h updated to the version from DPDK 18.11 to fix incorrect structure definitions. rte_lcore.h and rte_vect.h "sparse" headers removed because not needed and only produce type-mismatch issues. Enabled -Werror for sparse builds with DPDK to prevent regressions. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Ben Pfaff <blp@ovn.org>
* acinclude: Add vector defines to sparse.Ilya Maximets2019-06-063-54/+0
| | | | | | | | | | | | | By adding compiler default flags for vector instructions to cgcc we'll be able to check the same sources that we're building. Also, this will allow to avoid re-defining these flags and types specifically for "sparse" includes. "sparse" headers "bmi2intrin.h" and "emmintrin.h" dropped as not needed anymore. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Ben Pfaff <blp@ovn.org>
* ovn-controller: Maintain resource references for logical flows.Han Zhou2019-05-241-1/+4
| | | | | | | | | | This patch maintains the cross reference between logical flows and the resources such as address sets and port groups that are used by logical flows. This data will be needed in address set and port group incremental processing. Signed-off-by: Han Zhou <hzhou8@ebay.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovn-controller: Initial use of incremental engine - quiet mode.Han Zhou2019-05-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Incremental proccessing engine is used to compute flows. In this patch we create below engine nodes: - Engine nodes for each OVSDB table in local OVS DB and SB DB. - runtime_data: compute and maintain intermediate result such as local_datapath, etc. - mff_ovn_geneve: MFF_* field ID for our Geneve option, which is provided by switch. - flow_output: compute and maintain computed flow table. In this patch the ovn flow table is persistent across main loop iterations, and a new index of SB uuid is maintained for the desired flow table, which will be useful for next patches for incremental processing. This patch doesn't do any incremental processing yet, but it achieves the "quiet mode": the flow computation won't be triggered by unrelated events, such as pinctrl/ofctrl messages. The flow computation (full compute) happens only when any of its related inputs are changed. Signed-off-by: Han Zhou <hzhou8@ebay.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* compat: add SCTP netfilter states for older kernelsAaron Conole2019-05-242-0/+27
| | | | | | | | | | | | | Bake in the SCTP states from the kernel UAPI. This means an older revision of the kernel headers won't interfere with the SCTP display enhancement. Additionally, if a newer version is available, or if x-compiling the datapath module we defer to that version (since this is just meant to provide the missing definitions). This will be used in a future commit. Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* sparse: Configure target operating system and fix fallout.Ben Pfaff2019-04-242-0/+31
| | | | | | | | | | | | | | | | | cgcc, the "sparse" wrapper that OVS uses, can be told the host architecture or the host OS or both. Until now, OVS has told it the host architecture because it is fairly common that it doesn't guess it automatically. Until now, OS has not told it the host OS, assuming that it would get it right. However, it doesn't--if you tell it the host OS or the host architecture, it doesn't really have a default for the other. This means that on Linux (presumably the only OS where sparse works properly for OVS), it was not defining __linux__, which caused some weird behavior. This commit adds a flag to the cgcc invocation to make it define __linux__ on Linux, and it fixes some errors that this would otherwise cause. Acked-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovn: Support OVS action 'check_pkt_larger' in OVNNuman Siddique2019-04-221-1/+9
| | | | | | | | | | | | | | | Previous commit added a new OVS action 'check_pkt_larger'. This patch supports that action in OVN. The syntax to use this would be reg0[0] = check_pkt_larger(LEN) Upcoming commit will make use of this action in ovn-northd and will generate an ICMPv4 packet if the packet length is greater than the specified length. Signed-off-by: Numan Siddique <nusiddiq@redhat.com> Acked-by: Mark Michelson <mmichels@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovn: Add a new OVN action 'icmp4_error'Numan Siddique2019-04-221-0/+7
| | | | | | | | | | | | This action is similar to the existing 'icmp4' OVN action except that that this action is expected to be used to generate an ICMPv4 packet in response to an error in original IP packet. When this action injects the icmpv4 packet, it also copies the original IP datagram following the icmp4 header as per RFC 1122: 3.2.2 Signed-off-by: Numan Siddique <nusiddiq@redhat.com> Acked-by: Mark Michelson <mmichels@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovn: Add a new OVN field icmp4.frag_mtuNuman Siddique2019-04-224-2/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support OVN specific fields (which are not yet supported in OpenvSwitch to set or modify values) a generic OVN field support is added in this patch. These OVN fields gets translated to controller actions. This patch adds only one field for now - icmp4.frag_mtu. It should be fairly straightforward to add similar fields in the near future. Example usage. action=(icmp4 {"eth.dst <-> eth.src; " "icmp4.type = 3; /* Destination Unreachable */ " "icmp4.code = 4; /* Fragmentation Needed */ " icmp4.frag_mtu = 1442; ... "next; };") action=(icmp4.frag_mtu = 1500; ..) pinctrl module of ovn-controller will set the specified value in the the low-order 16 bits of the ICMP4 header field that is labelled "unused" in the ICMP specification as defined in the RFC 1191. Upcoming patch will use it to send an icmp4 packet if the source IPv4 packet destined to go via external gateway needs to be fragmented. Signed-off-by: Numan Siddique <nusiddiq@redhat.com> Acked-by: Mark Michelson <mmichels@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Add a new OVS action check_pkt_largerNuman Siddique2019-04-221-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new action 'check_pkt_larger' which checks if the packet is larger than the given size and stores the result in the destination register. Usage: check_pkt_larger(len)->REGISTER Eg. match=...,actions=check_pkt_larger(1442)->NXM_NX_REG0[0],next; This patch makes use of the new datapath action - 'check_pkt_len' which was recently added in the commit [1]. At the start of ovs-vswitchd, datapath is probed for this action. If the datapath action is present, then 'check_pkt_larger' makes use of this datapath action. Datapath action 'check_pkt_len' takes these nlattrs * OVS_CHECK_PKT_LEN_ATTR_PKT_LEN - 'pkt_len' to check for * OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER (optional) - Nested actions to apply if the packet length is greater than the specified 'pkt_len' * OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL (optional) - Nested actions to apply if the packet length is lesser or equal to the specified 'pkt_len'. Let's say we have these flows added to an OVS bridge br-int table=0, priority=100 in_port=1,ip,actions=check_pkt_larger:100->NXM_NX_REG0[0],resubmit(,1) table=1, priority=200,in_port=1,ip,reg0=0x1/0x1 actions=output:3 table=1, priority=100,in_port=1,ip,actions=output:4 Then the action 'check_pkt_larger' will be translated as - check_pkt_len(size=100,gt(3),le(4)) datapath will check the packet length and if the packet length is greater than 100, it will output to port 3, else it will output to port 4. In case, datapath doesn't support 'check_pkt_len' action, the OVS action 'check_pkt_larger' sets SLOW_ACTION so that datapath flow is not added. This OVS action is intended to be used by OVN to check the packet length and generate an ICMP packet with type 3, code 4 and next hop mtu in the logical router pipeline if the MTU of the physical interface is lesser than the packet length. More information can be found here [2] [1] - https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/4d5ec89fc8d14dcdab7214a0c13a1c7321dc6ea9 [2] - https://mail.openvswitch.org/pipermail/ovs-discuss/2018-July/047039.html Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-July/047039.html Suggested-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Numan Siddique <nusiddiq@redhat.com> CC: Ben Pfaff <blp@ovn.org> CC: Gregory Rose <gvrose8192@gmail.com> Acked-by: Mark Michelson <mmichels@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* compiler: Fix compilation when using VStudio 2015/2017Alin Gabriel Serdean2019-04-161-0/+12
| | | | | | | | | | | | | | | This is somewhat a regression of: https://github.com/openvswitch/ovs/commit/27f141d44d95b4cabfd7eac47ace8d1201668b2c The main issue using `offsetof` from <stddef.h> via the C compiler from MSVC 2015/2017 has issues and is buggy: https://bit.ly/2UvWwti Until it is fixed, we define our own definition of `offsetof`. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org> Acked-by: Anand Kumar <kumaranand@vmware.com>
* compat: add compatibility headers for tc skbedit actionJohn Hurley2019-04-092-0/+58
| | | | | | | | | | OvS includes compat code for several TC actions including vlan, mirred and tunnel key. Add support for using skbedit actions when compiling user-space code against older kernel headers. Signed-off-by: John Hurley <john.hurley@netronome.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* lib: added check to prevent int overflowToms Atteka2019-03-261-0/+6
| | | | | | | | | | | | | | If enough large input is given ofpact_finish will fail. Implemented ofpbuf_oversized function to check for oversized buffer. Checks were added for parse functions and error messages returned. Basic manual testing performed. Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com> Reported-by: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12972 Signed-off-by: Toms Atteka <cpp.code.lv@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Makefiles: Generate datapath ovs key fields macrosEli Britstein2019-03-251-3/+8
| | | | | | | | | Generate datapath ovs key fields offset and size array macros as a pre-step for bit-wise comparing fields, with no functional change. Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Eli Britstein <elibr@mellanox.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-protocol: Changed the number of bits in OFPUTIL_P_ANY from 10 to 9.Ashish Varma2019-03-151-1/+1
| | | | | | | | | | The removal of support for OpenFlow 1.6 (draft) resulted in the removal of "OFPUTIL_P_OF16_OXM 1 << 9". OFPUTIL_P_ANY which represets all protocols will now have only 9 valid bits. Fixes: 29718ad49d61 ("Remove support for OpenFlow 1.6 (draft).") Signed-off-by: Ashish Varma <ashishvarma.ovs@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* lib/tc: add ingress ratelimiting support for tc-offloadPieter Jansen van Vuuren2019-03-041-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Firstly this patch introduces the notion of reserved priority, as the filter implementing ingress policing would require the highest priority. Secondly it allows setting rate limiters while tc-offloads has been enabled. Lastly it installs a matchall filter that matches all traffic and then applies a police action, when configuring an ingress rate limiter. An example of what to expect: OvS CLI: ovs-vsctl set interface <netdev_name> ingress_policing_rate=5000 ovs-vsctl set interface <netdev_name> ingress_policing_burst=100 Resulting TC filter: filter protocol ip pref 1 matchall chain 0 filter protocol ip pref 1 matchall chain 0 handle 0x1 not_in_hw action order 1: police 0x1 rate 5Mbit burst 125Kb mtu 64Kb action drop/continue overhead 0b ref 1 bind 1 installed 3 sec used 3 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.0.200 () port 0 AF_INET : demo Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 131072 16384 16384 60.13 4.49 ovs-vsctl list interface <netdev_name> _uuid : 2ca774e8-8b95-430f-a2c2-f8f742613ab1 admin_state : up ... ingress_policing_burst: 100 ingress_policing_rate: 5000 ... type : "" Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* Userspace datapath: Add fragmentation handling.Darrell Ball2019-02-141-0/+1
| | | | | | | | | | | | | | | | Fragmentation handling is added for supporting conntrack. Both v4 and v6 are supported. After discussion with several people, I decided to not store configuration state in the database to be more consistent with the kernel in future, similarity with other conntrack configuration which will not be in the database as well and overall simplicity. Accordingly, fragmentation handling is enabled by default. This patch enables fragmentation tests for the userspace datapath. Signed-off-by: Darrell Ball <dlu998@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* automake: Clean up cxxtest.cc.Ilya Maximets2019-02-111-0/+1
| | | | | | | | | | | | 'distcheck' complains on some configurations: ERROR: files left in build directory after distclean: ./include/openvswitch/cxxtest.cc CC: Ben Pfaff <blp@ovn.org> Fixes: 994bfc298502 ("Automatically verify that OVS header files work OK in C++ also.") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Remove support for OpenFlow 1.6 (draft).Ben Pfaff2019-02-0511-130/+15
| | | | | | | | | ONF abandoned the OpenFlow specification, so that OpenFlow 1.6 will never be completed. It did not contain much in the way of useful features, so remove what support Open vSwitch already had. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* Support for match & set ICMPv6 reserved and options type fieldsVishal Deep Ajmera2019-02-043-2/+35
| | | | | | | | | | | | | | | | | | | | | | | | Currently OVS supports all ARP protocol fields as OXM match fields to implement the relevant ARP procedures for IPv4. This includes support for matching copying and setting ARP fields. In IPv6 ARP has been replaced by ICMPv6 neighbor discovery (ND) procedures, neighbor advertisement and neighbor solicitation. The support for ICMPv6 fields in OVS is not complete for the use cases equivalent to ARP in IPv4. OVS lacks support for matching, copying and setting the “ND option type” and “ND reserved” fields. Without these user cannot implement all ICMPv6 ND procedures for IPv6 support. This commit adds additional OXM fields to OVS for ICMPv6 “ND option type“ and ICMPv6 “ND reserved” using the OXM extension mechanism. This allows support for parsing these fields from an ICMPv6 packet header and extending the OpenFlow protocol with specifications for these new OXM fields for matching, copying and setting. Signed-off-by: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com> Co-authored-by: Ashvin Lakshmikantha <ashvin.lakshmikantha@ericsson.com> Signed-off-by: Ashvin Lakshmikantha <ashvin.lakshmikantha@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Set an action depth limit to prevent stackoverflow by ofpacts_parseYifeng Sun2019-02-041-0/+4
| | | | | | Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12557 Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* lib/tc: make pedit mask calculations byte order agnosticPieter Jansen van Vuuren2019-01-312-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | pedit allows setting entire words with an optional mask and OVS makes use of such masks to allow setting fields that do not span entire words. The struct tc_pedit_key structure, which is part of the kernel ABI, uses host byte order fields to store the mask and value for a pedit action, however, these fields contain values in network byte order. In order to allow static analysis tools to check for endianness problems this patch adds a local version of struct tc_pedit_key which uses big endian types and refactors the relevant code as appropriate. In the course of making this change it became apparent that the calculation of masks was occurring using host byte order although the values are in network byte order. This patch also fixes that problem by shifting values in host byte order and then converting them to network byte order. It is believe this fixes a bug on big endian systems although we are not in a position to test that. Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* treewide: Get rid of // comments, even inside comments.Ben Pfaff2019-01-251-1/+1
| | | | | | | | | | | | | Just a style fix. With this patch, the following reports no hits: git ls-files | grep '\.[ch]$' | grep -vE 'datapath|sflow' \ | xargs grep -n // | grep -vE "http|s/|'|\"" Acked-by: Ilya Maximets <i.maximets@samsung.com> Reported-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofpbuf: Reintroduce assertion on size in ofpbuf_pull().Ben Pfaff2019-01-171-0/+1
| | | | | | | | | This assertion was removed as part of a commit that was intended to just be a cleanup. Fixes: 6fd6ed71cb9f ("ofpbuf: Simplify ofpbuf API.") Acked-by: Justin Pettit <jpettit@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Avoid overflow for ofpact_learn_spec->n_bitsYifeng Sun2019-01-171-1/+1
| | | | | | | | | | | | | | | | | | ofpact_learn_spec->n_bits is the size of immediate data that is following ofpact_learn_spec. Now it is defined as 'uint8_t'. In many places, it gets its value directly from mf_subfield->n_bits, whose type is 'unsigned int'. If input is large enough, there will be uint8_t overflow. For example, the following command will make ovs-ofctl crash: ovs-ofctl add-flow br0 "table=0, priority=0, action=learn(limit=20 tun_metadata15=0x60ff00000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002fffffffffffffff0ffffffffffffffffffffffffffff)" This patch fixies this issue by changing type of ofpact_learn_spec->n_bits from uint8_t to uint32_t. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11870 Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovs-vswitchd: Implement OFPT_TABLE_FEATURES table modification request.Ben Pfaff2019-01-155-6/+21
| | | | | | | | | This allows a controller to change the name of OpenFlow flow tables in the OVS software switch. CC: Brad Cowie <brad@cowie.nz> Acked-by: Justin Pettit <jpettit@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto: Handle multipart requests with multiple parts.Ben Pfaff2019-01-101-1/+19
| | | | | | | | | | | | | | | OpenFlow has a concept of multipart messages, that is, messages that can be broken into multiple pieces that are sent separately. Before OpenFlow 1.3, only replies could actually have multiple pieces. OpenFlow 1.3 introduced the idea that requests could have multiple pieces. This is only useful for multipart requests that take an array as part of the request, which amounts to only flow monitoring requests and table features requests. So far, OVS hasn't implemented the multipart versions of these (it just reports an error). This commit introduces the necessary infastructure to implement them properly. Acked-by: Justin Pettit <jpettit@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* vconn: Allow timeout configuration for blocking connection.Ilya Maximets2019-01-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some systems in case where remote is not responding, socket could remain in SYN_SENT state for a really long time without errors waiting for connection. This leads to situations where vconn connection hangs for a few minutes waiting for connection to the DOWN remote. For example, this situation emulated by "refuse-connection" vconn testcase. This leads to test failures because Alarm signal arrives much faster than ETIMEDOUT from the socket: ./vconn.at:21: ovstest test-vconn refuse-connection tcp Alarm clock stderr: |socket_util|INFO|0:127.0.0.1: listening on port 63812 |poll_loop|DBG|wakeup due to 0-ms timeout |poll_loop|DBG|wakeup due to 10155-ms timeout |fatal_signal|WARN|terminating with signal 14 (Alarm clock) ./vconn.at:21: exit code was 142, expected 0 vconn.at:21: 535. tcp vconn - refuse connection (vconn.at:21): FAILED This patch allowes to specify timeout value for vconn blocking connections. If the connection takes more time, socket will be closed with ETIMEDOUT error code. Negative value could be used to wait infinitely. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* sparse: Fix incompatibility with glibc 2.28 and later.Ben Pfaff2018-12-122-1/+29
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ovs-thread: Add thread safety annotation to cond_wait.Ilya Maximets2018-12-101-1/+2
| | | | | | | | | | | | | | | | This fixes build with clang on FreeBSD: lib/ovs-thread.c:266:13: error: calling function 'pthread_cond_wait' requires holding mutex \ 'mutex->lock' exclusively [-Werror,-Wthread-safety-analysis] error = pthread_cond_wait(cond, &mutex->lock); ^ Fixes: 97be153858b4 ("clang: Add annotations for thread safety check.") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-table: Parse table features messages more carefully.Ben Pfaff2018-12-032-3/+35
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofp-actions: Make all actions a multiple of OFPACT_ALIGNTO bytes.Ben Pfaff2018-11-191-158/+233
| | | | | | | | | | | | | | | | | | | | | | | | The functions to put ofpacts into ofpbufs have always padded them to OFPACT_ALIGNTO boundaries, but the underlying structures weren't necessarily padded out. That led to difficulties in a few places where structures were allocated on the stack instead in an ofpbuf, because functions like ofpact_init_*() would access beyond the end of the actual structure. This is true, for example, in test_multipath_main() in tests/test-multipath.c, which allocates a struct ofpact_multipath on the stack, and in lswitch_handshake() in learning-switch.c, which allocates a struct ofpact_output on the stack. It's possible to fix these individual cases, but it's possible that there are others that haven't been identified. This commit addresses the issue another way, by padding all of the ofpact structures to a full multiple of OFPACT_ALIGNTO and adding assertions to ensure that it can't be screwed up in the future. This commit removes the OFPACT_*_SIZE enums, because they are now equivalent to sizeof(struct ofpact_*) in every case. Acked-by: Mark Michelson <mmichels@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* docs: Fix cross-references that referred to discussions that have moved.Ben Pfaff2018-11-151-2/+2
| | | | | Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* rconn: New function rconn_is_reliable().Ben Pfaff2018-10-311-0/+1
| | | | | | | This will have its first user in an upcoming commit. Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-table: Always format the table number in table features.Ben Pfaff2018-10-261-1/+0
| | | | | | | | | | | Table features should indicate the table number as well as the table name. Before this, the first line for each table looked like this: table myname ("myname"): but it's more useful if it's: table 123 ("myname"): Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofp-table: Better summarize table features and statistics.Ben Pfaff2018-10-261-1/+4
| | | | | | | | | | | | | | | | Before this patch, most dump-table-stats outputs would contain about 250 lines of the form: table #: ditto With this patch, they have one line like this: tables 2...254: ditto which is much easier to read. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofp-msgs: Added ONF_ and NXT_REQUESTFORWARD for OF1.0-1.3Zak Whittington2018-10-262-1/+8
| | | | | | | | | | | | | | | | Backported OFPT14_REQUESTFORWARD to OF1.0-1.3. OF 1.0-1.2 use an NXT Nicira extension while OF 1.3 uses an ONF extension (ONF version is specified in a previously published ONF spec sheet). Includes ofp-print tests for multiple inner message types, and multiple OF versions including the NXT and ONF. Also includes more end-to-end ofproto tests for both NXT OF1.0 and also ONF OF1.3. VMware-BZ: 2136594 Signed-off-by: Zak Whittington <zwhitt.vmware@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* NSH: Fix NSH-related length macros that cause stack overflowYifeng Sun2018-10-261-2/+2
| | | | | | | | | | | In the filed of ver_flags_ttl_len of struct nshhdr, there are only 6 bits that are used to indicate header's total length in 4-byte words. Therefore, the max value for total is 252 (63x4), instead of 256 used in present code base. This patch fixes it. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10855 Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* bundle: add symmetric_l3 hash method for multipathMartin Xu2018-10-021-1/+3
| | | | | | | | | Add a symmetric_l3 hash method that uses both network destination address and network source address. VMware-BZ: #2112940 Signed-off-by: Martin Xu <martinxu9.ovs@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofproto: Handle OpenFlow version mismatch for requestforward with groups.Ben Pfaff2018-09-262-2/+17
| | | | | | | | | | | | | | | OpenFlow 1.4+ supports a feature called requestforward. When a controller enables this feature, the switch sends that controller a copy of other controllers' group and meter modification requests. OpenFlow 1.5 supports some group features not in OpenFlow 1.4. When OVS attempted to forward such requests to an OpenFlow 1.4 controller, it reported an error and exited. This commit fixes the problem by making OVS properly translate the messages to OpenFlow 1.4 format. Reported-by: Pierre Cregut <pierre.cregut@orange.com> Tested-by: Pierre Cregut <pierre.cregut@orange.com> Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-September/047453.html Signed-off-by: Ben Pfaff <blp@ovn.org>
* sparse: check if floatn-common.h is available.Flavio Leitner2018-09-251-0/+3
| | | | | | | | | | This skip including floatn-common.h if it's not available since it was introduced in glibc 2.27 and OVS doesn't not actually require that to work with previous glibc version. Fixes: 07aec2ac1 sparse: Support newer GCC/glibc versions. Signed-off-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* meta-flow: Make "nw_frag" a synonym for "ip_frag".Ben Pfaff2018-09-201-1/+1
| | | | | | | | | | | | Since the time that OVS introduced support for IP fragments, the OVS functions that format flows have used "nw_frag", but the ones that parse flows have expected "ip_frag". Obviously this is a bug and it's a surprise that it's gone so long without anyone reporting the problem. This fixes it and adds a test. Reported-by: Gurucharan Shetty <guru@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Gurucharan Shetty <guru@ovn.org>
* lib/tc: add geneve with option match offloadPieter Jansen van Vuuren2018-09-201-0/+25
| | | | | | | Add TC offload support for classifying geneve tunnels with options. Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* lib/tc: add geneve with option encap action offloadPieter Jansen van Vuuren2018-09-201-0/+23
| | | | | | | Add TC offload support for encapsulating geneve tunnels with options. Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* util: Better document ALIGNED_CAST.Ben Pfaff2018-09-171-2/+8
| | | | | | CC: Han Zhou <zhouhan@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Han Zhou <hzhou8@ebay.com>
* Add opterr and optopt to Windows headersAlin Gabriel Serdean2018-08-011-1/+1
| | | | | | | | | | | Until now we only had optind defined in the header. Since we are using the BSD getopt variant add opterr and optopt. Fixes: 3ec06ea9c668 ("ovn-nbctl: Initial support for daemon mode.") Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* lib/tc: Support matching on ip tunnel tos and ttlOr Gerlitz2018-08-011-1/+6
| | | | | | | | | Support matching on tos and ttl of ip tunnels for the TC data-path. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* lib/tc: Support setting tos and ttl for TC IP tunnelsOr Gerlitz2018-08-011-2/+8
| | | | | | | | Allow to set the tos and ttl for TC tunnels. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* lib/tc: Support matching on ip tosOr Gerlitz2018-08-011-0/+1
| | | | | | | | | Add the missing code to match on ip tos when dealing with the TC data-path. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>