summaryrefslogtreecommitdiff
path: root/ofproto/fail-open.c
Commit message (Collapse)AuthorAgeFilesLines
* Move lib/ofp-actions.h to include/openvswitch directoryBen Warren2016-04-141-6/+6
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofp-util.h to include/openvswitch directoryBen Warren2016-04-141-1/+1
| | | | | | | | This commit also adds several #include directives in source files in order to make the 'ofp-util.h' move possible Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/ofpbuf.h to include/openvswitch directoryBen Warren2016-03-301-1/+1
| | | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Acked-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Implement serializing the state of packet traversal in "continuations".Ben Pfaff2016-02-191-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One purpose of OpenFlow packet-in messages is to allow a controller to interpose on the path of a packet through the flow tables. If, for example, the controller needs to modify a packet in some way that the switch doesn't directly support, the controller should be able to program the switch to send it the packet, then modify the packet and send it back to the switch to continue through the flow table. That's the theory. In practice, this doesn't work with any but the simplest flow tables. Packet-in messages simply don't include enough context to allow the flow table traversal to continue. For example: * Via "resubmit" actions, an Open vSwitch packet can have an effective "call stack", but a packet-in can't describe it, and so it would be lost. * A packet-in can't preserve the stack used by NXAST_PUSH and NXAST_POP actions. * A packet-in can't preserve the OpenFlow 1.1+ action set. * A packet-in can't preserve the state of Open vSwitch mirroring or connection tracking. This commit introduces a solution called "continuations". A continuation is the state of a packet's traversal through OpenFlow flow tables. A "controller" action with the "pause" flag, which is newly implemented in this commit, generates a continuation and sends it to the OpenFlow controller in a packet-in asynchronous message (only NXT_PACKET_IN2 supports continuations, so the controller must configure them with NXT_SET_PACKET_IN_FORMAT). The controller processes the packet-in, possibly modifying some of its data, and sends it back to the switch with an NXT_RESUME request, which causes flow table traversal to continue. In principle, a single packet can be paused and resumed multiple times. Another way to look at it is: - "pause" is an extension of the existing OFPAT_CONTROLLER action. It sends the packet to the controller, with full pipeline context (some of which is switch implementation dependent, and may thus vary from switch to switch). - A continuation is an extension of OFPT_PACKET_IN, allowing for implementation dependent metadata. - NXT_RESUME is an extension of OFPT_PACKET_OUT, with the semantics that the pipeline processing is continued with the original translation context from where it was left at the time it was paused. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-util: Rename struct ofputil_packet_in member 'len' to 'packet_len'.Ben Pfaff2016-02-191-1/+1
| | | | | | | | An upcoming commit will introduce another member that has a length, and it seems weird that bare 'len' would be one or the other. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* connmgr: Generalize ofproto_packet_in to ofproto_async_msg.Ben Pfaff2016-01-201-12/+16
| | | | | | | An upcoming commit will add another kind of asynchronous message that should be handled in the same way as packet-ins. Signed-off-by: Ben Pfaff <blp@ovn.org>
* openflow: Better abstract handling of packet-in messages.Ben Pfaff2016-01-201-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Packet-in messages have been a bit of a mess. First, their abstraction in the form of struct ofputil_packet_in has some fields that are used in a clear way for incoming and outgoing packet-ins, and others (packet_len, total_len, buffer_id) have have confusing meanings or usage pattern depending on their direction. Second, it's very confusing how a packet-in has both a reason (OFPR_*) and a miss type (OFPROTO_PACKET_IN_*) and how those add up to the actual reason that is used "on the wire" for each OpenFlow version (and even whether the packet-in is sent at all!). Finally, there's all kind of low-level detail randomly scattered between connmgr, ofproto-dpif-xlate, and ofp-util. This commit attempts to clear up some of the confusion. It simplifies the struct ofputil_packet_in abstraction by removing the members that didn't have a clear and consistent meaning between incoming and outgoing packet-ins. It gets rid of OFPROTO_PACKET_IN_*, instead adding a couple of nonstandard OFPR_* reasons that add up to what OFPROTO_PACKET_IN_* was meant to say (in what I hope is a clearer way). And it consolidates the tricky parts into ofp-util, where I hope it will be easier to understand all in one place. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
* ofp-actions: Make composing actions harder to screw up.Ben Pfaff2016-01-041-1/+0
| | | | | | | | | | | | | | Until now, composing a fixed-length action with ofpact_put_<NAME>() failed to append any padding required after the action. This commit changes that so that these calls now add padding. This meant that the function ofpact_pad(), which was until now required in various unintuitive places, is no longer required, and removes it. Variable-length actions still require calling ofpact_update_len() after composition. I don't see a way to avoid that. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* userspace: Define and use struct eth_addr.Jarno Rajahalme2015-08-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Define struct eth_addr and use it instead of a uint8_t array for all ethernet addresses in OVS userspace. The struct is always the right size, and it can be assigned without an explicit memcpy, which makes code more readable. "struct eth_addr" is a good type name for this as many utility functions are already named accordingly. struct eth_addr can be accessed as bytes as well as ovs_be16's, which makes the struct 16-bit aligned. All use seems to be 16-bit aligned, so some algorithms on the ethernet addresses can be made a bit more efficient making use of this fact. As the struct fits into a register (in 64-bit systems) we pass it by value when possible. This patch also changes the few uses of Linux specific ETH_ALEN to OVS's own ETH_ADDR_LEN, and removes the OFP_ETH_ALEN, as it is no longer needed. This work stemmed from a desire to make all struct flow members assignable for unrelated exploration purposes. However, I think this might be a nice code readability improvement by itself. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
* ofp-util: Convert flow_metadata to match structure.Jesse Gross2015-06-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | We have a special flow_metadata structure to represent the parts of a packet that aren't carried in the payload itself. This is used in the case where we need to send the packet as a Packet In to an OpenFlow controller. This is a subset of the more general struct flow. In practice, almost all operations we do on this structure involve converting it to or from a match or have code that is the same as a match. Serialization to NXM and back is done as a match. There is special flow_metadata formatting code that is almost identical to match formatting. The uses for struct flow_metadata aren't performance critical when it comes to memory, so we can save quite a bit of code by just using a match structure directly instead. In addition, as metadata increases and becomes more complex (Geneve options require some special handling beyond just additional fields), using the match structure means we only have to do this work in one place. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ofpbuf: Simplify ofpbuf API.Pravin B Shelar2015-03-031-1/+1
| | | | | | | | | | | | ofpbuf was complicated due to its wide usage across all layers of OVS, Now we have introduced independent dp_packet which can be used for datapath packet, we can simplify ofpbuf. Following patch removes DPDK mbuf and access API of ofpbuf members. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* dp-packet: Remove ofpbuf dependency.Pravin B Shelar2015-03-031-7/+8
| | | | | | | | | | | | | Currently dp-packet make use of ofpbuf for managing packet buffers. That complicates ofpbuf, by making dp-packet independent of ofpbuf both libraries can be optimized for their own use case. This avoids mapping operation between ofpbuf and dp_packet in datapath upcalls. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ofproto: Don't count hidden rules in table stats.Ben Pfaff2015-01-061-1/+12
| | | | | | | | | | | | The hidden rules created by in-band control and fail-open should not be included in the table stats reported via OpenFlow. I seem to recall that this was done correctly in some previous version but it has broken since then. This commit fixes the problem and adds a test that should make it harder to break again in the future. Reported-by: Ashok Chippa <a.n.chippa@gmail.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* lib: Move vconn.h to <openvswitch/vconn.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | Also moves definitions for struct vconn and pvconn to the public header. The provider interface is kept private. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: Move vlog.h to <openvswitch/vlog.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | A new function vlog_insert_module() is introduced to avoid using list_insert() from the vlog.h header. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ofpbuf: Introduce access api for base, data and size.Pravin Shelar2014-03-301-4/+4
| | | | | | | These functions will be used by later patches. Following patch does not change functionality. Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* ofproto-dpif: Differentiate between different miss types in packet inSimon Horman2014-03-201-1/+1
| | | | | | | | | | | | | | | | | | | Replace the generated_by_table_miss field of struct ofproto_packet_in with a miss_type field. The generated_by_table_miss field allowed packet-in messages generated by table-miss rules to be differentiated. This differentiation is still provided for by miss_type being set to OFPROTO_PACKET_IN_MISS_FLOW. This patch allows further differentiation by setting miss_type to OFPROTO_PACKET_IN_MISS_WITHOUT_FLOW if the packet-in message is generated by a table-miss which is not handled by a table-miss rule. This is in preparation for OpenFlow 1.3 version-specific handling of the default action for such misses. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofproto: Add more thread safety annotations.Ben Pfaff2014-01-101-0/+3
| | | | | | | These would have found the problem fixed in commit c7be3f559349 (connmgr: Fix attempt to take mutex recursively when exiting fail-open.). Signed-off-by: Ben Pfaff <blp@nicira.com>
* connmgr: Fix packet-in reason for OpenFlow1.3 table-miss flow entries.YAMAMOTO Takashi2013-10-231-0/+1
| | | | | | | | As per spec, make packet-in reason for OpenFlow1.3 table-miss flow entries no_match rather than action. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* connmgr: Move send_len from ofputil_packet_in to ofproto_packet_in.Ben Pfaff2013-10-221-1/+1
| | | | | | | | | send_len is not directly part of the OpenFlow packet_in message, at least given that it is partially redundant with packet_len. send_len is, rather, a request to the connmgr that expresses how many bytes the action requested be sent to the controller, but the connmgr cannot always honor it. Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofproto, ofp-util: Begin disentangling packet-in wire format and handling.Ben Pfaff2013-10-221-6/+6
| | | | | | | | | | | | | | struct ofputil_packet_in mixes data included in OpenFlow packet_in messages with data that used internally by ofproto and connmgr to queue and route packet_ins. This commit begins disentangling these purposes by adding a new struct ofproto_packet_in that wraps struct ofputil_packet_in. Adding this new level of indirection causes a lot of code churn, so this commit mainly takes care of that to make the remaining changes easier to read. This commit does move the list node used for queuing packet_ins into the new wrapper structure. Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofproto: Add global locking around flow table changes.Ben Pfaff2013-09-121-1/+2
| | | | | | | | | | | This makes 'ofproto_mutex' protect the flow table well enough that threads other than the main one can realistically modify flows. I need to look at the interface between ofproto and connmgr: I think that there might need to be some locking there too. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* classifier: Break cls_rule 'flow' and 'wc' members into new "struct match".Ben Pfaff2012-09-041-6/+7
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* Introduce ofpacts, an abstraction of OpenFlow actions.Ben Pfaff2012-07-031-6/+8
| | | | | | | | | | | | | | | | | | | | | | OpenFlow actions have always been somewhat awkward to handle. Moreover, over time we've started creating actions that require more complicated parsing. When we maintain those actions internally in their wire format, we end up parsing them multiple times, whenever we have to look at the set of actions. When we add support for OpenFlow 1.1 or later protocols, the situation will get worse, because these newer protocols support many of the same actions but with different representations. It becomes unrealistic to handle each protocol in its wire format. This commit adopts a new strategy, by converting OpenFlow actions into an internal form from the wire format when they are read, and converting them back to the wire format when flows are dumped. I believe that this will be more maintainable over time. Thanks to Simon Horman and Pravin Shelar for reviews. Signed-off-by: Ben Pfaff <blp@nicira.com>
* packets: Rename compose_benign_packet().Ethan Jackson2012-06-071-1/+1
| | | | | | | The name compose_rarp() more clearly describes what it's doing now. Requested-by: Justin Pettit <jpettit@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>
* packets: Use RARPs for learning packets.Ethan Jackson2012-06-071-1/+1
| | | | | | | | | | | | Traditionally Open vSwitch had used 802.2 SNAP packets to update upstream switch learning tables when necessary. This approach had advantages in that debugging information could be embedded in the packet helping hapless admins figure out what's going on. However, since both qemu and VMware use RARP for this purpose, it seems appropriate to fall in line with the defacto standard. Requested-by: Ben Basler <bbasler@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>
* Global replace of Nicira Networks.Raju Subramanian2012-05-021-1/+1
| | | | | | | | Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* fail-open: Use connmgr_send_packet_in() instead of connmgr_broadcast().Ben Pfaff2012-03-151-6/+10
| | | | | | | | | | Otherwise even controllers that should not receive any packet-ins (via enable-async-messages=false) still receive the packet-ins that probe for a controller being up when we're in fail-open. Bug #9964. Reported-by: James Schmidt <jschmidt@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* openflow: Split OFPAT_* into OFPAT10_* and OFPAT11_*.Ben Pfaff2012-03-071-2/+2
| | | | | | | | | | | An upcoming commit will start referring to OpenFlow 1.1 actions, which are renumbered relative to OpenFlow 1.0 actions, so this commit prepares by changing all the existing uses of OFPAT_* to instead use OFPAT10_*. This commit also introduces the OFPAT11_* constants. Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofproto: Rename "private.h" to "ofproto->provider.h".Justin Pettit2011-07-011-1/+1
| | | | | To be more consistent with other providers, rename "private.h" to "ofproto-provider.h".
* ofproto: Move private definitions to separate header.Ben Pfaff2011-05-041-0/+1
|
* ofproto: Factor OpenFlow connection management into new "connmgr".Ben Pfaff2011-03-291-115/+24
| | | | | This removes a lot of code from ofproto.c and makes the ofproto code easier to understand.
* ofproto: Get rid of archaic "switch status" OpenFlow extension.Ben Pfaff2011-03-161-22/+3
| | | | | | | | | 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.
* ofproto: Disable timeouts for flows added by ofproto_add_flow().Ben Pfaff2010-11-111-1/+1
| | | | | | | | | None of the existing callers of ofproto_add_flow() want an idle timeout, but ofproto_add_flow() was giving them a 5-second timeout anyway. I don't know how this worked properly--in-band will patiently add the flow back every few seconds anyway, but the bridge doesn't do that. Also add an explanatory comment to ofproto_add_flow().
* ofproto: Change ofproto_add_flow(), ofproto_delete_flow() to take cls_rule.Ben Pfaff2010-11-081-7/+8
| | | | This is a small cleanup that will make later changes to wildcards easier.
* vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.Ben Pfaff2010-10-291-1/+1
| | | | | It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon, so this commit switches to the more common form.
* flow: Get rid of flow_t typedef.Ben Pfaff2010-10-111-2/+2
| | | | | | | | | | 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>
* vlog: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.Ben Pfaff2010-07-211-2/+2
| | | | | | | Adding a macro to define the vlog module in use adds a level of indirection, which makes it easier to change how the vlog module must be defined. A followup commit needs to do that, so getting these widespread changes out of the way first should make that commit easier to review.
* vconn: Move OpenFlow utility functions into new file ofp-util.c.Ben Pfaff2010-06-171-0/+1
| | | | | | | | The main purpose of the vconn code is to ship OpenFlow messages across network connections. Over time a large number of utility functions related to OpenFlow messages have also crept into vconn.c, but that's really logically separate. This commit breaks those functions out into a new file.
* poll-loop: New function poll_timer_wait_until().Ben Pfaff2010-05-261-1/+1
| | | | | Many of poll_timer_wait()'s callers actually want to wait until a specific time, so it's convenient for them to offer a function that does this.
* Add support for multiple OpenFlow controllers on a single bridge.Ben Pfaff2010-04-201-28/+134
| | | | | | | | | | | | | | | | | With this commit, Open vSwitch permits a bridge to have any number of OpenFlow controllers. When multiple controllers are configured, Open vSwitch connects to all of them simultaneously. Details of configuration are in the vswitch schema documentation. OpenFlow 1.0 does not specify how multiple controllers coordinate in interacting with a single switch, so more than one controller should be specified only if the controllers are themselves designed to coordinate with each other. An upcoming commit will provide a simple means for coordination between multiple controllers. Feature #2495.
* fail-open: Fix typo in comment.Ben Pfaff2010-04-201-2/+2
|
* tunneling: Add support for tunnel ID.Jesse Gross2010-04-191-2/+2
| | | | | | | | | | | | | | 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.
* ofproto: Delete fail-open flow when turning off fail-open mode.Ben Pfaff2010-02-231-2/+13
| | | | | | | | fail_open_destroy() was not deleting the fail-open flow, so turning off fail-open mode did not work if fail-open had already been triggered. This commit fixes the problem. Reported by Paul Ingram <paul@nicira.com>.
* vswitch: Consistently set Nicira OUI.Jesse Gross2010-02-081-1/+1
| | | | | | In places where a random Ethernet address needs to be generated we are inconsistent about setting an OUI. This sets an OUI everywhere to allow the source of packets to be easily identified.
* Merge citrix branch into master.Ben Pfaff2009-09-221-20/+122
|
* Merge citrix into master.Ben Pfaff2009-08-191-2/+3
| | | | | | | | | | | | This was a somewhat difficult merge since there was a fair amount of superficially divergent development on the two branches, especially in the datapath. This has been build-tested against XenServer 5.5.0 and XenServer 5.7.0 build 15122. It has been booted and connected to XenCenter on 5.5.0. The merge revealed a couple of outstanding bugs, which will be fixed on citrix and then merged back into master.
* Rename "secchan" to "ofproto" (library) and "ovs-openflowd" (program).Ben Pfaff2009-07-081-0/+140
These names are more meaningful, so we prefer them.