2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 05:18:13 +00:00

227 Commits

Author SHA1 Message Date
Ben Pfaff
d93ca2a0fd ofp-util: Fix validation of OFPAT_SET_VLAN_PCP actions.
Found by sparse.
2011-05-04 15:47:27 -07:00
Ben Pfaff
2c360fbb27 Convert remaining network-byte-order "uint<N>_t"s into "ovs_be<N>"s.
I looked at almost every uint<N>_t in the tree to determine whether it was
really in network byte order, and converted the ones that were.

The only remaining ones, modulo my mistakes, are in openflow.h.  I'm not
sure whether we should convert those, because there might be some value
in remaining close to upstream for this header.
2011-05-04 10:12:05 -07:00
Ben Pfaff
9cfcdadf93 ofproto: Maintain ofp_phy_port for each ofport in network byte order.
It's rather confusing to have an instance of a whole structure in an
unexpected byte order.  This commit gets rid of that oddity.
2011-05-04 10:12:05 -07:00
Ben Pfaff
b78f6b77bc Remove support for obsolete "tun_id_from_cookie" extension.
The "tun_id_from_cookie" OpenFlow extension predated NXM and supports only
a fraction of its features.  Nothing (at Nicira, anyway) uses it any
longer.  Support for it had been broken since January and it took until a
few days ago for anyone to complain, so it cannot be too important.  This
commit removes it.
2011-04-26 09:42:18 -07:00
Ben Pfaff
0721c0739f ofp-util: Properly handle "tun_id"s in tun_id_from_cookie flows.
Just setting the tun_id field isn't enough--it's also necessary to set
the tun_id_mask.  Otherwise the call to cls_rule_zero_wildcarded_fields()
at the end of ofputil_cls_rule_from_match() will zero out the tun_id again.

This was broken by commit 8368c090cab "Implement arbitrary bitwise masks
for tun_id field" back in January.  (This makes me wonder whether we can
drop support for tun_id_from_cookie now.)

Reported-by: Dan Wendlandt <dan@nicira.com>
2011-04-19 11:55:19 -07:00
Ben Pfaff
5160ab34f8 Avoid warnings about comparisons that are always true.
The range of "enum" types varies from one ABI to another.  If the enums
being tested in these functions happen to be 16 bits wide, then GCC may
issue a warning because, in such a case, the comparison is always true.

Using an int instead of a uint16_t avoids that particular problem and
should suppress the warning.

Fixes the following reported warnings:

lib/ofp-print.c:240: warning: comparison is always true due to limited
range of data type
lib/ofp-util.c:1973: warning: comparison is always false due to limited
range of data type

Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
2011-04-18 10:26:17 -07:00
Ethan Jackson
3b6a2571f0 autopath: Create the autopath action.
The newly created autopath action will be the way OpenFlow
interacts with the existing bonding infrastructure.
2011-04-11 15:56:20 -07:00
Ben Pfaff
a6159a233e ofp-util: Remove flow_stats_iterator, flows_stats_first(), flow_stats_next()
Nothing uses these anymore.  ofputil_decode_flow_stats_reply() is a better
alternative.
2011-03-30 11:33:18 -07:00
Ben Pfaff
4093ec5979 ofproto: Move hton_ofp_phy_port() to ofp-util.
This removes some code from ofproto.c that doesn't really seem to
belong there to begin with.
2011-03-29 12:28:10 -07:00
Ben Pfaff
ebb57021a9 ofproto: Break packet_in encoding out of ofproto into ofp-util.
This removes some code from ofproto.c.
2011-03-29 12:28:10 -07:00
Ben Pfaff
588cd7b5d2 ofproto: Factor building of flow_removed messages out into ofp-util.
This removes some code from ofproto.c.
2011-03-29 12:28:10 -07:00
Ben Pfaff
9b45d7f5db ofproto: Get rid of archaic "switch status" OpenFlow extension.
Back in 2008 or so, I introduced this extension as a way to provide
information about switch status to the new "switch UI" program.  Since
then, the switch UI program has been removed and the important information
that was provided by the switch status extension is now available in the
database, so we might as well get rid of this extension, and that is what
this commit does.
2011-03-16 14:57:56 -07:00
Ben Pfaff
4ffd1b437c ofp-util: New function ofputil_decode_flow_stats_reply().
This function will see more use later in this series.  This commit just
starts using it to make ofp-print output entirely consistent for
OFPST_FLOW and NXST_FLOW replies.
2011-03-16 14:53:16 -07:00
Ben Pfaff
b9d5a387b2 ofp-util: Make NXM required for 64-bit cookies in is_nxm_required().
Only NXM supports 64-bit cookies, but this code didn't properly check
for that.  This commit fixes the problem and makes the code much more
explicit about what it is checking.

This will hide bug #4566, but the following commit actually fixes it.
2011-03-01 14:20:52 -08:00
Justin Pettit
685a51a5b8 nicira-ext: Support matching IPv6 Neighbor Discovery messages.
IPv6 uses Neighbor Discovery messages in a similar manner to how IPv4
uses ARP.  This commit adds support for matching deeper into the
payloads of Neighbor Solicitation (NS) and Neighbor Advertisement (NA)
messages.  Currently, the matching fields include:

    - NS and NA Target (nd_target)
    - NS Source Link Layer Address (nd_sll)
    - NA Target Link Layer Address (nd_tll)

When defining IPv6 Neighbor Discovery rules, the Nicira Extensible Match
(NXM) extension to OVS must be used.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2011-02-02 13:22:34 -08:00
Justin Pettit
d31f1109f1 nicira-ext: Support matching IPv6 traffic.
Provides ability to match over IPv6 traffic in the same manner as IPv4.
Currently, the matching fields include:

    - IPv6 source and destination addresses (ipv6_src and ipv6_dst)
    - Traffic Class (nw_tos)
    - Next Header (nw_proto)
    - ICMPv6 Type and Code (icmp_type and icmp_code)
    - TCP and UDP Ports over IPv6 (tp_src and tp_dst)

When defining IPv6 rules, the Nicira Extensible Match (NXM) extension to
OVS must be used.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2011-02-02 12:53:26 -08:00
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