2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 12:58:00 +00:00

61 Commits

Author SHA1 Message Date
Justin Pettit
bad68a9965 nicira-ext: Support matching ARP source and target hardware addresses.
OpenFlow 1.0 doesn't allow matching on the ARP source and target
hardware address.  This has caused us to introduce hacks such as the
Drop Spoofed ARP action.  Now that we have extensible match, we can
match on more fields within ARP:

    - Source Hardware Address (arp_sha)
    - Target Hardware Address (arp_tha)

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2011-02-02 12:42:40 -08:00
Ben Pfaff
36956a7d33 datapath: Convert odp_flow_key to use Netlink attributes instead.
One of the goals for Open vSwitch is to decouple kernel and userspace
software, so that either one can be upgraded or rolled back independent of
the other.  To do this in full generality, it must be possible to change
the kernel's idea of the flow key separately from the userspace version.
In turn, that means that flow keys must become variable-length.  This
commit makes that change using Netlink attribute sequences.

This commit does not actually make userspace flexible enough to handle
changes in the kernel flow key structure, because userspace doesn't yet
have enough information to do that intelligently.  Upcoming commits will
fix that.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-01-27 21:08:35 -08:00
Ben Pfaff
8368c090ca Implement arbitrary bitwise masks for tun_id field.
This was documented to work, but not implemented.

Requested-by: Pankaj Thakkar <thakkar@nicira.com>
2011-01-20 15:29:00 -08:00
Ben Pfaff
dc4762edd0 Automatically extract error types and codes for formatting. 2011-01-12 13:51:43 -08:00
Ben Pfaff
abcf9134e4 ofp-util: Improve log messages for bad Nicira extension actions.
check_action_exact_len() will always report that a Nicira extension action
has type 65535 (OFPAT_VENDOR), which isn't very helpful for debugging.
This introduces a new function that reports the subtype.

Also, log the subtype of unknown Nicira vendor actions.
2010-12-27 09:45:06 -08:00
Ben Pfaff
f435052921 ofp-util: Upgrade log messages for controller bugs to warning level.
All of these messages indicate that there is a bug in the controller.  We
want to know about that, so increase the log level from debug to warning.
2010-12-27 09:45:06 -08:00
Ben Pfaff
35c4693ab8 ofp-util: Improve log message for bad OpenFlow action length.
First, this is an important message since it indicates a bug in the
controller, so log it at warning level instead of debug level--we want to
know about it.

Second, properly byteswap the action type.

Third, use the correct PRIu16 format specified for a uint16_t.
2010-12-27 09:45:06 -08:00
Ben Pfaff
53ddd40ab5 Implement a new Nicira extension action for multipath link selection. 2010-12-17 14:38:50 -08:00
Ben Pfaff
08717852cd ofp-util: Improve error log messages. 2010-12-15 09:48:18 -08:00
Ben Pfaff
5c47debbf0 ofp-util: Use proper format specifier for uint32_t in ofputil_lookup_openflow_message(). 2010-12-15 09:48:18 -08:00
Ben Pfaff
9fb7fa87d0 ofp-util: Fix encoding of NXST_AGGREGATE requests.
They were being sent out as NXST_FLOW requests.
2010-12-15 09:48:18 -08:00
Ben Pfaff
b9298d3f82 Expand tunnel IDs from 32 to 64 bits.
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.
2010-12-10 11:14:13 -08:00
Ben Pfaff
ff9d38264c ofp-util: Make ofputil_cls_rule_to_match() help with flow cookies too.
This fixes OpenFlow 1.0 flow stats reporting of flows added via NXM.

I noticed this problem while implementing 64-bit tunnel IDs, hence the
positioning.  The following commit adds a test.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-10 11:14:13 -08:00
Ben Pfaff
cdee00fd63 datapath: Replace "struct odp_action" by Netlink attributes.
In the medium term, we plan to migrate the datapath to use Netlink as its
communication channel.  In the short term, we need to be able to have
actions with 64-bit arguments but "struct odp_action" only has room for
48 bits.  So this patch shifts to variable-length arguments using Netlink
attributes, which starts in on the Netlink transition and makes 64-bit
arguments possible at the same time.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-10 11:13:32 -08:00
Ben Pfaff
e41a913007 Make compiler complain about unhandled OpenFlow and Nicira action types.
This should help avoid forgetting about them in the future, because the
compiler will complain about unhandled values in switch statements.
2010-12-09 10:41:32 -08:00
Ben Pfaff
9b045a0c66 ofp-print: Print OFPUTIL_NXT_FLOW_REMOVED. 2010-12-09 10:31:49 -08:00
Ben Pfaff
8d7fb7eef5 ofp-util: Fix byte order of ofputil_cls_rule_from_match() parameter.
This doesn't change any generated code so it is not a bug fix, but it
makes the byte order of the 'cookie' argument clear.
2010-12-09 10:27:08 -08:00
Ben Pfaff
c6430da5be ofp-print: Print NXST_FLOW replies. 2010-12-09 10:27:08 -08:00
Ben Pfaff
bbc32a883f Use ofpbuf_pull() instead of ofpbuf_try_pull() where it is valid.
In each of these cases, we know that the buffer is long enough to pull
the header because ofputil_decode_msg_type() already checked for us.
2010-12-08 17:11:19 -08:00
Ben Pfaff
2013493bd6 ofp-util: Use ofpbuf_use_const() in a few more places. 2010-12-08 17:11:19 -08:00
Justin Pettit
59edb09ce1 ofp-util: Fix starting offset of OpenFlow error messages. 2010-12-08 16:17:07 -08:00
Justin Pettit
17764fb2ac ofp-util: Fix offset when making Nicira extension error messages. 2010-12-07 21:58:30 -08:00
Ben Pfaff
f9ba8dad04 ofp-util: Fully initialize flow_wildcards in ofputil_cls_rule_from_match().
The new 'zero' member was not being properly initialized.  One approach
would be to add an assignment, but it seems more future-proof to let
flow_wildcards_init_catchall() do the right thing.

Noticed by valgrind.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-07 13:44:06 -08:00
Ben Pfaff
88ca35eed0 ovs-ofctl: Add NXM support. 2010-12-07 13:32:01 -08:00
Ben Pfaff
7fa9111326 ofp-print: Implement printing for OFPUTIL_NXT_FLOW_MOD. 2010-12-07 13:22:46 -08:00
Ben Pfaff
2e4f5fcf3f ofp-util: New abstractions for flow_mod, flow_stats_request.
These will be useful for adding Nicira Extended Match support to ovs-ofctl.

This commit makes ofproto use the new flow_mod abstraction, but not the
new flow and aggregate stats abstraction.  The latter takes a bit more
infrastructure that I haven't finished yet.
2010-12-07 12:45:24 -08:00
Ben Pfaff
dfdfc8d43d ofp-util: New functions for creating Nicira extension messages. 2010-12-06 10:24:56 -08:00
Ben Pfaff
d1e2cf2119 Refactor and centralize basic OpenFlow message decoding and validation.
Open vSwitch contains a few different chunks of code that need to decode
an OpenFlow message to determine its type and then validate that it is
long enough.  Until now, the code for doing this has been more or less
scattered across the tree.  Whenever a new piece of code needed to do this,
it generally needed to reimplement at least part of it.

This commit centralizes all of that work into a single function,
ofputil_decode_msg_type(), and helper functions, and converts all of the
code that was decoding messages by hand to use the new function.
2010-12-06 10:20:20 -08:00
Ben Pfaff
492f75720e nicira-ext: Name the enum used for flow formats, to clarify code. 2010-12-03 10:30:11 -08:00
Ben Pfaff
7045a624ea ofp-util: Fix interpretation of NXFW_TUN_ID bit for NXFF_OPENFLOW10.
In NXFF_OPENFLOW10, the tun_id field is always supposed to be wildcarded.
That is what OVS used to do, but commit d8ae4d67 "flow: Fully separate
flow_wildcards from OpenFlow wildcard bits" broke it.
2010-11-24 16:10:53 -08:00
Ben Pfaff
66642cb40b nx-match: Implement support for arbitrary VLAN TCI masks.
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.
2010-11-23 10:06:28 -08:00
Ben Pfaff
daa68e9f29 ofp-util: Make make_flow_mod() take cls_rule instead of struct flow.
This reduces code duplication, by eliminating a function that translates
from "struct flow" to "struct ofp_match" in favor of the existing function
ofputil_cls_rule_to_match().  It also allows the caller to specify the
desired priority (as part of the cls_rule).
2010-11-22 10:11:41 -08:00
Ben Pfaff
d8ae4d6726 flow: Fully separate flow_wildcards from OpenFlow wildcard bits.
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.
2010-11-22 10:11:40 -08:00
Ben Pfaff
0596e89755 flow: Move functions for dealing with wildcard bit counts to ofp-util.
These functions are really OpenFlow-specific, and they will not be used
directly by the flow code soon, so move them to ofp-util.
2010-11-22 10:09:18 -08:00
Ben Pfaff
44381c1b4e ofp-util: Consistently treat OpenFlow xids as network byte order.
The 'xid' in an ofp_header is not interpreted by the receiver but only by
the sender, so it need not be in any particular byte order.  OVS used to
try to take advantage of this to avoid host/network byte order conversions
for this field.  Older code in OVS, therefore, treats xid as being in host
byte order.  However, as time went on, I forgot that I had introduced this
trick, and so newer code treats xid as being in network byte order.

This commit fixes up the situation by consistently treating xid as being
in network byte order.  I think that this will be less surprising and
easier to remember in the future.

This doesn't fix any actual bugs except that some log messages would have
printed xids in the wrong byte order.
2010-11-17 09:21:09 -08:00
Ben Pfaff
72fae17599 ofp-util: Use a counter for transaction IDs instead of a random number.
I don't know of any reason why the transaction id should be random.  Using
consecutive ids means that there is no chance that two messages sent around
the same time will have the same transaction ID, which is probabilitically
possible with random IDs.
2010-11-17 09:21:09 -08:00
Ben Pfaff
96fc46e8fd nicira-ext: New Nicira vendor action NXAST_NOTE.
Our controller group at Nicira has requested a way to annotate flows with
extra information beyond the flow cookie.  The new NXAST_NOTE action
provides such a way.

This new action is somewhat controversial.  Some have suggested that it
should be added another way (either as part of the Nicira Extended Match
or as a new component of the flow_mod and related messages).  Others think
that it has no place in the OpenFlow protocol at all and that an equivalent
should be implemented using the already available features of OVSDB.  So
it is possible that this extension will be deleted and the feature will
be reimplemented some other way (or not at all).

CC: Teemu Koponen <koponen@nicira.com>
CC: Jeremy Stribling <strib@nicira.com>
2010-11-15 09:41:41 -08:00
Ben Pfaff
69b6be193f ofp-util: Add OFP_ACTION_ALIGN macro to header.
It seems that this should really be in openflow.h but so far it isn't.
2010-11-15 09:41:41 -08:00
Ben Pfaff
b6c9e612fa ofproto: Implement support for registers in extended flow match. 2010-11-11 10:41:33 -08:00
Ben Pfaff
f1defbf96d ofp-util: Make validate_actions() take a struct flow *.
The upcoming support for actions on registers will require the flow to
validate actions, so this commit adds the parameter in advance.  It is
not yet used.
2010-11-09 17:08:09 -08:00
Ben Pfaff
ac51afaf4c ofproto: Refactor handle_packet_out().
An upcoming commit will require the flow to be passed in as part of
OpenFlow action validation, but handle_packet_out() has until now been
structured to make this difficult.  This commit refactors it to better
suit this purpose.
2010-11-09 17:08:09 -08:00
Ben Pfaff
3052b0c5e5 ofproto: Refactor handle_flow_mod().
This breaks this OpenFlow handler into two parts, one responsible
for parsing and constructing OpenFlow messages and one that works
with the flow table.  The latter will be reused in a later commit
that implements the Nicira Extended Match flexible flow match
extension.
2010-11-08 10:43:19 -08:00
Ben Pfaff
0bd0c6606a ofp-util: New functions make_nxmsg(), make_nxmsg_xid().
These functions slightly simplify constructing Nicira vendor extension
messages.
2010-11-05 09:25:38 -07:00
Ben Pfaff
217f48c61b ofp-util: Use our usual variable naming convention in make_ofp_error_msg(). 2010-11-05 09:25:37 -07:00
Ben Pfaff
3a75cda939 ofp-util: Actually map vendor codes to IDs correctly.
Reported-by: Justin Pettit <jpettit@nicira.com>
2010-11-05 09:25:37 -07:00
Ben Pfaff
26c112c241 ofp-util: Add infrastructure for vendor extensions to OpenFlow error codes.
Cross-ported from "wdp" branch.
2010-11-05 09:25:37 -07:00
Ben Pfaff
d98e600755 vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.
It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon,
so this commit switches to the more common form.
2010-10-29 09:48:47 -07:00
Ben Pfaff
10a24935c9 xtoxll: Rename "byte-order" since it now include more than xtoxll.
Suggested-by: Justin Pettit <jpettit@nicira.com>
2010-10-29 09:48:47 -07:00
Jean Tourrilhes
371e4acc87 ofp-util: Fix normalization of IP TOS bits.
If the packet is not IP, you probably want to also wildcard the ToS.
2010-10-28 09:56:52 -07:00
Ben Pfaff
27bcf966b4 datapath: Simplify ODPAT_SET_DL_TCI action.
There's no need to have a mask in this action, because both parts of the
TCI are part of the flow structure.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-10-18 11:18:23 -07:00