2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-24 19:07:45 +00:00

23 Commits

Author SHA1 Message Date
Simon Horman
dd43a55859 Do not perform validation in learn_parse();
I believe this is consistent with the handling of all other action
parsing called from parse_named_action().

Verification of all actions, including learn actions, occurs separately
in ofpact_check__(). It also occurs via in a call to ofpacts_check()
in parse_ofp_str(),

This patch is larger than might otherwise be expected as the flow argument
of learn_parse() is now unused and thus removed.  This propagates up the
call-chain some way.

This implementation was suggested by Jesse Gross in response to an
enhancement I made to the validation performed during parsing learn actions
to allow it to correctly account for changes to the dl_type due to MPLS
push and pop actions.

Tests have also been updated to check for the less specific messages
generated by the call to ofpacts_check() in parse_ofp_str() which at the
suggestion of Ben Pfaff was added by a prior patch for this purpose.

Cc: Jesse Gross <jesse@nicira.com>
Cc: Ben Pfaff <blp@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-05-08 10:46:25 -07:00
Ben Pfaff
158edc8d32 ofp-actions: Right-justify the value in ofpact_reg_load 'subvalue' member.
This is what I intended when I suggested using mf_subvalue, but I didn't
notice the difference until after applying the patch.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
2012-09-12 21:00:08 -07:00
Isaku Yamahata
9bab681f33 lib/ofp-actions: use mf_subvalue in struct ofpact_reg_load.
Use a uninion mf_subvalue instead of a uint64_t for
the value member of struct ofpact_reg_load.

set_field action needs to hold values wider than 64 bits.
This is preparation for set_field action.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-09-12 09:59:38 -07:00
Ben Pfaff
81a76618be classifier: Break cls_rule 'flow' and 'wc' members into new "struct match".
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-09-04 12:24:27 -07:00
Ben Pfaff
f25d0cf3c3 Introduce ofpacts, an abstraction of OpenFlow actions.
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>
2012-07-03 22:21:11 -07:00
Joe Stringer
969fc56c2a Add OXM_OF_METADATA field as a step toward OpenFlow 1.1 support.
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-06-26 22:31:44 -07:00
Joe Stringer
73c0ce349b flow: Adds support for arbitrary ethernet masking
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>
2012-05-29 12:24:07 -07:00
Justin Pettit
623e1caf2f ofp-util: Clean up cookie handling.
Commit e72e793 (Add ability to restrict flow mods and flow stats
requests to cookies.) modified cookie handling.  Some of its behavior
was unintuitive and there was at least one bug (described below).
Commit f66b87d (DESIGN: Document uses for flow cookies.) attempted to
document a clean design for cookie handling.  This commit updates the
DESIGN document and brings the implementation in line with it.

In commit e72e793, the code that handled processing OpenFlow flow
modification requests set the cookie mask to exact-match.  This seems
reasonable for adding flows, but is not correct for matching, since
OpenFlow 1.0 doesn't support matching based on the cookie.  This commit
changes to cookie mask to fully wildcarded, which is the correct
behavior for modifications and deletions.  It doesn't cause any problems
for flow additions, since the mask is ignored for that operation.

Bug #9742

Reported-by: Luca Giraudo <lgiraudo@nicira.com>
Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
2012-05-29 01:41:21 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
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>
2012-05-02 17:08:02 -07:00
Ansis Atteka
47284b1fc6 nicira-ext: Support masking of nd_target field
This commit adds support to specify a mask in CIDR format for
the nd_target field.

Signed-off-by: Ansis Atteka <aatteka@nicira.com>
2012-04-26 15:22:48 -07:00
Ben Pfaff
3d792b703f learn: Make it possible to parse "load" actions wider than 64 bits.
The implementation of the "learn" action now properly implements
specifications such as 0x20010db885a308d313198a2e03707348->NXM_NX_IPV6_DST
but the parser used in ovs-ofctl and elsewhere could not generate such
specifications.  This commit adds that support.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-04-13 21:24:17 -07:00
Ben Pfaff
337b9cec45 learn: Fix bugs when learn actions use subfields wider than 64 bits.
Bug #10576.
Reported-by: James Schmidt <jschmidt@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-04-13 21:19:15 -07:00
Ben Pfaff
9ed20b8a36 learn: Initialize cookie_mask in constructed flow_mod.
Otherwise the "learn" action may not correctly set the cookie in flows that
it creates.

Found by valgrind.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-21 08:51:30 -07:00
Ben Pfaff
08f94c0e1a openflow: Split OFPAT_* into OFPAT10_* and OFPAT11_*.
An upcoming commit will start referring to OpenFlow 1.1 actions, which are
renumbered relative to OpenFlow 1.0 actions, so this commit prepares by
changing all the existing uses of OFPAT_* to instead use OFPAT10_*.

This commit also introduces the OFPAT11_* constants.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-07 14:05:10 -08:00
Ben Pfaff
0e553d9c10 Implement new "fin_timeout" action and "learn" feature.
The "learn" action can create matching return flows.  If those have a long
timeout then it's a good idea to have a way to notice when in fact the
flows have terminated.  This new action and matching "learn" feature
provides that way.

Feature #8603.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-15 10:37:03 -08:00
Ben Pfaff
0c3d5fc89a ovs-ofctl: Add "packet-out" command.
I don't expect this to be widely useful.  An upcoming commit will add a
use in unit tests.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-02-09 13:23:37 -08:00
Ben Pfaff
816fd533f8 meta-flow: New "subfield" data structure.
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>
2012-02-01 14:15:11 -08:00
Ben Pfaff
90bf1e0732 Better abstract OpenFlow error codes.
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>
2012-01-12 15:54:25 -08:00
Ben Pfaff
f299fbeb4b learn: Avoid 1-byte buffer underrun in learn_format().
Reported-and-tested-by: Jari Sundell <sundell.software@gmail.com>
2011-12-01 08:33:55 -08:00
Ben Pfaff
28da1f8f72 nx-match: Fold all of its data structures into mf_field.
This is less redundant.
2011-11-21 14:45:54 -08:00
Ben Pfaff
4cb3fde7c9 learn: Check learn actions after parsing in learn_parse().
learn_parse() and learn_check() are supposed to apply the same checks, but
they are implemented very differently.  It seems best to have learn_parse()
actually call learn_check() just to be sure.

This would have caught the bug fixed in the previous commit, because
the tests actually contain instances of "learn" actions that trigger the
bug, but the tests only parsed the actions without ever doing anything
that checked them (like sending them to ovs-vswitchd over OpenFlow).
2011-10-18 13:43:39 -07:00
Ben Pfaff
db0a4375c4 learn: Allow read-only fields to be matched.
nxm_dst_check() requires a writable field.  Since NX_LEARN_DST_MATCH only
matches on a field and doesn't write to a field, use nxm_src_check() for
that case instead.

Bug #7507.
Reported-by: Michael Mao <mmao@nicira.com>
2011-10-18 13:43:39 -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