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

168 Commits

Author SHA1 Message Date
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
Ben Pfaff
61fe3a7b3b ofp-print: Print OFPUTIL_NXT_ROLE_REQUEST and OFPUTIL_NXT_ROLE_REPLY. 2010-12-09 10:27:08 -08:00
Ben Pfaff
09862ec609 ofp-print: Print durations more readably.
It's easier to read "duration=1.75s" than "duration_sec=1s
duration_nsec=750000000ns".
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
05abb769d3 ofp-print: Improve OFPST_FLOW stats reply printing.
This fixes the spacing and prints the priority included in the message
instead of the implicit priority.
2010-12-08 17:11:19 -08:00
Ben Pfaff
dab45bfd57 ofp-print: Verify size of OFPAT_ENQUEUE actions.
This fixes a bug, although not a very serious one.
2010-12-08 17:11:19 -08:00
Ben Pfaff
d689a6a819 ofp-print: Fix typos. 2010-12-08 17:08:57 -08:00
Justin Pettit
f74be05a0e ofp-print: Print Nicira error extension messages.
Currently, Nicira error messages are non-overlapping with the OpenFlow
error definitions.  This commit takes advantage of that by not taking
into account the vendor id.  Printing error messages is likely to be
overhauled before long, and a more general approach can be taken then.
2010-12-08 16:41:02 -08:00
Ben Pfaff
fab8fadba0 ofp-print: Print each flow at the start of a line.
Before this commit, the first flow in "ovs-ofctl dump-flows" output was
printed on the same line as the OpenFlow message type name and the xid.
With this commit, that flow is put on a line of its own, like all of the
other flows in the output.

Requested-by: Paul Ingram <paul@nicira.com>
CC: Paul Ingram <paul@nicira.com>
2010-12-08 13:32:54 -08:00
Ben Pfaff
0bc9407dbb ofpbuf: New function ofpbuf_use_const().
This is a code cleanup.

Suggested-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-07 13:44:17 -08:00
Ben Pfaff
7fa9111326 ofp-print: Implement printing for OFPUTIL_NXT_FLOW_MOD. 2010-12-07 13:22:46 -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
5b16f00916 Format tunnel IDs consistently.
Some code failed to convert tunnel IDs to host byte order for printing,
so this fixes that.  Some code printed tunnel IDs with a 0x prefix and
other code didn't, so this code uses the '#' flag consistently (which
prints 0x for nonzero values and omits it for zero).

This commit also stops always printing all 8 digits.  When tunnel IDs
are expanded to 64 bits, as they will be soon, printing 16 digits all the
time wastes too much space.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-03 09:32:31 -08:00
Ben Pfaff
1d87ef5cb2 ofp-print: Fix handling of zero-length actions.
Without this change, zero-length ofp_actions cause an infinite loop.
2010-12-02 14:57:58 -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
8321fb9c57 ofp-print: Avoid converting flow to ofp_match just to format it.
These days we have a function to format a struct flow directly, so we might
as well use it.
2010-11-22 09:40:34 -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
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
Romain Lenglet
1a960c8085 ofp-print: always print the flow nw_tos if not wildcarded
Print the nw_tos field for all flows if it is not wildcarded, instead
of only if the dl_type is IP and the nw_proto is not ICMP, TCP, or
UDP.
2010-11-04 21:58:06 -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
Ben Pfaff
ae412e7dd8 flow: Get rid of flow_t typedef.
When userspace and the kernel were using the same structure for flows,
flow_t was a useful way to indicate that a structure was really a userspace
flow instead of a kernel one, but now it's better to just write "struct
flow" for consistency, since OVS doesn't use typedefs for structs
elsewhere.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-10-11 13:31:43 -07:00
Justin Pettit
eedc0097f4 Add Nicira extension for modifying queue without transmitting
The OpenFlow OFPAT_ENQUEUE action sets a queue id and outputs the packet
in one shot.  There are times in which the queue should be set, but the
output port is not yet known.  This commit adds the NXAST_SET_QUEUE and
NXAST_POP_QUEUE Nicira extension actions to modify the queue
configuration without requiring a port argument.

CC: Jeremy Stribling <strib@nicira.com>
CC: Keith Amidon <keith@nicira.com>
2010-10-02 18:36:10 -07:00
Ben Pfaff
3ff4f87161 ofp-print: Make output easier to read. 2010-10-01 13:09:05 -07:00
Ben Pfaff
d2805da2cb ovs-ofctl: Add "queue-stats" command to print queue stats. 2010-10-01 10:40:00 -07:00
Ben Pfaff
a77d89b84a Properly print drop_spoofed_arp actions when decoding OpenFlow and ODP.
Also fix formatting of unknown Nicira actions in OpenFlow.
2010-09-15 13:26:46 -07:00
Joe Perches
d295e8e97a treewide: Remove trailing whitespace
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-30 13:23:08 -07:00
Ben Pfaff
c4d279ab34 Add pretty-printers for QoS related OpenFlow and ODP actions. 2010-07-20 11:22:36 -07:00
Jesse Gross
659586efcf tunneling: Add support for tunnel ID.
Add a tun_id field which contains the ID of the encapsulating tunnel
on which a packet was received (0 if not received on a tunnel).  Also
add an action which allows the tunnel ID to be set for outgoing
packets.  At this point there aren't any tunnel implementations so
these fields don't have any effect.

The matching is exposed to OpenFlow by overloading the high 32 bits
of the cookie as the tunnel ID.  ovs-ofctl is capable of turning
on this special behavior using a new "tun-cookie" command but this
command is intentially undocumented to avoid it being used without
a full understanding of the consequences.
2010-04-19 09:11:51 -04:00
Justin Pettit
6a1f89c86b print: Print mod_vlan_vid action in decimal
In a flow description, the VLAN VID was printed in hex, but an VLAN VID
modification would print the value in decimal.  This commit consistently
prints the value in decimal.

CC: Paul Ingram <paul@nicira.com>
2010-04-12 02:46:12 -07:00
Justin Pettit
8cce2125ee ovs-ofctl: Allow setting cookie as a decimal or hex value
Clean-up a few items related to flow cookies:

    - Allow setting the flow cookie as a hex or decimal string
    - Consistently print the cookie in hex
    - Document the ability to set the flow cookie in ovs-ofctl.
2010-04-12 02:46:12 -07:00
Justin Pettit
59a1e28863 ofp-print: Cleanup typos in print OpenFlow Flow Stats Reply 2010-03-11 07:49:20 -08:00
Ben Pfaff
02dd3123a0 Merge "master" into "next". 2010-02-24 13:47:09 -08:00
Justin Pettit
dd70b47582 Don't go beyond buffer length when printing descriptions
Prevent reading past the end of the buffer when a description is not
null-terminated.

Reported-by: Ben Pfaff <blp@nicira.com>
2010-02-20 02:22:29 -08:00