2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 21:07:47 +00:00

136 Commits

Author SHA1 Message Date
Justin Pettit
530180fd5a Support matching and modifying IP ECN bits.
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09 10:47:59 -08:00
Justin Pettit
9e44d71563 Don't overload IP TOS with the frag matching bits.
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>
2011-11-09 10:37:57 -08:00
Justin Pettit
fa8223b7fd Support matching IPv6 flow label.
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09 10:37:55 -08:00
Ben Pfaff
5a020ef3b5 ofp-util: New function ofputil_decode_msg_type_partial(). 2011-11-02 08:45:34 -07:00
Edward Tomasz Napierała
6ca00f6f17 Fix build on FreeBSD.
Patch below fixes build on FreeBSD; tested on 10.0-CURRENT.

Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-11-01 09:11:52 -07:00
Ethan Jackson
848e88098f nicira-ext: New action "exit".
The exit action causes the switch to immediately halt processing of
further actions. It's intended to be used in conjunction with
multi table support.  It allows a table to force tables which call
it to discontinue processing a flow.
2011-10-28 18:16:40 -07:00
Ben Pfaff
7257b535ab Implement new fragment handling policy.
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.
2011-10-21 15:07:36 -07:00
Ben Pfaff
62698c77ec ofp-util: Avoid misaligned memory access in ofputil_encode_packet_in().
Reported-by: Murphy McCauley <murphy.mccauley@gmail.com>
2011-10-18 16:08:15 -07:00
Justin Pettit
dc56021df4 nicira-ext: Fix build problems on 64-bit systems.
Commit d2c0fe (nicira-ext: Bump number of registers to five from four.)
broke the build on 64-bit systems.  This commit fixes the problems it
introduced.
2011-10-04 11:50:51 -07:00
Jesse Gross
6c24d40243 ofp-util: make_packet_out() shouldn't receive OVSP_NONE.
make_packet_out() operates solely at the OpenFlow layer, so it
should never receive OVSP_LOCAL as an in_port.  This function is
used only by the learning switch, which will never generate
a packet with OVSP_LOCAL so this fixes not a bug but a violation
of semantics.
2011-09-29 14:35:58 -07:00
Ben Pfaff
eb6e978cc1 ofp-util: Remove obsolete build assertion.
Commit d1e9b9bf3 "nicira-ext: Renumber NXT_FLOW_MOD_TABLE_ID" eliminated
the need for the NXT_SET_FLOW_FORMAT and NXT_FLOW_MOD_TABLE_ID commands to
have different sizes, so asserting that they are different isn't useful
anymore (although it is still correct and always will be).
2011-09-15 11:10:36 -07:00
Ben Pfaff
75a7504356 Implement new "learn" action.
There are a few loose ends here.  First, learning actions cause too much
flow revalidation.  Upcoming commits will fix that problem.  The following
additional issues have not yet been addressed:

    * Resource limits: nothing yet limits the maximum number of flows that
      can be learned.  It is possible to exhaust all system memory.

    * Age reporting: there is no way to find out how soon a learned table
      entry is due to be evicted.

To try this action out, here's a recipe for a very simple-minded MAC
learning switch.  It uses a 10-second MAC expiration time to make it easier
to see what's going on:

ovs-vsctl del-controller br0
ovs-ofctl del-flows br0
ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=10, \
	NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
	output:NXM_OF_IN_PORT[]), resubmit(,1)"
ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood"

You can then dump the MAC learning table with:

ovs-ofctl dump-flows br0 table=1
2011-09-13 11:46:09 -07:00
Ben Pfaff
0ff2282245 ofp-util: New function for parsing key-value pairs.
This will soon have a new user, but it's a worthwhile cleanup on its own.
2011-09-13 11:46:09 -07:00
Ben Pfaff
93996add1c ofp-util: Add type-safe functions for serializing actions. 2011-09-13 11:46:08 -07:00
Ben Pfaff
e23ae58527 ofp-util: Further abstract definitions of action properties.
This commit primarily moves the OFPAT_ACTION and NXAST_ACTION invocations
into a new file ofp-util.def.  This allows multiple places in the source to
use them.

This commit also adds a new function ofputil_action_code_from_name().
The following commit will add the first user.
2011-09-13 11:46:08 -07:00
Ben Pfaff
39dc90822e ofp-util: New functions for parsing and formatting OpenFlow port numbers.
These functions were previously used only in ofp-parse.c and ofp-print.c,
but they are more generally useful and future commits will add more users.
2011-09-13 11:46:08 -07:00
Ben Pfaff
aad29cd1a1 packets: Add more utility functions for IPv4 and IPv6 addresses.
We had these functions scattered around the source tree anyway.  packets.h
is a good place to centralize them.

I do plan to introduce some additional callers.
2011-09-13 11:46:08 -07:00
Justin Pettit
df2c07f433 datapath: Use "OVS_*" as opposed to "ODP_*" for user<->kernel interactions.
The prefix "ODP_*" is not overly descriptive in the context of the
larger Linux tree.  This commit changes the prefix to "OVS_*" for the
userpace to kernel interactions.  The userspace libraries still use
"ODP_" in many of their interfaces since it is more descriptive in the
OVS oeuvre.

Feature #6904

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-08-19 22:48:23 -07:00
Ethan Jackson
f694937d4e nicra-ext: New action NXAST_OUTPUT_REG.
The NXAST_OUTPUT_REG action outputs to the OpenFlow port contained
in a supplied NXM field.
2011-08-12 15:06:53 -07:00
Ethan Jackson
a877206f2f flow: New FLOW_WC_SEQ build assertion.
Changing "struct flow" or its wildcards requires minor adjustments
in many places in the code.  This patch adds a new FLOW_WC_SEQ
sequence number which when incremented will cause build assertion
failures aiding the developer in finding code which needs to
change.
2011-08-12 15:05:41 -07:00
Ben Pfaff
81d1ea9414 ofp-util: Rename struct flow_stats_request with ofputil_ prefix.
Most of the structs in ofp-util.h have the ofputil_ prefix.  Rename this
one for consistency.
2011-08-09 13:53:21 -07:00
Ben Pfaff
a9a2da3894 ofp-util: Rename struct flow_mod to struct ofputil_flow_mod.
Most of the structs in ofp-util.h have the ofputil_ prefix.  Rename this
one for consistency.
2011-08-09 13:53:21 -07:00
Ben Pfaff
299016266e New action NXAST_RESUBMIT_TABLE.
This makes multiple table support in ofproto-dpif useful, by allowing
resubmits into tables other than 0.
2011-08-09 09:24:18 -07:00
Ben Pfaff
51cb6e0c65 ofp-util: Rewrite action decoding to improve compiler warnings.
The previous implementation of ofputil_decode_action() had two weaknesses.
First, the action lengths in its tables were written as literal integers
instead of using "sizeof".  Second, it used arrays for tables instead of
switch statements, which meant that GCC didn't warn when someone added a
new action type but forgot to add an entry to the tables.

This rewrite fixes both of those problems.

Suggested-by: Ethan Jackson <ethan@nicira.com>
2011-08-08 10:21:13 -07:00
Ethan Jackson
a368bb53d9 bundle: New action "bundle_load".
The bundle_load action behaves the same as the bundle action,
except instead of outputting, it writes its result to a register.
2011-07-22 17:46:48 -07:00
Ethan Jackson
43edca5717 nx-match: New helpers.
This patch creates two new helper functions, nxm_reg_load() and
nxm_dst_check().  The new nxm_dst_check() function may be used to
check the validity of destination fields used by actions.  The new
nxm_reg_load() function may be used by actions which need to write
to NXM fields.

This patch also allows multipath and autopath to write their result
to non-register NXM fields.
2011-07-22 17:46:48 -07:00
Ethan Jackson
daff3353a0 vswitch: Implement bundle action.
This patch creates a new action called "bundle".  Bundles are a way
to implement a simple form of multipath in OpenFlow by grouping
several ports in a single output-like action.
2011-07-19 11:34:26 -07:00
Ethan Jackson
774101397b ofputil: Export ofputil_check_output_port().
Future patches will use this function outside of the ofputil
module.
2011-07-19 11:34:26 -07:00
Ben Pfaff
38f2e36072 ofp-util: Centralize decoding of OpenFlow actions.
This significantly simplifies code in ofp-print and ofproto-dpif and is
likely to simplify any new ofproto implementations whose support for
actions differs from ofproto-dpif.
2011-06-30 10:05:52 -07:00
Ben Pfaff
b4b8c7812b ofp-util: Simplify iteration through OpenFlow actions.
The existing actions_first() and actions_next() iterator functions are not
much like the other iteration constructs found throughout the Open vSwitch
tree.  Also, they only work with actions that have already been validated,
so there are cases where they cannot be used.

This commit adds new macros for iterating through OpenFlow actions, one
for actions that have been validated and one for actions that have not, and
adapts the existing users.  The following commit will further refine action
parsing and add more users.
2011-06-30 10:04:09 -07:00
Ben Pfaff
8f93e93c80 ofp-util: Rename OFPUTIL_INVALID to OFPUTIL_MSG_INVALID.
An upcoming commit will introduce new OPFUTIL_* constants for actions.  It
seems best to be able to visually distinguish the contants.  Most of the
existing constants start with a good prefix, but OFPUTIL_INVALID does not,
so rename it.
2011-06-30 10:02:55 -07:00
Ben Pfaff
0541197719 ofp-util: Send table_id correctly in OpenFlow 1.0 flow_mods.
This fixes "ovs-ofctl add-flow <bridge> table=<number>,..." and similar
commands.

Reported-by: Hao Zheng <hzheng@nicira.com>
2011-06-15 10:34:13 -07:00
Ben Pfaff
5e9d0469fc Define UINT64_MAX as "unknown" in Open vSwitch specific interfaces.
Some hardware supports reporting packet or byte counters but not both, so
OVS has to be prepared for that.

Suggested-by: Justin Pettit <jpettit@nicira.com>
2011-06-14 11:21:52 -07:00
Ben Pfaff
18ddadc2e9 ofp-util: New functions ofputil_actions_equal(), ofputil_actions_clone().
I found that introducing these helper functions provided a very modest
increase in readability.
2011-06-14 11:21:51 -07:00
Ben Pfaff
349adfb29c ofproto: Better abstract flow stats encoding. 2011-06-14 11:21:50 -07:00
Ben Pfaff
76c93b2274 ofproto: Better abstract aggregate stats encoding and decoding. 2011-06-14 11:21:50 -07:00
Ben Pfaff
63f2140a55 openflow: Make stats replies more like other OpenFlow messages. 2011-06-14 11:21:50 -07:00
Ben Pfaff
2a1c0549a3 openflow: Merge ofp_flow_stats_request and ofp_aggregate_stats_request. 2011-06-14 11:21:50 -07:00
Ben Pfaff
03cd34939e openflow: Remove 'body' member from struct ofp_stats_msg.
This member does not actually help with anything.
2011-06-14 11:21:49 -07:00
Ben Pfaff
28c8bad14f openflow: Merge ofp_stats_request and ofp_stats_reply.
These structures for OpenFlow stats requests and replies have identical
memebers, but until now they have been separate structures.  Since in some
cases we actually want to treat both of them the same way, this has led
to various kinds of awkwardness.  This commit merges them into a new
"struct ofp_stats_msg" and fixes up the users.
2011-06-14 11:21:49 -07:00
Ben Pfaff
d1e9b9bf30 nicira-ext: Renumber NXT_FLOW_MOD_TABLE_ID.
We don't know of anyone using this command in production yet, so it seems
reasonable to give it a new number instead of coping with it having a
conflicting number.
2011-06-10 09:03:22 -07:00
Justin Pettit
6c222e55fa Remove NXAST_DROP_SPOOFED_ARP action.
The NXAST_DROP_SPOOFED_ARP action has been deprecated in favor of
defining flows using the NXM_NX_ARP_SHA flow match for a while.  This
commit removes it.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-06-09 16:19:38 -07:00
Ben Pfaff
7286b1e13d ovs-controller: Allow --wildcards to specify a wildcard set.
Based on a patch by Jean Tourrilhes <jt@hpl.hp.com>.  According to Jean,
besides increasing flexibility, this reduces  normalization warnings.

Tested-by: Jean Tourrilhes <jt@hpl.hp.com>
2011-06-01 09:09:20 -07:00
Ben Pfaff
eb6f28db08 ofp-util: Factor wildcard translation out of ofputil_cls_rule_from_match().
This seems like a small cleanup, plus the new function for translating
wildcards will be independently useful in an upcoming commit.
2011-06-01 09:05:39 -07:00
Ben Pfaff
47271d0d8d ofp-util: Simplify logic for computing vlan_tci and vlan_tci_mask.
I believe that this is completely equivalent to, but simpler than, the code
that was here before.
2011-06-01 09:05:36 -07:00
Ben Pfaff
b459a924d0 ofp-util: Export (again) a generalized function for normalizing rules.
Feature #5029 requests that "ovs-ofctl add-flow" report an attempt to add
a flow that is not properly normalized, that is, a flow to which the switch
will add extra wildcards, ignoring some fields specified by the user.  This
requires that ofp-util make flow normalization directly available (again).

Until now, flow normalization has only been applied to OpenFlow 1.0 flows,
but the concept applies equally to NXM, so this commit generalizes the
implementation to NXM also.
2011-05-27 15:42:19 -07:00
Ben Pfaff
af6bce18ee ofp-util: Also force nw_tos to be wildcarded for ARP flows.
OVS doesn't fill nw_tos with anything meaningful for ARP flows so we should
also force nw_tos to be wildcarded for ARP.
2011-05-27 15:42:18 -07:00
Ben Pfaff
7fb563b94c ofp-util: Include cookie when encoding OFPT_FLOW_REMOVED messages.
Reported-by: kk yap <yapkke@stanford.edu>
Tested-by: kk yap <yapkke@stanford.edu>
2011-05-20 16:42:40 -07:00
Ben Pfaff
b2fda3effc Merge 'next' into 'master'.
I know already that this breaks the statsfixes that were implemented by the
following commits:

827ab71c97f "ofproto: Datapath statistics accounted twice."
6f1435fc8f7 "ofproto: Resubmit statistics improperly account during..."

These were already broken in a previous merge.  I will work on a fix.
2011-05-18 14:01:13 -07:00
Ben Pfaff
eeba8e4fd3 Fix up usage of flow_wildcards_t.
The flow_wildcards_t type is defined as a distinct type from sparse's
perspective (with __attribute__((bitwise))) so that we don't accidentally
mix it with only-partially-compatible OFPFW_* flags.  But we were weren't
using it quite right in a few plces.  This fixes it up.
2011-05-16 13:40:48 -07:00