2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 13:58:14 +00:00
Commit Graph

408 Commits

Author SHA1 Message Date
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
e89993f33c ovs-ofctl: Fix reading flows from file for "replace-flows", "diff-flows".
Commit c821124b25 "ovs-ofctl: Accept only valid flow_mod and
flow_stats_request fields" caused actions read by read_flows_from_file()
to be ignored and treated as "drop".  This fixes the problem.
2011-08-09 12:55:13 -07:00
Justin Pettit
55d5bb44cb util: Introduce get_program_version function.
Useful in an upcoming commit.
2011-08-04 11:15:43 -07:00
Ethan Jackson
db5b4525b2 ovs-ofctl: Print human readable nx_pull_match() errors.
I've found this makes debugging a bit easier.
2011-07-28 17:06:00 -07:00
Ben Pfaff
eaa6eb2afd ovs-ofctl: Fix dump-ports and queue-stats commands.
These ovs-ofctl commands have been sending malformed stats requests since
commit 63f2140a55 "openflow: Make stats replies more like other OpenFlow
messages."  This commit fixes the problem and adds basic unit tests that
should prevent similar regressions.

Reported-by: Hao Zheng <hzheng@nicira.com>
2011-07-27 15:00:34 -07:00
Ben Pfaff
c4ea79bf9c ovs-ofctl: New --readd option for "replace-flows".
This is useful for resetting flows' byte and packet counters to 0.

Suggested-by: Jed Daniels <openvswitch@jeddaniels.com>
2011-07-27 14:58:10 -07:00
Ben Pfaff
3a27375ead ovs-ofctl: Use strchr() instead of strstr().
It's the right tool for the job.  Potentially faster, too.
2011-07-21 11:12:45 -07:00
Ben Pfaff
2c0e6eb41f ovs-ofctl: Improve error message for "ovs-ofctl show nonexistent".
Suggested-by: Peter Balland <peter@nicira.com>
2011-07-20 14:32:33 -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
c821124b25 ovs-ofctl: Accept only valid flow_mod and flow_stats_request fields.
OpenFlow commands have several idiosyncratic fields that are used in some
cases and ignored in others.  Until now, ovs-ofctl has been lax about
allowing some of them in places where they are ignored.  This commit
tightens the checks to exactly what is allowed.

Bug #5979.
Reported-by: Reid Price <reid@nicira.com>
2011-06-23 12:21:13 -07:00
Andrew Evans
ec610b7bf4 ovs-ofctl: Print the offending flow on parse error when reading from a file.
When an error is encountered while parsing flows from a file, ovs-ofctl doesn't
print the erroneous flow, so it's not always obvious which flow is causing
the error. Print the flow before the error message to make it clear.
2011-06-17 12:25:42 -07:00
Andrew Evans
5ff660c696 ovs-ofctl: Add 'replace-flows' command to usage. 2011-06-16 15:49:49 -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
b2fda3effc Merge 'next' into 'master'.
I know already that this breaks the statsfixes that were implemented by the
following commits:

827ab71c97 "ofproto: Datapath statistics accounted twice."
6f1435fc8f "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
e3c1773370 Consistently write null pointer constants as NULL instead of 0.
Found with sparse.
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
08944c1db1 ofproto: Make rule construction and destruction more symmetric.
Before, ->rule_construct() both created the rule and inserted into the
flow table, but ->rule_destruct() only destroyed the rule.  This makes
->rule_destruct() also remove the rule from the flow table.
2011-05-11 14:06:48 -07:00
Ben Pfaff
63d347ce1b ofproto: Improve abstraction by adding function ofproto_parse_name().
This means that ovs-ofctl and ovs-openflowd don't have to use the dpif
layer at all, making it easier to change the ofproto implementation.
2011-05-11 12:26:08 -07:00
Ben Pfaff
bf8f2167fd stream-ssl: Improve messages when configuring SSL if it is unsupported.
Previously, if --private-key or another option that requires SSL support
was used, but OVS was built without OpenSSL support, then OVS would fail
with an error message that the specified option was not supported.  This
confused users because it made them think that the option had been removed:
    http://openvswitch.org/pipermail/discuss/2011-April/005034.html

This commit improves the error message: OVS will now report that it was
built without SSL support.  This should be make the problem clear to users.

Reported-by: Aaron Rosen <arosen@clemson.edu>
Feature #5325.
2011-05-10 09:17:37 -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
279c9e0308 Log anything that could prevent a daemon from starting.
If a daemon doesn't start, we need to know why.  Being able to
consistently consult the log to find out is helpful.
2011-04-04 10:58:55 -07:00
Ben Pfaff
fcaddd4dd1 util: New function ovs_fatal_valist().
This commit adds a few initial users but more are coming up.
2011-04-04 10:58:55 -07:00
Ethan Jackson
aca8556998 ovs-ofctl: Remove dead assignment. 2011-03-31 16:40:43 -07:00
Gaetano Catalli
bd6b75452e Fix compilation of openvswitch-1.1.0pre2 on FreeBSD-8.1 2011-03-30 09:43:28 -07:00
Ben Pfaff
4989c59ff3 ovs-ofctl: Make mod-flows and del-flows commands able read files.
This makes it possible to modify or delete multiple flows in one run,
which is sometimes convenient.

Requested-by: Paul Ingram <paul@nicira.com>
2011-03-18 14:41:36 -07:00
Ben Pfaff
02c5617b60 ofp-parse: Generalize parse_ofp_add_flow_file() to parse_ofp_flow_mod_file().
An upcoming commit will want to pass a different command.
2011-03-18 14:41:36 -07:00
Ben Pfaff
0199c526f1 ovs-ofctl: New commands "replace-flows" and "diff-flows".
Requested-by: Paul Ingram <paul@nicira.com>
2011-03-18 14:41:35 -07:00
Ben Pfaff
0283336539 ovs-ofctl: Use ovs_be32 for big-endian variable. 2011-03-18 14:40:55 -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
f9cbfbe4f4 ovs-ofctl: Check min flow format support in negotiate_highest_flow_format().
When the -F option wasn't set, or if it was set to an invalid flow format
for the match, this code would happily select a flow format that did not
select the user's requested match if the switch didn't support an
advanced-enough flow format.  This fixes the problem.  It also changes
behavior in the case where the user specifies a flow format that cannot
represent the match, changing this from a warning to a fatal error; this
is consistent with -F behavior for flow_mod commands.
2011-03-16 14:53:15 -07:00
Ben Pfaff
70315176de ovs-ofctl: Make add-flows command read from stdin if file name is "-".
It is conventional for Unix tools to read from standard input if "-" is
specified as a file name.  It's easy for "ovs-ofctl add-flows" to behave
this way, too, so this commit implements it.

Suggested-by: Paul Ingram <paul@nicira.com>
2011-03-09 16:22:00 -08:00
Ben Pfaff
0fbc9f11c0 ovs-ofctl: Implement documented semantics of --flow-format for flow_mods.
Also adds a test and moves some code around in tests/ to make sure that
OFPROTO_START and OFPROTO_STOP are available in tests/ovs-ofctl.at.

Reported-by: Michael Mao <mmao@nicira.com>
Bug #4566.
2011-03-01 14:20:52 -08:00
Ben Pfaff
770f1f66bb multipath: Validate multipath actions more thoroughly in multipath_parse().
The stricter validation requires updates to the calls to test-multipath
to supply a valid n_links value.  test-multipath doesn't actually use
that value (it runs over different values in an internal "for" loop), so
this doesn't change any behavior.

Also adds a test to exercise each possible multipath_parse() error message.

Reported-by: Reid Price <reid@nicira.com>
Bug #4462.
2011-02-23 09:42:32 -08:00
Ben Pfaff
fec00620d6 ofp-print: Add tests for OpenFlow message formatting.
It's become clear over the past few weeks that some people really depend
on the formatting of ofp-print output.  It has also become clear that OVS
doesn't have anything that actually checks or enforces the formatting of
the output.  The former is not something I want to encourage, but the
latter is somewhat worrisome because the formatting does change from time
to time and I want to make sure that that is intentional.

So this commit adds at least one test for each supported OpenFlow and
Nicira extension message, so that we can better keep track of changes.
2011-01-12 13:57:53 -08:00
Ben Pfaff
640c7c945f ovs-ofctl: Fix del-flows command parsing bugs.
"ovs-ofctl del-flows br0" segfaulted because do_flow_mod__() assumed that
it always had a "flow" argument, which is not true for the del-flows
command.

Beyond that, parse_ofp_flow_mod_str() rejected "ovs-ofctl del-flows
br0" because no actions were supplied, even though supplying actions
doesn't make sense for deleting flows.

This commit fixes both problems and adds a simple test that would have
caught both problems.

Bug #4112.
2010-12-09 10:27:08 -08:00
Ben Pfaff
4f564f8dc7 ovs-ofctl: Add --more option to increase OpenFlow message verbosity.
This is useful for seeing the raw NXM data instead of just the parsed
cls_rules.
2010-12-07 13:32:02 -08:00
Ben Pfaff
88ca35eed0 ovs-ofctl: Add NXM support. 2010-12-07 13:32:01 -08:00
Ben Pfaff
24cd0dee6e ovs-ofctl: Demote common log messages from INFO to DBG level.
These log messages were useful long ago, but I have not found them helpful
in a long time.  Also noticed by Paul Ingram <paul@nicira.com>.
2010-12-03 10:34:01 -08:00
Ben Pfaff
b8c5c0dc73 ovs-ofctl: Reimplement dumping particular tables.
"dump-flows" and "dump-aggregate" are documented to accept a "table"
value to dump only a particular OpenFlow table, but commit 8050b31d6
"ofp-parse: Refactor flow parsing" broke this, by always dumping table
0.  This commit should fix it (though I haven't tested it).
2010-12-03 10:32:38 -08:00
Ben Pfaff
0b61210ecb openflow: Change ofp_phy_port's 'name' member from uint8_t[] to char[].
The uint8_t type here has bothered me from the very beginning.
2010-12-02 14:57:04 -08:00
Ben Pfaff
d12513f707 ovs-ofctl: Check that commands actually succeed.
Until now, when it sends commands to switches that ordinarily have no
reply, ovs-ofctl has not waited around to see whether the command succeeds
or fails.  This commit fixes the problem: errors will now be reported.
2010-12-02 14:57:04 -08:00
Ben Pfaff
3df3373283 ovs-ofctl: Remove now-useless "tun-cookie" command.
This command is no longer useful, because the setting that it modifies is
now a per-connection setting, not a global switch setting.

This command was never documented or included in --help output (probably
as an oversight).
2010-12-02 14:57:04 -08:00
Ben Pfaff
0df0e81da2 ovs-ofctl: Factor out common code in str_to_port_no(), do_mod_port(). 2010-12-02 14:57:04 -08:00
Ben Pfaff
6a1a794c3b ovs-ofctl: Remove stray printf. 2010-11-29 16:29:11 -08:00
Ben Pfaff
f48667811c ovs-ofctl: Simplify code by using strcasecmp() instead of strncasecmp().
I don't know why this code was written the way it was.  This is more
straightforward and I believe that it is equivalent, too.
2010-11-29 16:29:11 -08:00
Ben Pfaff
b43c6fe279 Make installation directories overridable at runtime.
This makes it possible to run tests that need access to installation
directories, such as the rundir, without having access to the actual
installation directories (/var/run is generally not world-writable), by
setting environment variables.  This is not a good way to do things in
general--usually it would be better to choose the correct directories
at configure time--so for now this is undocumented.
2010-11-29 16:29:11 -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