summaryrefslogtreecommitdiff
path: root/tests/test-classifier.c
Commit message (Collapse)AuthorAgeFilesLines
* packets: Fix eth_addr_equal_except().Ethan Jackson2012-06-061-4/+4
| | | | | | | | | It turns out that eth_addr_equal_except() computed the exact opposite of what it purported to. It returned true if the two arguments where *not* equal. This is extremely confusing, so this patch changes it. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* flow: Adds support for arbitrary ethernet maskingJoe Stringer2012-05-291-2/+12
| | | | | | | | | | | Arbitrary ethernet mask support is one step on the way to support for OpenFlow 1.1+. This patch set seeks to add this capability without breaking current protocol support. Signed-off-by: Joe Stringer <joe@wand.net.nz> [blp@nicira.com made some updates, see http://openvswitch.org/pipermail/dev/2012-May/017585.html] 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>
* Add support for bitwise matching on TCP and UDP ports.Ben Pfaff2012-02-021-3/+11
| | | | | Bug #8827. Signed-off-by: Ben Pfaff <blp@nicira.com>
* flow: Use FWW_ flags to wildcard IP DSCP and ECN.Justin Pettit2011-11-101-12/+9
| | | | | | | | | | It's no longer necessary to maintain a "nw_tos_mask" wildcard member, since we only care about completely wildcarding the DSCP and ECN portions of the IP TOS field. This commit makes that change. It also goes a bit further in internally using "tos" to refer to the entire TOS field (ie, DSCP and ECN). We must still refer to the DSCP portions as "nw_tos" externally through OpenFlow 1.0, since that's the convention it uses.
* Prepend "nw_" to "frag" and "tos" elements.Justin Pettit2011-11-101-12/+12
| | | | | | Most of the members in structures referring to network elements indicate the layer (e.g., "tl_", "nw_", "tp_"). The "frag" and "tos" members didn't, so this commit add them.
* Don't overload IP TOS with the frag matching bits.Justin Pettit2011-11-091-12/+12
| | | | | | | | This will be useful later when we add support for matching the ECN bits within the TOS field. Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* Implement new fragment handling policy.Ben Pfaff2011-10-211-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, OVS has handled IP fragments more awkwardly than necessary. It has not been possible to match on L4 headers, even in fragments with offset 0 where they are actually present. This means that there was no way to implement ACLs that treat, say, different TCP ports differently, on fragmented traffic; instead, all decisions for fragment forwarding had to be made on the basis of L2 and L3 headers alone. This commit improves the situation significantly. It is still not possible to match on L4 headers in fragments with nonzero offset, because that information is simply not present in such fragments, but this commit adds the ability to match on L4 headers for fragments with zero offset. This means that it becomes possible to implement ACLs that drop such "first fragments" on the basis of L4 headers. In practice, that effectively blocks even fragmented traffic on an L4 basis, because the receiving IP stack cannot reassemble a full packet when the first fragment is missing. This commit works by adding a new "fragment type" to the kernel flow match and making it available through OpenFlow as a new NXM field named NXM_NX_IP_FRAG. Because OpenFlow 1.0 explicitly says that the L4 fields are always 0 for IP fragments, it adds a new OpenFlow fragment handling mode that fills in the L4 fields for "first fragments". It also enhances ovs-ofctl to allow users to configure this new fragment handling mode and to parse the new field. Signed-off-by: Ben Pfaff <blp@nicira.com> Bug #7557.
* test-classifier: Remove write-only variable.Ben Pfaff2011-10-031-2/+0
|
* ofproto: Make rule construction and destruction more symmetric.Ben Pfaff2011-05-111-6/+6
| | | | | | Before, ->rule_construct() both created the rule and inserted into the flow table, but ->rule_destruct() only destroyed the rule. This makes ->rule_destruct() also remove the rule from the flow table.
* ofproto: Break apart into generic and hardware-specific parts.Ben Pfaff2011-05-111-1/+1
| | | | | | | In addition to the changes to ofproto, this commit changes all of the instances of "struct flow" in the tree so that the "in_port" member is an OpenFlow port number. Previously, this member was an OpenFlow port number in some cases and an ODP port number in other cases.
* lib: Replace IP_TYPE_ references with IPPROTO_.Justin Pettit2011-02-021-1/+1
| | | | | | A few common IP protocol types were defined in "lib/packets.h". However, we already assume the existence of <netinet/in.h> which contains a more exhaustive list and should be available on POSIX systems.
* Implement arbitrary bitwise masks for tun_id field.Ben Pfaff2011-01-201-2/+6
| | | | | | This was documented to work, but not implemented. Requested-by: Pankaj Thakkar <thakkar@nicira.com>
* Expand tunnel IDs from 32 to 64 bits.Ben Pfaff2010-12-101-1/+3
| | | | | | | | | | | | | | | | | | | | | We have a need to identify tunnels with keys longer than 32 bits. This commit adds basic datapath and OpenFlow support for such keys. It doesn't actually add any tunnel protocols that support 64-bit keys, so this is not very useful yet. The 'arg' member of struct odp_msg had to be expanded to 64-bits also, because it sometimes contains a tunnel ID. This member also contains the argument passed to ODPAT_CONTROLLER, so I expanded that action's argument to 64 bits also so that it can use the full width of the expanded 'arg'. Userspace doesn't take advantage of the new space though (it was only using 16 bits anyhow). This commit has been tested only to the extent that it doesn't disrupt basic Open vSwitch operation. I have not tested it with tunnel traffic. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Feature #3976.
* nx-match: Implement support for arbitrary VLAN TCI masks.Ben Pfaff2010-11-231-16/+12
| | | | | | | Since the Nicira Extended Match was specified nicira-ext.h has claimed that arbitrary masks are allowed, but in fact only certain masks were actually implemented. This commit implements general masking for the 802.1Q VLAN TCI field.
* flow: Fully separate flow_wildcards from OpenFlow wildcard bits.Ben Pfaff2010-11-221-54/+46
| | | | | | | | | | | | | | | | | | Originally, wildcards were just the OpenFlow OFPFW_* bits. Then, when OpenFlow added CIDR masks for IP addresses, struct flow_wildcards was born with additional members for those masks, derived from the wildcard bits. Then, when OVS added support for tunnels, we added another bit NXFW_TUN_ID that coexisted with the OFPFW_*. Later we added even more bits that do not appear in the OpenFlow 1.0 match structure at all. This had become really confusing, and the difficulties were especially visible in the long list of invariants in comments on struct flow_wildcards. This commit cleanly separates the OpenFlow 1.0 wildcard bits from the bits used inside Open vSwitch, by defining a new set of bits that are used only internally to Open vSwitch and converting to and from those wildcard bits at the point where data comes off or goes onto the wire. It also moves those functions into ofp-util.[ch] since they are only for dealing with OpenFlow wire protocol now.
* flow: Move functions for dealing with wildcard bit counts to ofp-util.Ben Pfaff2010-11-221-3/+7
| | | | | These functions are really OpenFlow-specific, and they will not be used directly by the flow code soon, so move them to ofp-util.
* flow: New function flow_wildcards_is_exact().Ben Pfaff2010-11-221-1/+2
|
* classifier: New function cls_rule_equal().Ben Pfaff2010-11-221-10/+3
|
* classifier: Fix segfault iterating with rules that differ only in priority.Ben Pfaff2010-11-191-0/+9
| | | | | | | | | | | When CLS_CURSOR_FOR_EACH(_SAFE) iterated through a classifier, the cls_cursor_next() function did not properly handle the case where there was more than a single rule on a list. This commit fixes the problem. The addition to the testsuite would have found the problem earlier. Reported-by: Teemu Koponen <koponen@nicira.com> CC: Teemu Koponen <koponen@nicira.com>
* classifier: Add functions and macros for iteration, and use them in ofproto.Ben Pfaff2010-11-151-13/+22
| | | | | This is much more convenient in practice than being forced to use a callback function.
* classifier: Delete dead code specialized for the exact table.Ben Pfaff2010-11-121-29/+0
| | | | These functions and macros are no longer used.
* classifier: Drop CLS_INC_* enumerations and related 'include' parameters.Ben Pfaff2010-11-121-42/+28
| | | | | | | | This type and these parameters were useful when ofproto had the need to separately traverse exact-match rules looking for subrules, but it no longer does that because subrules (now called "facets") are not kept in the classifier any longer. All the callers are now passing CLS_INC_ALL anyhow, so we might as well delete this feature and simplify the code.
* test-classifier: Use get_unaligned_u32() from unaligned.h.Ben Pfaff2010-11-121-10/+3
| | | | There's no point in defining our own code to do this here.
* Add support for matching Ethernet multicast frames.Ben Pfaff2010-11-111-1/+2
|
* test-classifier: Test CLASSIFIER_FOR_EACH_EXACT_RULE.Ben Pfaff2010-11-111-0/+17
| | | | This would have found the bug fixed by the previous commit.
* flow: Better abstract flow_wildcards and use it more widely.Ben Pfaff2010-11-081-2/+4
|
* classifier: Rewrite.Ben Pfaff2010-11-031-315/+269
| | | | | | | | | The old classifier was not adaptive: it required knowing the structure of the flows that were likely to be in use to get good performance. It is likely that it degenerated to linear search in any real-world case. This new classifier is adaptive and should perform better in the real world.
* classifier: Merge classifier_lookup_wild(), classifier_lookup_exact().Ben Pfaff2010-10-291-17/+1
| | | | | | | Merge these functions into classifier_lookup() and update its interface. The new version of the classifier soon to be implemented naturally merges these functions, so this commit updates the interface early.
* classifier: Remove classifier_insert_exact().Ben Pfaff2010-10-291-5/+1
| | | | | | This function doesn't provide any extra useful functionality. It is amenable to a slightly optimized implementation in the current classifier, but not in the one that will soon replace it, so get rid of it.
* xtoxll: Rename "byte-order" since it now include more than xtoxll.Ben Pfaff2010-10-291-1/+1
| | | | Suggested-by: Justin Pettit <jpettit@nicira.com>
* xtoxll: Add byte conversions macros for use in constant expressions.Ben Pfaff2010-10-291-21/+12
|
* flow: Get rid of flow_t typedef.Ben Pfaff2010-10-111-5/+5
| | | | | | | | | | When userspace and the kernel were using the same structure for flows, flow_t was a useful way to indicate that a structure was really a userspace flow instead of a kernel one, but now it's better to just write "struct flow" for consistency, since OVS doesn't use typedefs for structs elsewhere. Acked-by: Jesse Gross <jesse@nicira.com>
* flow: Separate "flow_t" from "struct odp_flow_key".Ben Pfaff2010-10-111-1/+0
| | | | | | | | | | The "struct odp_flow_key" used in the kernel datapath is conceptually separate from the "flow_t" used in userspace, but until now we have used the latter as a typedef for the former for convenience. This commit separates them. This makes it possible in upcoming commits to change them independently. This is cross-ported from the "wdp" branch, which has had it for months.
* Switch many macros from using CONTAINER_OF to using OBJECT_CONTAINING.Ben Pfaff2010-10-011-1/+1
| | | | | These macros require one fewer argument by switching, which makes code that uses them shorter and more readable.
* tests: Speed up classifier test.Ben Pfaff2010-05-261-2/+3
| | | | | | | | | Many of the classifier tests take time exponential in the number of fields, because the existing compare_classifiers() iterates over 2^n_fields possibilities. This is very slow. This commit fixes the problem by only testing a fixed number of random possibilities instead of all of them. This makes it much, much faster.
* tests: Break monolithic classifier test into subtests.Ben Pfaff2010-05-261-33/+30
| | | | | This makes it easier to see which tests are taking up a lot of time, and to see which ones actually fail if any of them do.
* tunneling: Add support for tunnel ID.Jesse Gross2010-04-191-2/+9
| | | | | | | | | | | | | | Add a tun_id field which contains the ID of the encapsulating tunnel on which a packet was received (0 if not received on a tunnel). Also add an action which allows the tunnel ID to be set for outgoing packets. At this point there aren't any tunnel implementations so these fields don't have any effect. The matching is exposed to OpenFlow by overloading the high 32 bits of the cookie as the tunnel ID. ovs-ofctl is capable of turning on this special behavior using a new "tun-cookie" command but this command is intentially undocumented to avoid it being used without a full understanding of the consequences.
* classifer: Fix test classifier to match real classifier.Jesse Gross2010-03-191-1/+1
| | | | | | The trivial test classifier had the same bug as the real classifier when replacing matching flows. This caused it to not find the original bug and then break when the bug was fixed.
* ofproto: Match on IP ToS/DSCP bits (OpenFlow 1.0)Justin Pettit2010-02-201-1/+9
| | | | | | | OpenFlow 1.0 adds support for matching on IP ToS/DSCP bits. NOTE: OVS at this point is not wire-compatible with OpenFlow 1.0 until the final commit in this OpenFlow 1.0 set.
* ofproto: Match VLAN PCP and rewrite ToS bits (OpenFlow 0.9)Justin Pettit2010-02-201-1/+8
| | | | | | | | | | Starting in OpenFlow 0.9, it is possible to match on the VLAN PCP (priority) field and rewrite the IP ToS/DSCP bits. This check-in provides that support and bumps the wire protocol number to 0x98. NOTE: The wire changes come together over the set of OpenFlow 0.9 commits, so OVS will not be OpenFlow-compatible with any official release between this commit and the one that completes the set.
* tests: Remove write-only variables.Ben Pfaff2010-02-111-5/+5
| | | | Found by Clang (http://clang-analyzer.llvm.org/).
* Add new function xzalloc(n) as a shorthand for xcalloc(1, n).Ben Pfaff2009-11-041-1/+1
|
* tests: Rename NTOHL/NTOHS macrosJustin Pettit2009-08-251-13/+14
| | | | | | NetBSD defines NTOHL and NTOHS macros that are used differently than how they are defined in the test-classifier.c. This commit renames the local definition so there's no conflict.
* Update primary code license to Apache 2.0.Ben Pfaff2009-06-151-10/+10
|
* Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45.v0.90.0Ben Pfaff2009-07-081-0/+977