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

101 Commits

Author SHA1 Message Date
Ben Pfaff
0c58c0c4da ofp-print: Add missing "break".
This is not a bug yet, but it could be the next time someone carelessly
adds a new case.
2011-08-15 15:18:30 -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
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
0ab14c8e28 ofp-print: Make port "config" and "state" output easier to read.
This changes the output of "ovs-ofctl show" from printing ports like this:
     1(eth1): addr:50:54:00:00:00:02, config: 0x11, state:0x1
to this:
     1(eth1): addr:50:54:00:00:00:02
         config:     PORT_DOWN NO_FLOOD
         state:      LINK_DOWN
which seems much easier to read.

It also eliminates trailing white space from the output.

Reported-by: Ethan Jackson <ethan@nicira.com>
2011-07-26 17:04:38 -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
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
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
fb115f912b classifier: Print ARP opcode as "arp_op" instead of "opcode".
"opcode" is not very specific.  All the other ARP fields have an "arp_"
prefix, so this commit adds one for the opcode too.
2011-06-30 10:02:55 -07:00
Ben Pfaff
e896c2d42d ofp-print: Change "table_id" to "table" in flow_mod and flow_stats.
Flow dumps printed the OpenFlow table ID under the name "table_id", but
the flow parser only accepted "table".  This makes them consistent by
changing the output.  (Another alternative would be to change the accepted
input name.)
2011-06-14 11:21:52 -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
675baf0cdf nicira-ext: Separate nx_aggregate_stats_reply from ofp_aggregate_stats_reply.
An upcoming patch will make stats messages much more like other messages,
in that their structures will include all of the headers.  This means that
struct ofp_aggregate_stats_reply will no longer be appropriate as a
member of struct nx_aggregate_stats_reply, because it will then include
those additional header members.

Also, struct nx_aggregate_stats_reply doesn't need to use the special
ovs_32aligned_be64 type, since its 64-bit members are correctly aligned,
which is another reasonable reason to keep it separate.
2011-06-14 11:21:50 -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
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
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
d84d4b88d2 Fix incorrect byte order annotations.
These are not actual bugs, just deceptive use of the wrong function or
type.

Found by sparse.
2011-05-16 13:40:47 -07:00
Ben Pfaff
dbba996be2 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-16 13:40:47 -07:00
Ben Pfaff
0079481775 Merge 'master' into 'next'. 2011-05-12 12:05:42 -07:00
Ben Pfaff
6c1491fbd7 Implement basic multiple table support.
This implements basic multiple table support in ofproto and supporting
libraries and utilities. The design is the same as the one that has been
on the Open vSwitch "wdp" branch for a long time.  There is no support for
multiple tables in the software switch implementation (ofproto-dpif), only
a set of hooks for other switch implementations to use.

To allow controllers to add flows in a particular table, Open vSwitch adds
an OpenFlow 1.0 extension called NXT_FLOW_MOD_TABLE_ID.
2011-05-12 09:58:01 -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
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
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
Ben Pfaff
858f285284 Fix calls to ctype functions.
The ctype functions often need casts to be fully C standards compliant.
Here's the full explanation that I used to post to comp.lang.c from time
to time when the issue came up:

    With the to*() and is*() functions, you should be careful to cast
    `char' arguments to `unsigned char' before calling them.  Type `char'
    may be signed or unsigned, depending on your compiler or its
    configuration.  If `char' is signed, then some characters have
    negative values; however, the arguments to is*() and to*() functions
    must be nonnegative (or EOF).  Casting to `unsigned char' fixes this
    problem by forcing the character to the corresponding positive value.

This fixes the following warnings from some version of GCC:

lib/ofp-parse.c:828: warning: array subscript has type 'char'
lib/ofp-print.c:617: warning: array subscript has type 'char'

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
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
fbc7ed06a7 ofp-print: Consistently print priority only if it is not default.
In NXST_FLOW replies, the priority was printed only if it was not
OFP_DEFAULT_PRIORITY, but it was always printed in OFPST_FLOW replies.
This commit changes OFPST_FLOW replies to match NXST_FLOW replies.
2011-03-16 14:53:15 -07:00
Ben Pfaff
6d38ac7cb9 ofp-print: Omit timestamp when printing packets in ofp_packet_to_string().
There's no value in the timestamp here, because it will always be the
same.  Printing it just makes results less reproducible because output
then depends on the time zone.

This fixes a test failure in California due to yesterday's DST change,
and presumably a test failure almost everywhere else all the time.

Reported-by: Andrew Evans <aevans@nicira.com>
2011-03-14 10:13:34 -07:00
Ben Pfaff
54ae6fa8f1 ofp-print: Don't print priority for flow stats requests.
A flow stats or aggregate stats request does not have a priority, but we
were printing one anyway.

Reported-by: Justin Pettit <jpettit@nicira.com>
2011-02-24 17:13:30 -08:00
Ben Pfaff
e868fb3d32 util: Don't read over 'size - 1' bytes of source string in ovs_strlcpy().
The blind replacement of strncpy() by ovs_strlcpy() is risky because
strncpy() never reads more bytes from its source string than necessary to
write its destination string, but ovs_strlcpy() and the OpenBSD function
that inspired it both read the entire source string.  This avoids that
problem.

Given that change, we can use ovs_strlcpy() in a few more places, and
this commit does that too.

Coverity #10697,10696,10695,10694,10693,10692,10691,10690.
2011-02-22 16:33:35 -08:00
Ben Pfaff
c4617b3c28 openflow: Use types and accessors for half-aligned 64-bit fields.
Without this commit, many of the unit tests for ofp-print.c fail with bus
errors on RISC architectures (tested on sparc) and presumably so would any
other code that uses these same struct members.
2011-02-05 13:14:49 -08:00
Justin Pettit
6767a2cce9 lib: Replace IP_TYPE_ references with IPPROTO_.
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.
2011-02-02 11:50:17 -08:00
Ben Pfaff
fbd76b2eef ofp-print: Insert missing whitespace. 2011-01-12 13:51:43 -08:00
Ben Pfaff
3b62feba98 ofp-print: Print fragment handling in OpenFlow switch config messages. 2011-01-12 13:51:43 -08:00
Ben Pfaff
dc4762edd0 Automatically extract error types and codes for formatting. 2011-01-12 13:51:43 -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
49ad0403a7 ofp-print: Improve formatting for bad OpenFlow messages. 2010-12-15 09:48:18 -08:00
Ben Pfaff
f904747bf8 ofp-print: Always print priority exactly once.
Reported-by: Paul Ingram <paul@nicira.com>
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
8961de6adf ofp-print: Print every flow on a new line for NXST_FLOW replies too.
This makes NXST_FLOW formatting consistent with OFPST_FLOW.

Suggested-by: Justin Pettit <jpettit@nicira.com>
2010-12-09 12:31:31 -08:00
Ben Pfaff
f393f81e42 ofp-print, ofp-parse: Add support for NXAST_REG_MOVE and NXAST_REG_LOAD. 2010-12-09 11:03:35 -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
a2ad9ecdd0 ofp-print: Print OFPUTIL_NXST_AGGREGATE_REPLY. 2010-12-09 10:27:08 -08:00
Ben Pfaff
2af0c0ef3f ofp-print: Print NXST_FLOW_REQUEST and NXST_AGGREGATE_REQUEST.
This takes advantage of ofputil_decode_flow_stats_request() to get rid of
some code.
2010-12-09 10:27:08 -08:00
Ben Pfaff
3731490fda ofp-print: Print OFPUTIL_NXT_STATUS_REQUEST and OFPUTIL_NXT_STATUS_REPLY. 2010-12-09 10:27:08 -08:00