Commit Graph
46 Commits
Author SHA1 Message Date
Ben Pfaff 6b617bac12 Move exported headers to include/openflow, private headers to lib/.
This makes it easier to install the headers, or to use them directly from
another software package with -I$(openflow)/include, without invading
the top-level include file namespace.
2008-10-29 15:15:45 -07:00
Justin Pettit b89bd39fd9 Fix leaking of flows when output action validation fails.
When action validation fails from a flow add, the flow would be leaked.  This
caused the kmem cache (which handles allocating flow entries) to be unhappy
when we try to unload the OpenFlow module.

Thanks to Brandon Heller for catching this.
2008-10-24 17:24:06 -07:00
Justin Pettit a835cab0ea Return error message when a flow can't be added due to full tables.
When a flow cannot be added to any tables because they are full, send
a message with type OFPET_FLOW_MOD_FAILED and code OFPFMFC_ALL_TABLES_FULL.
2008-10-13 17:49:45 -07:00
Justin Pettit 14c0252da7 When sending error messages, set the length properly. 2008-10-13 14:52:47 -07:00
Justin Pettit 94f287969d Add support for Source-NAT to Linux 2.6 datapaths.
To enable SNAT, run configure with the "--enable-snat" flag.  This has
only been tested with the 2.6.23 kernel...more diverse testing will follow.
Documentation and a cleaner build setup will also be in a future check-in.
2008-10-11 00:30:02 -07:00
Justin Pettit dece4bacae Properly set in_port in skb for Flow Mod messages.
When a buffer id is placed in a Flow Mod message, the actions are expected to
be executed against the referenced packet.  The kernel implementation was
not setting the input device to what the controller was telling it to use.
Thanks to Natasha for catching this.
2008-10-06 15:14:52 -07:00
Justin Pettit 1489ca2657 Add support for vendor-defined and variable-length actions.
Allow vendors to define their own actions.  Actions were originally fixed-
length, which was a bit constraining.  Actions now contain a length field,
which gives them more flexibility.
2008-10-03 16:44:13 -07:00
Justin Pettit 06e22ff0fe Modify VLAN actions to support setting both VID and priority.
Stripping VLANs is now done through the OFPAT_STRIP_VLAN action (i.e., you
don't specify a magic value in the generirc VLAN action).  Also, it is now
possible to modify the priority bits associated with the VLAN tag through
the OFPAT_SET_VLAN_PCP action.  The OFPAT_SET_DL_VLAN has been renamed to
OFPAT_SET_VLAN_VID.
2008-09-25 15:00:38 -07:00
Justin Pettit 9da88ee2ad Modify OpenFlow commands related to ports to be more expressive.
This new OpenFlow message format provides a cleaner interface and greater
detail and control over ports.  It is now possible to see what features
the switch's port is currently configured as having, what it's advertising,
and what it's capable of handling.  It is also possible to return the
features advertised by the port's peer.
2008-09-22 15:18:22 -07:00
Justin Pettit e4cf5c4b82 Added OFPFC_MODIFY_STRICT flow mod command.
This cleans up the handling of modifying existing flows.  There now exists
OFPFC_MODIFY and OFPFC_MODIFY_STRICT commands, which have the same matching
characteristics to their OFPFC_DELETE* counterparts.  When adding a flow that
already exists, the counters and timers are now reset (ie, its treated as a
new flow).  This commit also adds the "--strict" option to dpctl to allow
strict matching for "mod-flows" and "del-flows".
2008-09-16 16:07:41 -07:00
Justin Pettit 57d5205765 Add support for OFPFC_MODIFY Flow Mod command.
The OFPFC_MODIFY command allows the controller to modify the actions of
existing flows.  When it does this, it does not reset counters or timers.
2008-09-15 15:27:04 -07:00
Ben Pfaff 9c1b16772c Implement OFPT_HELLO simple version negotiation. 2008-09-15 14:29:53 -07:00
Ben Pfaff 39136b0fb9 Make switches send error messages when they receive a bad request. 2008-09-10 13:22:25 -07:00
Ben Pfaff b5e9402df5 Implement 802.1D Spanning Tree Protocol. 2008-09-09 14:15:57 -07:00
Justin Pettit f1c6daebf3 Send PORT_STATUS messages on port and link changes. Add ability to remotely enable and disable a port through the PORT_MOD message. 2008-08-22 12:47:54 -07:00
Justin Pettit 0226bbc742 Switch to new packet-out format and add OFPP_IN_PORT.
The original packet-out format allowed multiple actions to be specified for
buffered packets, but only a destination port for messages including data.
This change makes packet-out more consistent by allowing multiple actions
regardless of how the packet is stored.

This change also disallows sending packets through the incoming port without
explicitly using the OFPP_IN_PORT virtual port.
2008-08-14 00:07:18 -07:00
Ben Pfaff 7bee00fad9 Implement OpenFlow hard timeouts.
This updates the OpenFlow protocol version and changes the names of
structure members, so any software that uses OpenFlow will need to be
updated to match.
2008-08-07 15:19:31 -07:00
Ben Pfaff 7462f2e8bd Fix bug in clearing unsupported switch flags.
We need to keep the flags we support, not drop them.
2008-08-07 13:29:10 -07:00
Ben Pfaff 5a31afdd0c Don't call kfree_skb() with interrupts disabled.
Freeing an skb that has a destructor may require interrupts to be enabled.
This can happen when netfilter is performing NAT, for example.

Discovered by Murphy McCauley.
2008-08-07 11:46:22 -07:00
Ben Pfaff 8effb451eb Don't allow unsupported flags to be set in the switch. 2008-08-07 10:34:37 -07:00
Ben Pfaff eca2aeb329 Implement OFPC_FRAG_DROP fragment handling policy. 2008-08-07 10:34:37 -07:00
Ben Pfaff 2a6dc4f319 Reduce redundancy in datapath code. 2008-08-07 10:34:37 -07:00
Ben Pfaff f2232335ab Don't need 'deleted' member of struct flow.
Flow deletion is already fully serialized on dp_mutex.
2008-07-21 13:59:55 -07:00
Ben Pfaff a304614f57 Prevent switch implementations from complaining about echo-reply messages.
Thanks to Reid Price <reid@nicira.com> for reporting the issue (which
only caused spurious warning messages).
2008-07-15 12:43:59 -07:00
Ben Pfaff 258f32a084 Respond to echo requests in OpenFlow implementations.
Nothing yet sends such requests.  This is preparation for their
use in following commits.
2008-07-01 10:51:50 -07:00
Justin Pettit 91cfc8f5dc Don't allow adding a flow entry with an output port of OFPP_NONE. 2008-06-30 21:41:46 -07:00
Justin Pettit 58dc4ead3b Fix VLAN modification action in kernel switch.
A number of errors were uncovered when we actually tried playing with VLAN tags on real traffic.  This fixes endian, sk_buff, and other issues.  Unrelated to VLAN tagging, this also protects some printk calls with net_ratelimit.
2008-06-25 23:22:39 -07:00
Ben Pfaff 6787fab28f Fix "waiting for of0 to become free" message on deldp.
Thanks to Murphy for help debugging this.
2008-06-05 13:38:09 -07:00
Ben Pfaff c8e4cbbd3a Treat flows without any wildcards as maximum priority.
Otherwise, we give the table implementations the opportunity to screw up
by distinguishing between two flows without wildcards but with apparently
different priorities that are required to be treated as the same priority.
2008-05-07 15:23:45 -07:00
Ben Pfaff 3ef905e11a Remove MAX_ACTIONS (which was 16) as a limit on the number of actions in a flow table entry.
Now the number of actions is limited, as a practical matter, to the size
of the buffer that the kernel provides for Netlink dumps, which is usually
4096 bytes.  A flow statistics entry must fit in a single one of these
buffers.  Actions are 8 bytes each, so this is about 500 actions
considering overhead.
2008-05-02 11:37:04 -07:00
Ben Pfaff 3b9c97ee01 Implement new statistics format in kernel and userspace switches.
This change really cuts the muster!
2008-05-01 17:04:44 -07:00
Justin Pettit d1d2f3f321 - On flow entries with wildcards, match priority field when doing a "strict" delete.
- Remove group_id from flow entries.
- Show priority when print flow mod messages.
2008-04-29 15:00:28 -07:00
Ben Pfaff db74f01873 Make dumping large numbers of flows possible.
This changes the kernel switch implementation to use the kernel Netlink
"dump" interface to allow flow stats that don't fit in the socket buffer
to be dumped gradually as the caller drains the socket buffer.

One of the changes here is a bug fix for nla_unreserve.  Because Netlink
attributes' lengths are rounded up to a multiple of 4 bytes, reducing
the length of the payload by N bytes doesn't necessarily reduce the
length of the skb by N bytes.  Instead, we need to know the original
length and final length of the attribute.  This means that using 'len'
as a difference in bytes doesn't really make sense, so this changes
'len' to be the new length of the attribute payload and renames the
function to nla_shrink to (IMO) better reflect what it is now doing.

Since we have to release the RCU read lock between calls to the dump
function, we need table iterators that persist across RCU epochs.  One
way to do this would be to add new "iterator_save" and "iterator_restore"
functions, but this seemed like overkill since there would then be a
total of 5 iterator functions that have only one user (flow stats dumping).
Instead, this patch refactors table iteration into a single "iterate"
function that takes a callback.  This simplifies the table iteration code
significantly.

This change also modifies dpctl to understand the new format of flow
stats.
2008-04-29 10:12:46 -07:00
Justin Pettit bfe3b4df89 - Add support for flow entry priorities.
- Fix "flow-add" action for dpctl.
2008-04-26 14:08:41 -07:00
Justin Pettit 0d3a0643c4 Switch from "stat" to "stats" everywhere. 2008-04-16 15:38:25 -07:00
Justin Pettit 541d0fee0d - Keep datapath config in host-byte order (and fix a couple of bugs related to this).
- Fix type for "get config" replies.
2008-04-16 14:09:27 -07:00
Natasha Gude 8623e6c16e Updated version references to OFP_VERSION 2008-04-16 11:30:55 -07:00
Ben Pfaff 6f8d45bf7d Merge remote branch 'repo/master' into stats
Conflicts:

	datapath/table-mac.c
2008-04-15 09:57:38 -07:00
Ben Pfaff b9cdc64135 Add missing calls to htons/ntohs in accesses to miss_send_len.
Thanks to Justin for pointing out the problem.
2008-04-15 09:56:36 -07:00
Justin Pettit e28564c5fa Add support for OFPP_TABLE virtual port. 2008-04-11 17:40:05 -07:00
Ben Pfaff f6cae73ec3 Implement OpenFlow statistics in switches and in dpctl.
This has two notable omissions.  First, only at most 4k of flow statistics
are reported.  Second, aggregate statistics are not yet supported.  Both
of these are fairly easily fixable, just not fixed yet.
2008-04-04 16:22:40 -07:00
Ben Pfaff 4fc7e7d11f Send replies to OpenFlow requests only to the sender. 2008-04-04 16:22:23 -07:00
Ben Pfaff 60a87c9b00 Break data_hello and control_hello messages into multiple messages.
We want to allow multiple OpenFlow connections to a switch, so that
dpctl and other management tools can also connect to a switch that
is connecte to the controller.  These tools will want to fetch the
information in the data_hello message, but currently this can only
be done by sending a control_hello message, which changes the
switch configuration state.  So breaking the hello messages up into
multiple different messages, only some of which affect configuration
state, cures the problem.

Also, clean up the kernel datapath a bit, by adding helper functions
for allocating and resizing Generic Netlink messages that encapsulate
OpenFlow messages.
2008-04-04 16:22:21 -07:00
Justin Pettit 1558120be7 - Fixed endian issue with action type. Thanks, Ben!
- Removed BUG() call that could be maliciously/accidentally triggered by a faulty controller.
- Switched from __constant_htons to htons, which seems preferred.
2008-03-30 01:41:42 -07:00
Justin Pettit de6e0a76a3 Update 2007 copyrights to include 2008. 2008-03-27 23:51:58 -07:00
Martin Casado 468e00132f Initial import 2008-03-04 13:12:53 -08:00