summaryrefslogtreecommitdiff
path: root/lib/bundle.c
Commit message (Collapse)AuthorAgeFilesLines
* Eliminate use of term "slave" in bond, LACP, and bundle contexts.Ben Pfaff2020-10-211-50/+51
| | | | | | | | | | | | | The new term is "member". Most of these changes should not change user-visible behavior. One place where they do is in "ovs-ofctl dump-flows", which will now output "members:..." inside "bundle" actions instead of "slaves:...". I don't expect this to cause real problems in most systems. The old syntax is still supported on input for backward compatibility. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
* lib: added check to prevent int overflowToms Atteka2019-03-261-0/+5
| | | | | | | | | | | | | | 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>
* bundle: add symmetric_l3 hash method for multipathMartin Xu2018-10-021-0/+2
| | | | | | | | | 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>
* ofp-util, ofp-parse: Break up into many separate modules.Ben Pfaff2018-02-131-1/+1
| | | | | | | | | | | | ofp-util had been far too large and monolithic for a long time. This commit breaks it up into units that make some logical sense. It also moves the pieces of ofp-parse that were specific to each unit into the relevant unit. Most of this commit is just moving code around. Signed-off-by: Ben Pfaff <blp@ovn.org> Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
* sparse: Add guards to prevent FreeBSD-incompatible #include order.Ben Pfaff2017-12-221-0/+2
| | | | | | | | | | FreeBSD insists that <sys/types.h> be included before <netinet/in.h> and that <netinet/in.h> be included before <arpa/inet.h>. This adds guards to the "sparse" headers to yield a warning if this order is violated. This commit also adjusts the order of many #includes to suit this requirement. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* Support accepting and displaying port names in OVS tools.Ben Pfaff2017-05-311-10/+17
| | | | | | | | | | | | | | Until now, most ovs-ofctl commands have not accepted names for ports, only numbers, and have not been able to display port names either. It's a lot easier for users if they can use and see meaningful names instead of arbitrary numbers. This commit adds that support. For backward compatibility, only interactive ovs-ofctl commands by default display port names; to display them in scripts, use the new --names option. Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Aaron Conole <aconole@redhat.com>
* bundle: add nw_src/dst hash methodwenxu2017-04-061-0/+4
| | | | | | | Add only nw_src or nw_dst hash feature to bundle and multipath. Signed-off-by: wenxu <wenxu@ucloud.cn> Signed-off-by: Ben Pfaff <blp@ovn.org>
* lib: Check match and action prerequisities with 'match'.Jarno Rajahalme2017-03-081-2/+2
| | | | | | | | | | | | | | | Supply the match mask to prerequisities checking when available. This allows checking for zero-valued matches. Non-zero valued matches imply the presense of corresponding mask bits, but for zero valued matches we must explicitly check the mask, too. This is required now only for conntrack validity checking due to the conntrack state having and 'invalid' bit, but not 'valid' bit. One way to match an valid conntrack state is to match on the 'tracked' bit being one and 'invalid' bit being zero. The latter requires the corresponding mask bit be verified. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* Use PRIu32 format for ofp_port_tShu Shen2017-01-141-1/+1
| | | | | | | | | | Although ofp_port_t uses a 16-bit range, it is defined as a 32-bit type. The format strings throughout the code base were using PRIu16 for ofp_port_t which leads to the compiler to throw Wformat message on platforms that don't promote 16-bit to 32-bit integers, e.g., on macOS. Signed-off-by: Shu Shen <shu.shen@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* json: Move from lib to include/openvswitch.Terry Wilson2016-07-221-0/+1
| | | | | | | | | | | | | | | To easily allow both in- and out-of-tree building of the Python wrapper for the OVS JSON parser (e.g. w/ pip), move json.h to include/openvswitch. This also requires moving lib/{hmap,shash}.h. Both hmap.h and shash.h were #include-ing "util.h" even though the headers themselves did not use anything from there, but rather from include/openvswitch/util.h. Fixing that required including util.h in several C files mostly due to OVS_NOT_REACHED and things like xmalloc. Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofp-actions.h to include/openvswitch directoryBen Warren2016-04-141-5/+5
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofp-util.h to include/openvswitch directoryBen Warren2016-04-141-1/+1
| | | | | | | | This commit also adds several #include directives in source files in order to make the 'ofp-util.h' move possible Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/meta-flow.h to include/openvswitch directoryBen Warren2016-04-141-1/+1
| | | | | | | | | This commit also moves some bitmap macros into public header files and adds some #include directives in soure files in order to make the 'meta-flow.h' move possible. Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Make ofpact_finish() harder to misuse.Ben Pfaff2016-04-131-1/+1
| | | | | | | | | | | | It's pretty easy to forget to update the pointer to an ofpact when finishing it. This commit forces the caller to pass a pointer-to-pointer instead, and uses that to automatically update the pointer. There still could be cases that retain other pointers into the ofpbuf, but I imagine that this is harder to misuse. Suggested-by: Joe Stringer <joe@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
* Move lib/ofpbuf.h to include/openvswitch directoryBen Warren2016-03-301-1/+1
| | | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Acked-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Fix use-after-free with ofpact_finish().Joe Stringer2016-03-301-3/+1
| | | | | | | | | | | | | | | | ofpact_finish() may now reallocate the buffer it is passed, but not all callers updated their local pointers to the current action in the buffer. This could potentially lead to several use-after-free bugs. Update ofpact_finish() to return the new pointer to the ofpact which is provided, and update the calling points to ensure that their local pointers are pointing into the correct (potentially reallocated) buffer. Fixes: 2bd318dec242 ("ofp-actions: Make composing actions harder to screw up.") Reported-by: William Tu <u9012063@gmail.com> Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org> Acked-by: Ryan Moats <rmoats@us.ibm.com>
* Move lib/dynamic-string.h to include/openvswitch directoryBen Warren2016-03-191-2/+2
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofp-errors.h to include/openvswitch directoryBen Warren2016-03-191-1/+1
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Color output of flow actions for ovs-ofctl dump-flows.Quentin Monnet2016-03-181-6/+7
| | | | | | | | | Add color output for flow actions for ovs-ofctl dump-flows command utility, by inserting color markers in the functions responsible for printing those actions. Signed-off-by: Quentin Monnet <quentin.monnet@6wind.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofpbuf: Fix use-after-free in bundle parse.William Tu2016-03-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address pointed by bundle could be obsolete/free'd when realloc, called from ofpbuf_put_zero(), returns new address. Reported by Valgrind 367: ovs-ofctl parse-flows (NXM) Invalid write of size 4 bundle_parse__ (bundle.c:200) bundle_parse_load (bundle.c:272) parse_bundle_load (ofp-actions.c:1324) ofpacts_parse__ (ofp-actions.c:7484) ofpacts_parse (ofp-actions.c:7540) ofpacts_parse_copy (ofp-actions.c:7558) parse_ofp_str__ (ofp-parse.c:491) parse_ofp_str (ofp-parse.c:544) parse_ofp_flow_mod_str (ofp-parse.c:870) Address 0x7a4e96c is 12 bytes inside a block of size 64 free'd free (vg_replace_malloc.c:530) ofpbuf_resize__ (ofpbuf.c:246) (purposely add to force using new buf) ofpbuf_put_zeros (ofpbuf.c:375) bundle_parse__ (bundle.c:181) bundle_parse_load (bundle.c:272) parse_bundle_load (ofp-actions.c:1324) ofpacts_parse__ (ofp-actions.c:7484) ofpacts_parse (ofp-actions.c:7540) ofpacts_parse_copy (ofp-actions.c:7558) Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Joe Stringer <joe@ovn.org>
* ofp-actions: Rename ofpact_update_len() to ofpact_finish().Ben Pfaff2016-01-041-1/+1
| | | | | | | | It does more than just update the length now, so this is a more accurate name. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* ofp-actions: OFPP_ANY (aka OFPP_NONE) is not a valid output port.Ben Pfaff2015-07-291-7/+7
| | | | | | | | | | This is implied by the list of ports that are valid for output in the various versions of the OpenFlow specification. Found by OFTest. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Flavio Leitner <fbl@sysclose.org>
* hash: Add symmetric L3/L4 hash functions for multipath, bundle hashing.Jeroen van Bemmel2015-07-081-0/+4
| | | | | | Signed-off-by: Jeroen van Bemmel <jvb127@gmail.com> [blp@nicira.com made code style fixes, expanded documentation] Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofpbuf: Simplify ofpbuf API.Pravin B Shelar2015-03-031-1/+1
| | | | | | | | | | | | ofpbuf was complicated due to its wide usage across all layers of OVS, Now we have introduced independent dp_packet which can be used for datapath packet, we can simplify ofpbuf. Following patch removes DPDK mbuf and access API of ofpbuf members. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: Move vlog.h to <openvswitch/vlog.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | A new function vlog_insert_module() is introduced to avoid using list_insert() from the vlog.h header. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: Move compiler.h to <openvswitch/compiler.h>Thomas Graf2014-12-151-3/+3
| | | | | | | | | | The following macros are renamed to avoid conflicts with other headers: * WARN_UNUSED_RESULT to OVS_WARN_UNUSED_RESULT * PRINTF_FORMAT to OVS_PRINTF_FORMAT * NO_RETURN to OVS_NO_RETURN Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ofp-actions: Support experimenter OXMs in Nicira extensions.Ben Pfaff2014-10-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the Nicira extension actions include fixed-size 32-bit members that designate NXM fields. These actions can't accommodate 64-bit experimenter OXMs, so we need to figure out some kind of solution. This commit does that, in different ways for different actions. For some actions, I did not think it was worthwhile to worry about experimenter OXM, so I just disabled use of them. This is what I did for bundle, learn, and multipath actions. Other actions could be gracefully reinterpreted to support experimenter OXM. This is true of reg_move, which use NXM headers only at the end of the action and such that using an experimenter OXM would make the action longer (which unambigously signals to older OVS that the action is an error, which is desired behavior since older OVS cannot interpret this action). The stack push and pop actions are also in this category. reg_load was the most frustrating case. In OpenFlow 1.5 we had already eliminated this action in favor of OF1.5+ set_field. In other OpenFlow versions, though, reg_load is more powerful than set_field because it can modify partial fields. This commit therefore adds a new variant of reg_load, called reg_load2, which is simply OF1.5+ set_field with a Nicira extension header on it. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* ofp-actions: Centralize all OpenFlow action code for maintainability.Ben Pfaff2014-08-111-114/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, knowledge about OpenFlow has been somewhat scattered around the tree. Some of it is in ofp-actions, some of it is in ofp-util, some in separate files for individual actions, and most of the wire format declarations are in include/openflow. This commit centralizes all of that in ofp-actions. Encoding and decoding OpenFlow actions was previously broken up by OpenFlow version. This was OK with only OpenFlow 1.0 and 1.1, but each additional version added a new wrapper around the existing ones, which started to become hard to understand. This commit merges all of the processing for the different versions, to the extent that they are similar, making the version differences clearer. Previously, ofp-actions contained OpenFlow encoding and decoding, plus ofpact formatting, but OpenFlow parsing was separated into ofp-parse, which seems an odd division. This commit moves the parsing code into ofp-actions with the rest of the code. Before this commit, the four main bits of code associated with a particular ofpact--OpenFlow encoding and decoding, ofpact formatting and parsing--were all found far away from each other. This often made it hard to see what was going on for a particular ofpact, since you had to search around to many different pieces of code. This commit reorganizes so that all of the code for a given ofpact is in a single place. As a code refactoring, this commit has little visible behavioral change. The update to ofproto-dpif.at illustrates one minor bug fix as a side effect: a flow that was added with the action "dec_ttl" (a standard OpenFlow action) was previously formatted as "dec_ttl(0)" (using a Nicira extension to specifically direct packets bounced to the controller because of too-low TTL), but after this commit it is correctly formatted as "dec_ttl". The other visible effect is to drop support for the Nicira extension dec_ttl action in OpenFlow 1.1 and later in favor of the equivalent standard action. It seems unlikely that anyone was really using the Nicira extension in OF1.1 or later. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* ofpbuf: Abstract 'l2' pointer and document usage conventions.Jarno Rajahalme2014-04-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | Rename 'l2' to 'frame' and add new ofpbuf_set_frame() and ofpbuf_l2(). ofpbuf_set_frame() alse resets all the layer offsets. ofpbuf_l2() returns NULL if the packet has no Ethernet header, as indicated either by unset l3 offset or NULL frame pointer. Callers of ofpbuf_l2() are supposed to check the return value, unless they can otherwise be sure that the packet has a valid Ethernet header. The recent commit 437d0d22 made some assumptions that were not valid regarding the use of the 'l2' pointer in rconn module and by compose_rarp(). This is now fixed as follows: rconn now relies on the fact that once OpenFlow messages are given to rconn for transport, the frame pointer is no longer needed to refer to the OpenFlow header; and compose_rarp() now sets the frame pointer and offsets as expected. In addition to storing network frames, ofpbufs are also used for handling OpenFlow messages and action lists. lib/ofpbuf.h now has a comment documenting the current usage conventions and invariants. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Rename NOT_REACHED to OVS_NOT_REACHEDHarold Lim2013-12-171-1/+1
| | | | | | | | This allows other libraries to use util.h that has already defined NOT_REACHED. Signed-off-by: Harold Lim <haroldl@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Avoid printf type modifiers not supported by MSVC C runtime library.Alin Serdean2013-11-251-2/+2
| | | | | | | | | | | | | The MSVC C library printf() implementation does not support the 'z', 't', 'j', or 'hh' format specifiers. This commit changes the Open vSwitch code to avoid those format specifiers, switching to standard macros from <inttypes.h> where available and inventing new macros resembling them where necessary. It also updates CodingStyle to specify the macros' use and adds a Makefile rule to report violations. Signed-off-by: Alin Serdean <aserdean@cloudbasesolutions.com> Co-authored-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-util: Move ofputil_check_output_port() to ofp-actions, rename.Ben Pfaff2013-11-011-1/+1
| | | | | | | | This function is related to actions to ofp-actions seems like a logical place for it. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* ofp-parse: Do not exit() upon a parse error.Ben Pfaff2013-07-081-19/+39
| | | | | | | | | Until now, failure to parse a flow in the ofp-parse module has caused the program to abort immediately with a fatal error. This makes it hard to use these functions from any long-lived program. This commit fixes the problem. Signed-off-by: Ben Pfaff <blp@nicira.com>
* flow: Only un-wildcard relevant IP headers.Justin Pettit2013-06-271-1/+1
| | | | | | | | | When determining the fields to un-wildcard, we need to be careful about only un-wildcarding fields that are relevant. Also, we didn't properly handle IPv6 addresses. Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Create specific types for ofp and odp portAlex Wang2013-06-201-11/+12
| | | | | | | | | | | | Until now, datapath ports and openflow ports were both represented by unsigned integers of various sizes. With implicit conversions, etc., it is easy to mix them up and use one where the other is expected. This commit creates two typedefs, ofp_port_t and odp_port_t. Both of these two types are marked by "__attribute__((bitwise))" so that sparse can be used to detect any misuse. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofproto-dpif: Store relevant fields for wildcarding in facet.Justin Pettit2013-06-111-6/+13
| | | | | | | | | | | | | | | | | | | | | Dynamically determines the flow fields that were relevant in processing flows based on the OpenFlow flow table and switch configuration. The immediate use for this functionality is to cache action translations for similar flows in facets. This yields a roughly 80% improvement in flow set up rates for a complicated flow table. More importantly, these wildcards will be used to determine what to wildcard for the forthcoming kernel wildcard (megaflow) patches that will allow wildcarding in the kernel, which will provide significant flow set up improvements. The approach to tracking fields and caching action translations in facets was based on an impressive prototype by Ethan Jackson. Co-authored-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Justin Pettit <jpettit@nicira.com>
* ofp-util: Separate output, error reporting in ofputil_port_from_string().Ben Pfaff2012-10-181-2/+1
| | | | | | | | | | | | When I wrote this function I didn't think that port 0 was important (it's not a valid OpenFlow port number) so I used a return value of 0 to indicate an error. However, my assumption turns out to be wrong, so this commit changes the interface to use the return value only for error reporting and store the parsed port number into a pointer passed in as a parameter. This commit doesn't change the behavior of ofputil_port_from_string(). Signed-off-by: Ben Pfaff <blp@nicira.com>
* ovs-ofctl: Accept port keywords, OF1.1 port numbers, reject port number 0.Ben Pfaff2012-09-201-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenFlow 1.0 has special reserved ports in the range 0xfff8 to 0xffff. OpenFlow 1.1 and later has the same ports in the range 0xfffffff8 to 0xffffffff and allows the OF1.0 range to be used for ordinary ("physical") switch ports. This means that, naively, the meaning of a port number in the range 0xfff8 to 0xffff given on the ovs-ofctl command line depends on the protocol in use. This commit implements something a little smarter: - Accept keyword names (e.g. LOCAL) for special reserved ports everywhere that such a port can plausibly be used (previously they were only accepted in some places). - Translate 0xfff8...0xffff to 0xfffffff8...0xffffffff for now, since OF1.1+ isn't in widespread use and those particular ports aren't likely to be in use in OF1.1+ anyway. - Log warnings about those ports when they are specified by number, to allow users to fix their invocations. Also: - Accept the OF1.1+ port numbers for these ports, without warning, for compatibility with the upcoming OF1.1+ support. - Stop accepting port number 0, which has never been a valid port number in OpenFlow 1.0 and later. (This required fixing some tests that inadvertently used this port number). Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Simon Horman <horms@verge.net.au>
* Correct number of bytes to allocated for slaves in bundle action.Mehak Mahajan2012-08-151-1/+1
| | | | | | | | | | The size of each slave is a uint16_t. This means that each slave needs 2 bytes at the end of nx_action_bundle. Earlier, the size of each slave was not being factored in when allocating space. This commit corrects that by allocating 2 bytes for each slave when calculating the total number of bytes to be allocated at the end of nx_action_bundle. Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
* Introduce ofpacts, an abstraction of OpenFlow actions.Ben Pfaff2012-07-031-132/+145
| | | | | | | | | | | | | | | | | | | | | | OpenFlow actions have always been somewhat awkward to handle. Moreover, over time we've started creating actions that require more complicated parsing. When we maintain those actions internally in their wire format, we end up parsing them multiple times, whenever we have to look at the set of actions. When we add support for OpenFlow 1.1 or later protocols, the situation will get worse, because these newer protocols support many of the same actions but with different representations. It becomes unrealistic to handle each protocol in its wire format. This commit adopts a new strategy, by converting OpenFlow actions into an internal form from the wire format when they are read, and converting them back to the wire format when flows are dumped. I believe that this will be more maintainable over time. Thanks to Simon Horman and Pravin Shelar for reviews. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Global replace of Nicira Networks.Raju Subramanian2012-05-021-1/+1
| | | | | | | | Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* meta-flow: New "subfield" data structure.Ben Pfaff2012-02-011-18/+21
| | | | | | | | Until now, parts of a field have been dealt with in a fairly ad-hoc way. struct mf_subfield and the supporting functions added by this commit make their use more systematic. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Better abstract OpenFlow error codes.Ben Pfaff2012-01-121-11/+13
| | | | | | | | | | | | This commit switches from using the actual protocol values of error codes internally in Open vSwitch, to using abstract values that are translated to and from protocol values at message parsing and serialization time. I believe that this makes the code easier to read and to write. This is also one step along the way toward OpenFlow 1.1 support because OpenFlow 1.1 renumbered a bunch of error codes. Signed-off-by: Ben Pfaff <blp@nicira.com>
* bundle: Fix returned error code in one bundle_check() corner case.Ben Pfaff2011-12-271-2/+2
| | | | | | | | | In C, the || operator yields 0 or 1, not (as in some other languages) the value of its first nonzero operand. Found by inspection. Signed-off-by: Ben Pfaff <blp@nicira.com>
* bundle: Parsing bug when using bracketed syntax.Ethan Jackson2011-10-271-1/+1
| | | | | | | | This patch fixes the issue and adds a test which would have caught it. Reported-by: Michael Mao <mmao@nicira.com> Bug #8045.
* ofp-util: Add type-safe functions for serializing actions.Ben Pfaff2011-09-131-4/+3
|
* nx-match: Update register check functions.Ethan Jackson2011-08-121-1/+10
| | | | | This patch simplifies the API of nxm_dst_check() and adds a new function nxm_src_check() for checking source fields.
* bundle: New action "bundle_load".Ethan Jackson2011-07-221-19/+102
| | | | | The bundle_load action behaves the same as the bundle action, except instead of outputting, it writes its result to a register.
* bundle: Implement NX_BD_ALG_ACTIVE_BACKUP.Ethan Jackson2011-07-221-9/+36
| | | | | | | I don't expect this bundling algorithm to be particularly useful in software switches. However, hardware switches will probably only support this bundling algorithm, so it's implemented here as an example and a reference.
* bundle: Avoid GCC 4.5 warning about possibly uninitialized value.Ben Pfaff2011-07-201-0/+1
| | | | This value is not actually uninitialized but GCC 4.5 cannot tell.