.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "OVS-ACTIONS" "7" "Feb 05, 2024" "3.3" "Open vSwitch" .SH NAME ovs-actions \- OpenFlow actions and instructions with Open vSwitch extensions .SH INTRODUCTION .sp This document aims to comprehensively document all of the OpenFlow actions and instructions, both standard and non\-standard, supported by Open vSwitch, regardless of origin. The document includes information of interest to Open vSwitch users, such as the semantics of each supported action and the syntax used by Open vSwitch tools, and to developers seeking to build controllers and switches compatible with Open vSwitch, such as the wire format for each supported message. .SS Actions .sp In this document, we define an \fBaction\fP as an OpenFlow action, which is a kind of command that specifies what to do with a packet. Actions are used in OpenFlow flows to describe what to do when the flow matches a packet, and in a few other places in OpenFlow. Each version of the OpenFlow specification defines standard actions, and beyond that many OpenFlow switches, including Open vSwitch, implement extensions to the standard. .sp OpenFlow groups actions in two ways: as an \fBaction list\fP or an \fBaction set\fP, described below. .SS Action Lists .sp An \fBaction list\fP, a concept present in every version of OpenFlow, is simply an ordered sequence of actions. The OpenFlow specifications require a switch to execute actions within an action list in the order specified, and to refuse to execute an action list entirely if it cannot implement the actions in that order [OpenFlow 1.0, section 3.3], with one exception: when an action list outputs multiple packets, the switch may output the packets in an order different from that specified. Usually, this exception is not important, especially in the common case when the packets are output to different ports. .SS Action Sets .sp OpenFlow 1.1 introduced the concept of an \fBaction set\fP\&. An action set is also a sequence of actions, but the switch reorders the actions and drops duplicates according to rules specified in the OpenFlow specifications. Because of these semantics, some standard OpenFlow actions cannot usefully be included in an action set. For some, but not all, Open vSwitch extension actions, Open vSwitch defines its own action set semantics and ordering. .sp The OpenFlow pipeline has an action set associated with it as a packet is processed. After pipeline processing is otherwise complete, the switch executes the actions in the action set. .sp Open vSwitch applies actions in an action set in the following order: Except as noted otherwise below, the action set only executes at most a single action of each type, and when more than one action of a given type is present, the one added to the set later replaces the earlier action: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP 1. 4 \fBstrip_vlan\fP .IP 2. 4 \fBpop_mpls\fP .IP 3. 4 \fBdecap\fP .IP 4. 4 \fBencap\fP .IP 5. 4 \fBpush_mpls\fP .IP 6. 4 \fBpush_vlan\fP .IP 7. 4 \fBdec_ttl\fP .IP 8. 4 \fBdec_mpls_ttl\fP .IP 9. 4 \fBdec_nsh_ttl\fP .IP 10. 4 All of the following actions are executed in the order added to the action set, with cumulative effect. That is, when multiple actions modify the same part of a field, the later modification takes effect, and when they modify different parts of a field (or different fields), then both modifications are applied: .INDENT 4.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 \fBload\fP .IP \(bu 2 \fBmove\fP .IP \(bu 2 \fBmod_dl_dst\fP .IP \(bu 2 \fBmod_dl_src\fP .IP \(bu 2 \fBmod_nw_dst\fP .IP \(bu 2 \fBmod_nw_src\fP .IP \(bu 2 \fBmod_nw_tos\fP .IP \(bu 2 \fBmod_nw_ecn\fP .IP \(bu 2 \fBmod_nw_ttl\fP .IP \(bu 2 \fBmod_tp_dst\fP .IP \(bu 2 \fBmod_tp_src\fP .IP \(bu 2 \fBmod_vlan_pcp\fP .IP \(bu 2 \fBmod_vlan_vid\fP .IP \(bu 2 \fBset_field\fP .IP \(bu 2 \fBset_tunnel\fP .IP \(bu 2 \fBset_tunnel64\fP .UNINDENT .UNINDENT .UNINDENT .IP 11. 4 \fBset_queue\fP .IP 12. 4 \fBgroup\fP, \fBoutput\fP, \fBresubmit\fP, \fBct_clear\fP, or \fBct\fP\&. If more than one of these actions is present, then the one listed earliest above is executed and the others are ignored, regardless of the order in which they were added to the action set. (If none of these actions is present, the action set has no real effect, because the modified packet is not sent anywhere and thus the modifications are not visible.) .UNINDENT .UNINDENT .UNINDENT .sp An action set may only contain the actions listed above. .SS Error Handling .sp Packet processing can encounter a variety of errors: .INDENT 0.0 .TP .B Bridge not found Open vSwitch supports an extension to the standard OpenFlow \fBcontroller\fP action called a \fBcontinuation\fP, which allows the controller to interrupt and later resume the processing of a packet through the switch pipeline. This error occurs when such a packet’s processing cannot be resumed, e.g. because the bridge processing it has been destroyed. Open vSwitch reports this error to the controller as Open vSwitch extension error \fBNXR_STALE\fP\&. .sp This error prevents packet processing entirely. .TP .B Recursion too deep While processing a given packet, Open vSwitch limits the flow table recursion depth to 64, to ensure that packet processing uses a finite amount of time and space. Actions that count against the recursion limit include \fBresubmit\fP from a given OpenFlow table to the same or an earlier table, \fBgroup\fP, and \fBoutput\fP to patch ports. .sp A \fBresubmit\fP from one table to a later one (or, equivalently, a \fBgoto_table\fP instruction) does not count against the depth limit because resubmits to strictly monotonically increasing tables will eventually terminate. OpenFlow tables are most commonly traversed in numerically increasing order, so this limit has little effect on conventionally designed OpenFlow pipelines. .sp This error terminates packet processing. Any previous side effects (e.g. output actions) are retained. .sp Usually this error indicates a loop or other bug in the OpenFlow flow tables. To assist debugging, when this error occurs, Open vSwitch 2.10 and later logs a trace of the packet execution, as if by \fBovs\-appctl ofproto/trace\fP, rate\-limited to one per minute to reduce the log volume. .TP .B Too many resubmits Open vSwitch limits the total number of \fBresubmit\fP actions that a given packet can execute to 4,096. For this purpose, \fBgoto_table\fP instructions and output to the \fBtable\fP port are treated like \fBresubmit\fP\&. This limits the amount of time to process a single packet. .sp Unlike the limit on recursion depth, the limit on resubmits counts all resubmits, regardless of direction. .sp This error has the same effect, including logging, as exceeding the recursion depth limit. .TP .B Stack too deep Open vSwitch limits the amount of data that the \fBpush\fP action can put onto the stack at one time to 64 kB of data. .sp This error terminates packet processing. Any previous side effects (e.g. output actions) are retained. .TP .B No recirculation context / Recirculation conflict These errors indicate internal errors inside Open vSwitch and should generally not occur. If you notice recurring log messages about these errors, please report a bug. .TP .B Too many MPLS labels Open vSwitch can process packets with any number of MPLS labels, but its ability to push and pop MPLS labels is limited, currently to 3 labels. Attempting to push more than the supported number of labels onto a packet, or to pop any number of labels from a packet with more than the supported number, raises this error. .sp This error terminates packet processing, retaining any previous side effects (e.g. output actions). When this error arises within the execution of a group bucket, it only terminates that bucket’s execution, not packet processing overall. .TP .B Invalid tunnel metadata Open vSwitch raises this error when it processes a Geneve packet that has TLV options with an invalid form, e.g. where the length in a TLV would extend past the end of the options. .sp This error prevents packet processing entirely. .TP .B Unsupported packet type When a \fBencap\fP action encapsulates a packet, Open vSwitch raises this error if it does not support the combination of the new encapsulation with the current packet. \fBencap(ethernet)\fP raises this error if the current packet is not an L3 packet, and \fBencap(nsh)\fP raises this error if the current packet is not Ethernet, IPv4, IPv6, or NSH. .sp The \fBdecap\fP action is supported only for packet types ethernet, NSH and MPLS. Openvswitch raises this error for other packet types. When a \fBdecap\fP action decapsulates a packet, Open vSwitch raises this error if it does not support the type of inner packet. \fBdecap\fP of an Ethernet header raises this error if a VLAN header is present, \fBdecap\fP of a NSH packet raises this error if the NSH inner packet is not Ethernet, IPv4, IPv6, or NSH. .sp This error terminates packet processing, retaining any previous side effects (e.g. output actions). When this error arises within the execution of a group bucket, it only terminates that bucket’s execution, not packet processing overall. .UNINDENT .SS Inconsistencies .sp OpenFlow 1.0 allows any action to be part of any flow, regardless of the flow’s match. Some combinations do not make sense, e.g. an \fBset_nw_tos\fP action in a flow that matches only ARP packets or \fBstrip_vlan\fP in a flow that matches packets without VLAN tags. Other combinations have varying results depending on the kind of packet that the flow processes, e.g. a \fBset_nw_src\fP action in a flow that does not match on Ethertype will be treated as a no\-op when it processes a non\-IPv4 packet. Nevertheless OVS allows all of the above in conformance with OpenFlow 1.0, that is, the following will succeed: .INDENT 0.0 .INDENT 3.5 .sp .EX $ ovs\-ofctl \-O OpenFlow10 add\-flow br0 arp,actions=mod_nw_tos:12 $ ovs\-ofctl \-O OpenFlow10 add\-flow br0 dl_vlan=0xffff,actions=strip_vlan $ ovs\-ofctl \-O OpenFlow10 add\-flow br0 actions=mod_nw_src:1.2.3.4 .EE .UNINDENT .UNINDENT .sp Open vSwitch calls these kinds of combinations \fBinconsistencies\fP between match and actions. OpenFlow 1.1 and later forbid inconsistencies, and disallow the examples described above by preventing such flows from being added. All of the above, for example, will fail with an error message if one replaces \fBOpenFlow10\fP by \fBOpenFlow11\fP\&. .sp OpenFlow 1.1 and later cannot detect and disallow all inconsistencies. For example, the \fBwrite_actions\fP instruction arbitrarily delays execution of the actions inside it, which can even be canceled with \fBclear_actions\fP, so that there is no way to ensure that its actions are consistent with the packet at the time they execute. Thus, actions with \fBwrite_actions\fP and some other contexts are exempt from consistency requirements. .sp When OVS executes an action inconsistent with the packet, it treats it as a no\-op. .SS Inter\-Version Compatibility .sp Open vSwitch supports multiple OpenFlow versions simultaneously on a single switch. When actions are added with one OpenFlow version and then retrieved with another, Open vSwitch does its best to translate between them. .sp Inter\-version compatibility issues can still arise when different connections use different OpenFlow versions. Backward compatibility is the most obvious case. Suppose, for example, that an OpenFlow 1.1 session adds a flow with a \fBpush_vlan\fP action, for which there is no equivalent in OpenFlow 1.0. If an OpenFlow 1.0 session retrieves this flow, Open vSwitch must somehow represent the action. .sp Forward compatibility can also be an issue, because later OpenFlow versions sometimes remove functionality. The best example is the \fBenqueue\fP action from OpenFlow 1.0, which OpenFlow 1.1 removed. .sp In practice, Open vSwitch uses a variety of strategies for inter\-version compatibility: .INDENT 0.0 .IP \(bu 2 Most standard OpenFlow actions, such as \fBoutput\fP actions, translate without compatibility issues. .IP \(bu 2 Open vSwitch supports its extension actions in every OpenFlow version, so they do not pose inter\-version compatibility problems. .IP \(bu 2 Open vSwitch sometimes adds extension actions to ensure backward or forward compatibility. For example, for backward compatibility with the \fBgroup\fP action added in OpenFlow 1.1, Open vSwitch includes an OpenFlow 1.0 extension \fBgroup\fP action. .UNINDENT .sp Perfect inter\-version compatibility is not possible, so best results require OpenFlow connections to use a consistent version. One may enforce use of a particular version by setting the \fBprotocols\fP column for a bridge, e.g. to force \fBbr0\fP to use only OpenFlow 1.3: .INDENT 0.0 .INDENT 3.5 .sp .EX ovs\-vsctl set bridge br0 protocols=OpenFlow13 .EE .UNINDENT .UNINDENT .SS Field Specifications .sp Many Open vSwitch actions refer to fields. In such cases, fields may usually be referred to by their common names, such as \fBeth_dst\fP for the Ethernet destination field, or by their full OXM or NXM names, such as \fBNXM_OF_ETH_DST\fP or \fBOXM_OF_ETH_DST\fP\&. Before Open vSwitch 2.7, only OXM or NXM field names were accepted. .sp Many actions that act on fields can also act on \fBsubfields\fP, that is, parts of fields, written as \fBfield[start..end]\fP, where \fBstart\fP is the first bit and \fBend\fP is the last bit to use in \fBfield\fP, e.g. \fBvlan_tci[13..15]\fP for the VLAN PCP. A single\-bit subfield may also be written as \fBfield[offset]\fP, e.g. \fBvlan_tci[13]\fP for the least\-significant bit of the VLAN PCP. Empty brackets may be used to explicitly designate an entire field, e.g. \fBvlan_tci[]\fP for the entire 16\-bit VLAN TCI header. Before Open vSwitch 2.7, brackets were required in field specifications. .sp See \fBovs\-fields(7)\fP for a list of fields and their names. .SS Port Specifications .sp Many Open vSwitch actions refer to OpenFlow ports. In such cases, the port may be specified as a numeric port number in the range 0 to 65,535, although Open vSwitch only assigns port numbers in the range 1 through 62,279 to ports. OpenFlow 1.1 and later use 32\-bit port numbers, but Open vSwitch never assigns a port number that requires more than 16 bits. .sp In most contexts, the name of a port may also be used. (The most obvious context where a port name may not be used is in an \fBovs\-ofctl\fP command along with the \fB\-\-no\-names\fP option.) When a port’s name contains punctuation or could be ambiguous with other actions, the name may be enclosed in double quotes, with JSON\-like string escapes supported (see [RFC 8259]). .sp Open vSwitch also supports the following standard OpenFlow port names (even in contexts where port names are not otherwise supported). The corresponding OpenFlow 1.0 and 1.1+ port numbers are listed alongside them but should not be used in flow syntax: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 \fBin_port\fP (65528 or 0xfff8; 0xfffffff8) .IP \(bu 2 \fBtable\fP (65529 or 0xfff9; 0xfffffff9) .IP \(bu 2 \fBnormal\fP (65530 or 0xfffa; 0xfffffffa) .IP \(bu 2 \fBflood\fP (65531 or 0xfffb; 0xfffffffb) .IP \(bu 2 \fBall\fP (65532 or 0xfffc; 0xfffffffc) .IP \(bu 2 \fBcontroller\fP (65533 or 0xfffd; 0xfffffffd) .IP \(bu 2 \fBlocal\fP (65534 or 0xfffe; 0xfffffffe) .IP \(bu 2 \fBany\fP or \fBnone\fP (65535 or 0xffff; 0xffffffff) .IP \(bu 2 \fBunset\fP (not in OpenFlow 1.0; 0xfffffff7) .UNINDENT .UNINDENT .UNINDENT .SH OUTPUT ACTIONS .sp These actions send a packet to a physical port or a controller. A packet that never encounters an output action on its trip through the Open vSwitch pipeline is effectively dropped. Because actions are executed in order, a packet modification action that is not eventually followed by an output action will not have an externally visible effect. .SS The \fBoutput\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fIport\fP \fBoutput:\fP\fIport\fP \fBoutput:\fP\fIfield\fP \fBoutput(port=\fP\fIport\fP\fB, max_len=\fP\fInbytes\fP\fB)\fP .fi .sp .UNINDENT .sp Outputs the packet to an OpenFlow port most commonly specified as \fIport\fP\&. Alternatively, the output port may be read from \fIfield\fP, a field or subfield in the syntax described under \fI\%Field Specifications\fP above. Either way, if the port is the packet’s input port, the packet is not output. .sp The \fIport\fP may be one of the following standard OpenFlow ports: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBlocal\fP Outputs the packet on the \fBlocal port\fP that corresponds to the network device that has the same name as the bridge, unless the packet was received on the local port. OpenFlow switch implementations are not required to have a local port, but Open vSwitch bridges always do. .TP .B \fBin_port\fP Outputs the packet on the port on which it was received. This is the only standard way to output the packet to the input port (but see \fI\%Output to the Input port\fP, below). .UNINDENT .UNINDENT .UNINDENT .sp The \fIport\fP may also be one of the following additional OpenFlow ports, unless \fBmax_len\fP is specified: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBnormal\fP Subjects the packet to the device’s normal L2/L3 processing. This action is not implemented by all OpenFlow switches, and each switch implements it differently. The section \fI\%The OVS Normal Pipeline\fP below documents the OVS implementation. .TP .B \fBflood\fP Outputs the packet on all switch physical ports, except the port on which it was received and any ports on which flooding is disabled. Flooding can be disabled automatically on a port by Open vSwitch when IEEE 802.1D spanning tree (STP) or rapid spanning tree (RSTP) is enabled, or by a controller using an OpenFlow \fBOFPT_MOD_PORT\fP request to set the port’s \fBOFPPC_NO_FLOOD\fP flag (\fBovs\-ofctl mod\-port\fP provides a command\-line interface to set this flag). .TP .B \fBall\fP Outputs the packet on all switch physical ports except the port on which it was received. .TP .B \fBcontroller\fP Sends the packet and its metadata to an OpenFlow controller or controllers encapsulated in an OpenFlow \fBpacket\-in\fP message. The separate \fBcontroller\fP action, described below, provides more options for output to a controller. .UNINDENT .UNINDENT .UNINDENT .sp Open vSwitch rejects output to other standard OpenFlow ports, including \fBnone\fP, \fBunset\fP, and port numbers reserved for future use as standard ports, with the error \fBOFPBAC_BAD_OUT_PORT\fP\&. .sp With \fBmax_len\fP, the packet is truncated to at most \fInbytes\fP bytes before being output. In this case, the output port may not be a patch port. Truncation is just for the single output action, so that later actions in the OpenFlow pipeline work with the complete packet. The truncation feature is meant for use in monitoring applications, e.g. for mirroring packets to a collector. .sp When an \fBoutput\fP action specifies the number of a port that does not currently exist (and is not in the range for standard ports), the OpenFlow specification allows but does not require OVS to reject the action. All versions of Open vSwitch treat such an action as a no\-op. If a port with the number is created later, then the action will be honored at that point. (OpenFlow requires OVS to reject output to a port number that will never be valid, with \fBOFPBAC_BAD_OUT_PORT\fP, but this situation does not arise when OVS is a software switch, since the user can add or renumber ports at any time.) .sp A controller can suppress output to a port by setting its \fBOFPPC_NO_FORWARD\fP flag using an OpenFlow \fBOFPT_MOD_PORT\fP request (\fBovs\-ofctl mod\-port\fP provides a command\-line interface to set this flag). When output is disabled, \fBoutput\fP actions (and other actions that output to the port) are allowed but have no effect. .sp Open vSwitch allows output to a port that does not exist, although OpenFlow allows switches to reject such actions. .INDENT 0.0 .TP \fBConformance\fP All versions of OpenFlow and Open vSwitch support \fBoutput\fP to a literal \fBport\fP\&. Output to a register is an OpenFlow extension introduced in Open vSwitch 1.3. Output with truncation is an OpenFlow extension introduced in Open vSwitch 2.6. .UNINDENT .SS Output to the Input Port .sp OpenFlow requires a switch to ignore attempts to send a packet out its ingress port in the most straightforward way. For example, \fBoutput:234\fP has no effect if the packet has ingress port 234. The rationale is that dropping these packets makes it harder to loop the network. Sometimes this behavior can even be convenient, e.g. it is often the desired behavior in a flow that forwards a packet to several ports (\fBfloods\fP the packet). .sp Sometimes one really needs to send a packet out its ingress port (\fBhairpin\fP). In this case, use \fBin_port\fP to explicitly output the packet to its input port, e.g.: .INDENT 0.0 .INDENT 3.5 .sp .EX $ ovs\-ofctl add\-flow br0 in_port=2,actions=in_port .EE .UNINDENT .UNINDENT .sp This also works in some circumstances where the flow doesn’t match on the input port. For example, if you know that your switch has five ports numbered 2 through 6, then the following will send every received packet out every port, even its ingress port: .INDENT 0.0 .INDENT 3.5 .sp .EX $ ovs\-ofctl add\-flow br0 actions=2,3,4,5,6,in_port .EE .UNINDENT .UNINDENT .sp or, equivalently: .INDENT 0.0 .INDENT 3.5 .sp .EX $ ovs\-ofctl add\-flow br0 actions=all,in_port .EE .UNINDENT .UNINDENT .sp Sometimes, in complicated flow tables with multiple levels of \fBresubmit\fP actions, a flow needs to output to a particular port that may or may not be the ingress port. It’s difficult to take advantage of output to \fBin_port\fP in this situation. To help, Open vSwitch provides, as an OpenFlow extension, the ability to modify the \fBin_port\fP field. Whatever value is currently in the \fBin_port\fP field is both the port to which output will be dropped and the destination for \fBin_port\fP\&. This means that the following adds flows that reliably output to port 2 or to ports 2 through 6, respectively: .INDENT 0.0 .INDENT 3.5 .sp .EX $ ovs\-ofctl add\-flow br0 \(dqin_port=2,actions=load:0\->in_port,2\(dq $ ovs\-ofctl add\-flow br0 \(dqactions=load:0\->in_port,2,3,4,5,6\(dq .EE .UNINDENT .UNINDENT .sp If \fBin_port\fP is important for matching or other reasons, one may save and restore it on the stack: .INDENT 0.0 .INDENT 3.5 .sp .EX $ ovs\-ofctl add\-flow br0 \e actions=\(dqpush:in_port,load:0\->in_port,2,3,4,5,6,pop:in_port\(dq .EE .UNINDENT .UNINDENT .SS The OVS Normal Pipeline .sp This section documents how Open vSwitch implements output to the \fBnormal\fP port. The OpenFlow specification places no requirements on how this port works, so all of this documentation is specific to Open vSwitch. .sp Open vSwitch uses the \fBOpen_vSwitch\fP database, detailed in \fBovs\-vswitchd.conf.db(5)\fP, to determine the details of the normal pipeline. .sp The normal pipeline executes the following ingress stages for each packet. Each stage either accepts the packet, in which case the packet goes on to the next stage, or drops the packet, which terminates the pipeline. The result of the ingress stages is a set of output ports, which is the empty set if some ingress stage drops the packet: .INDENT 0.0 .IP 1. 4 \fBInput port lookup\fP: Looks up the OpenFlow \fBin_port\fP field’s value to the corresponding \fBPort\fP and \fBInterface\fP record in the database. .sp The \fBin_port\fP is normally the OpenFlow port that the packet was received on. If \fBset_field\fP or another actions changes the \fBin_port\fP, the updated value is honored. Accept the packet if the lookup succeeds, which it normally will. If the lookup fails, for example because \fBin_port\fP was changed to an unknown value, drop the packet. .IP 2. 4 \fBDrop malformed packet\fP: If the packet is malformed enough that it contains only part of an 802.1Q header, then drop the packet with an error. .IP 3. 4 \fBDrop packets sent to a port reserved for mirroring\fP: If the packet was received on a port that is configured as the output port for a mirror (that is, it is the \fBoutput_port\fP in some \fBMirror\fP record), then drop the packet. .IP 4. 4 \fBVLAN input processing\fP: This stage determines what VLAN the packet is in. It also verifies that this VLAN is valid for the port; if not, drop the packet. How the VLAN is determined and which ones are valid vary based on the \fBvlan\-mode\fP in the input port’s \fBPort\fP record: .INDENT 4.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBtrunk\fP The packet is in the VLAN specified in its 802.1Q header, or in VLAN 0 if there is no 802.1Q header. The \fBtrunks\fP column in the \fBPort\fP record lists the valid VLANs; if it is empty, all VLANs are valid. .TP .B \fBaccess\fP The packet is in the VLAN specified in the \fBtag\fP column of its \fBPort\fP record. The packet must not have an 802.1Q header with a nonzero VLAN ID; if it does, drop the packet. .TP .B \fBnative\-tagged\fP / \fBnative\-untagged\fP Same as \fBtrunk\fP except that the VLAN of a packet without an 802.1Q header is not necessarily zero; instead, it is taken from the \fBtag\fP column. .TP .B \fBdot1q\-tunnel\fP The packet is in the VLAN specified in the \fBtag\fP column of its \fBPort\fP record, which is a QinQ service VLAN with the Ethertype specified by the \fBPort\fP’s \fBother_config:qinq\-ethtype\fP\&. If the packet has an 802.1Q header, then it specifies the customer VLAN. The \fBcvlans\fP column specifies the valid customer VLANs; if it is empty, all customer VLANs are valid. .UNINDENT .UNINDENT .UNINDENT .IP 5. 4 \fBDrop reserved multicast addresses\fP: If the packet is addressed to a reserved Ethernet multicast address and the \fBBridge\fP record does not have \fBother_config:forward\-bpdu\fP set to \fBtrue\fP, drop the packet. .IP 6. 4 \fBLACP bond admissibility\fP: This step applies only if the input port is a member of a bond (a \fBPort\fP with more than one \fBInterface\fP) and that bond is configured to use LACP. Otherwise, skip to the next step. .sp The behavior here depends on the state of LACP negotiation: .INDENT 4.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 If LACP has been negotiated with the peer, accept the packet if the bond member is enabled (i.e. carrier is up and it hasn’t been administratively disabled). Otherwise, drop the packet. .IP \(bu 2 If LACP negotiation is incomplete, then drop the packet. There is one exception: if fallback to active\-backup mode is enabled, continue with the next step, pretending that the active\-backup balancing mode is in use. .UNINDENT .UNINDENT .UNINDENT .IP 7. 4 \fBNon\-LACP bond admissibility\fP: This step applies if the input port is a member of a bond without LACP configured, or if a LACP bond falls back to active\-backup as described in the previous step. If neither of these applies, skip to the next step. .sp If the packet is an Ethernet multicast or broadcast, and not received on the bond’s active member, drop the packet. .sp The remaining behavior depends on the bond’s balancing mode: .INDENT 4.0 .INDENT 3.5 .INDENT 0.0 .TP .B L4 (aka TCP balancing) Drop the packet (this balancing mode is only supported with LACP). .TP .B Active\-backup Accept the packet only if it was received on the active member. .TP .B SLB (Source Load Balancing) Drop the packet if the bridge has not learned the packet’s source address (in its VLAN) on the port that received it. Otherwise, accept the packet unless it is a gratuitous ARP. Otherwise, accept the packet if the MAC entry we found is ARP\-locked. Otherwise, drop the packet. (See the \fBSLB Bonding\fP section in the OVS bonding document for more information and a rationale.) .UNINDENT .UNINDENT .UNINDENT .IP 8. 4 \fBLearn source MAC\fP: If the source Ethernet address is not a multicast address, then insert a mapping from packet’s source Ethernet address and VLAN to the input port in the bridge’s MAC learning table. (This is skipped if the packet’s VLAN is listed in the switch’s \fBBridge\fP record in the \fBflood_vlans\fP column, since there is no use for MAC learning when all packets are flooded.) .sp When learning happens on a non\-bond port, if the packet is a gratuitous ARP, the entry is marked as ARP\-locked. The lock expires after 5 seconds. (See the \fBSLB Bonding\fP section in the OVS bonding document for more information and a rationale.) .IP 9. 4 \fBIP multicast path\fP: If multicast snooping is enabled on the bridge, and the packet is an Ethernet multicast but not an Ethernet broadcast, and the packet is an IP packet, then the packet takes a special processing path. This path is not yet documented here. .IP 10. 4 \fBOutput port set\fP: Search the MAC learning table for the port corresponding to the packet’s Ethernet destination and VLAN. If the search finds an entry, the output port set is just the learned port. Otherwise (including the case where the packet is an Ethernet multicast or in \fBflood_vlans\fP), the output port set is all of the ports in the bridge that belong to the packet’s VLAN, except for any ports that were disabled for flooding via OpenFlow or that are configured in a \fBMirror\fP record as a mirror destination port. .UNINDENT .sp The following egress stages execute once for each element in the set of output ports. They execute (conceptually) in parallel, so that a decision or action taken for a given output port has no effect on those for another one: .INDENT 0.0 .IP 1. 3 \fBDrop loopback\fP: If the output port is the same as the input port, drop the packet. .IP 2. 3 \fBVLAN output processing\fP: This stage adjusts the packet to represent the VLAN in the correct way for the output port. Its behavior varies based on the \fBvlan\-mode\fP in the output port’s \fBPort\fP record: .INDENT 3.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBtrunk\fP / \fBnative\-tagged\fP / \fBnative\-untagged\fP If the packet is in VLAN 0 (for \fBnative\-untagged\fP, if the packet is in the native VLAN) drops any 802.1Q header. Otherwise, ensures that there is an 802.1Q header designating the VLAN. .TP .B \fBaccess\fP Remove any 802.1Q header that was present. .TP .B \fBdot1q\-tunnel\fP Ensures that the packet has an outer 802.1Q header with the QinQ Ethertype and the specified configured tag, and an inner 802.1Q header with the packet’s VLAN. .UNINDENT .UNINDENT .UNINDENT .IP 3. 3 \fBVLAN priority tag processing\fP: If VLAN output processing discarded the 802.1Q headers, but priority tags are enabled with \fBother_config:priority\-tags\fP in the output port’s \fBPort\fP record, then a priority\-only tag is added (perhaps only if the priority would be nonzero, depending on the configuration). .IP 4. 3 \fBBond member choice\fP: If the output port is a bond, the code chooses a particular member. This step is skipped for non\-bonded ports. .sp If the bond is configured to use LACP, but LACP negotiation is incomplete, then normally the packet is dropped. The exception is that if fallback to active\-backup mode is enabled, the egress pipeline continues choosing a bond member as if active\-backup mode was in use. .sp For active\-backup mode, the output member is the active member. Other modes hash appropriate header fields and use the hash value to choose one of the enabled members. .IP 5. 3 \fBOutput\fP: The pipeline sends the packet to the output port. .UNINDENT .SS The \fBcontroller\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBcontroller\fP \fBcontroller:\fP\fImax_len\fP \fBcontroller(\fP\fIkey\fP\fB[=\fP\fIvalue\fP\fB], ...)\fP .fi .sp .UNINDENT .sp Sends the packet and its metadata to an OpenFlow controller or controllers encapsulated in an OpenFlow \fBpacket\-in\fP message. The supported options are: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBmax_len=\fP\fImax_len\fP Limit to \fImax_len\fP the number of bytes of the packet to send in the \fBpacket\-in.\fP A \fImax_len\fP of 0 prevents any of the packet from being sent (thus, only metadata is included). By default, the entire packet is sent, equivalent to a \fImax_len\fP of 65535. This option has no effect in Open vSwith 2.7 and later: the entire packet will always be sent. .TP .B \fBreason=\fP\fIreason\fP Specify \fIreason\fP as the reason for sending the message in the \fBpacket\-in\fP\&. The supported reasons are \fBno_match\fP, \fBaction\fP, \fBinvalid_ttl\fP, \fBaction_set\fP, \fBgroup\fP, and \fBpacket_out\fP\&. The default reason is \fBaction\fP\&. .TP .B \fBid=\fP\fIcontroller_id\fP Specify \fIcontroller_id\fP, a 16\-bit integer, as the connection ID of the OpenFlow controller or controllers to which the \fBpacket\-in\fP message should be sent. The default is zero. Zero is also the default connection ID for each controller connection, and a given controller connection will only have a nonzero connection ID if its controller uses the \fBNXT_SET_CONTROLLER_ID\fP Open vSwitch extension to OpenFlow. .TP .B \fBuserdata=\fP\fIhh\fP\fB\&...\fP Supplies the bytes represented as hex digits \fIhh\fP as additional data to the controller in the \fBpacket\-in\fP message. Pairs of hex digits may be separated by periods for readability. .TP .B \fBpause\fP Causes the switch to freeze the packet’s trip through Open vSwitch flow tables and serializes that state into the packet\-in message as a \fBcontinuation,\fP an additional property in the \fBNXT_PACKET_IN2\fP message. The controller can later send the continuation back to the switch in an \fBNXT_RESUME\fP message, which will restart the packet’s traversal from the point where it was interrupted. This permits an OpenFlow controller to interpose on a packet midway through processing in Open vSwitch. .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP \fBConformance\fP All versions of OpenFlow and Open vSwitch support \fBcontroller\fP action and its \fBmax_len\fP option. The \fBuserdata\fP and \fBpause\fP options require the Open vSwitch \fBNXAST_CONTROLLER2\fP extension action added in Open vSwitch 2.6. In the absence of these options, the \fBreason\fP (other than \fBreason=action\fP) and \fBcontroller_id\fP (option than \fBcontroller_id=0\fP) options require the Open vSwitch \fBNXAST_CONTROLLER\fP extension action added in Open vSwitch 1.6. .sp Open vSwitch 2.7 and later is configured to not buffer packets for the packet\-in event. As a result, the full packet is always sent to controllers. This means that the \fBmax_len\fP option has no effect on the \fBcontroller\fP action, and all values (even 0) are equivalent to the default value of 65535. .UNINDENT .SS The \fBenqueue\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBenqueue(\fP\fIport\fP\fB,\fP\fIqueue\fP\fB)\fP \fBenqueue:\fP\fIport\fP\fB:\fP\fIqueue\fP .fi .sp .UNINDENT .sp Enqueues the packet on the specified \fIqueue\fP within port \fIport\fP\&. .sp \fIport\fP must be an OpenFlow port number or name as described under \fI\%Port Specifications\fP above. \fIport\fP may be \fBin_port\fP or \fBlocal\fP but the other standard OpenFlow ports are not allowed. .sp \fIqueue\fP must be a number between 0 and 4294967294 (0xfffffffe), inclusive. The number of actually supported queues depends on the switch. Some OpenFlow implementations do not support queuing at all. In Open vSwitch, the supported queues vary depending on the operating system, datapath, and hardware in use. Use the \fBQoS\fP and \fBQueue\fP tables in the Open vSwitch database to configure queuing on individual OpenFlow ports (see \fBovs\-vswitchd.conf.db(5)\fP for more information). .INDENT 0.0 .TP \fBConformance\fP Only OpenFlow 1.0 supports \fBenqueue\fP\&. OpenFlow 1.1 added the \fBset_queue\fP action to use in its place along with \fBoutput\fP\&. .sp Open vSwitch translates \fBenqueue\fP to a sequence of three actions in OpenFlow 1.1 or later: \fBset_queue:\fP\fIqueue\fP\fB,output:\fP\fIport\fP\fB,pop_queue\fP\&. This is equivalent in behavior as long as the flow table does not otherwise use \fBset_queue\fP, but it relies on the \fBpop_queue\fP Open vSwitch extension action. .UNINDENT .SS The \fBbundle\fP and \fBbundle_load\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBbundle(\fP\fIfields\fP\fB,\fP\fIbasis\fP\fB,\fP\fIalgorithm\fP\fB,ofport,members:\fP\fIport\fP\fB\&...)\fP \fBbundle_load(\fP\fIfields\fP\fB,\fP\fIbasis\fP\fB,\fP\fIalgorithm\fP\fB,ofport,\fP\fIdst\fP\fB,members:\fP\fIport\fP\fB\&...)\fP .fi .sp .UNINDENT .sp These actions choose a port (a \fBmember\fP) from a comma\-separated OpenFlow \fIport\fP list. After selecting the port, \fBbundle\fP outputs to it, whereas \fBbundle_load\fP writes its port number to \fIdst\fP, which must be a 16\-bit or wider field or subfield in the syntax described under \fI\%Field Specifications\fP above. .sp These actions hash a set of \fIfields\fP using \fIbasis\fP as a universal hash parameter, then apply the bundle link selection \fIalgorithm\fP to choose a \fIport\fP\&. .sp \fIfields\fP must be one of the following. For the options with \fBsymmetric\fP in the name, reversing source and destination addresses yields the same hash: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBeth_src\fP Ethernet source address. .TP .B \fBnw_src\fP IPv4 or IPv6 source address. .TP .B \fBnw_dst\fP IPv4 or IPv6 destination address. .TP .B \fBsymmetric_l4\fP Ethernet source and destination, Ethernet type, VLAN ID or IDs (if any), IPv4 or IPv6 source and destination, IP protocol, TCP or SCTP (but not UDP) source and destination. .TP .B \fBsymmetric_l3l4\fP IPv4 or IPv6 source and destination, IP protocol, TCP or SCTP (but not UDP) source and destination. .TP .B \fBsymmetric_l3l4+udp\fP Like \fBsymmetric_l3l4\fP but include UDP ports. .UNINDENT .UNINDENT .UNINDENT .sp \fIalgorithm\fP must be one of the following: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBactive_backup\fP Chooses the first live port listed in \fBmembers\fP\&. .TP .B \fBhrw\fP (Highest Random Weight) Computes the following, considering only the live ports in \fBmembers\fP: .INDENT 7.0 .INDENT 3.5 .sp .EX for i in [1, n_members]: weights[i] = hash(flow, i) member = { i such that weights[i] >= weights[j] for all j != i } .EE .UNINDENT .UNINDENT .sp This algorithm is specified by RFC 2992. .UNINDENT .UNINDENT .UNINDENT .sp The algorithms take port liveness into account when selecting members. The definition of whether a port is live is subject to change. It currently takes into account carrier status and link monitoring protocols such as BFD and CFM. If none of the members is live, \fBbundle\fP does not output the packet and \fBbundle_load\fP stores \fBOFPP_NONE\fP (65535) in the output field. .sp Example: \fBbundle(eth_src,0,hrw,ofport,members:4,8)\fP uses an Ethernet source hash with basis 0, to select between OpenFlow ports 4 and 8 using the Highest Random Weight algorithm. .INDENT 0.0 .TP \fBConformance\fP Open vSwitch 1.2 introduced the \fBbundle\fP and \fBbundle_load\fP OpenFlow extension actions. .UNINDENT .SS The \fBgroup\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBgroup:\fP\fIgroup\fP .fi .sp .UNINDENT .sp Outputs the packet to the OpenFlow group \fIgroup\fP, which must be a number in the range 0 to 4294967040 (0xffffff00). The group must exist or Open vSwitch will refuse to add the flow. When a group is deleted, Open vSwitch also deletes all of the flows that output to it. .sp Groups contain action sets, whose semantics are described above in the section \fI\%Action Sets\fP\&. The semantics of action sets can be surprising to users who expect action list semantics, since action sets reorder and sometimes ignore actions. .sp A \fBgroup\fP action usually executes the action set or sets in one or more group buckets. Open vSwitch saves the packet and metadata before it executes each bucket, and then restores it afterward. Thus, when a group executes more than one bucket, this means that each bucket executes on the same packet and metadata. Moreover, regardless of the number of buckets executed, the packet and metadata are the same before and after executing the group. .sp Sometimes saving and restoring the packet and metadata can be undesirable. In these situations, workarounds are possible. For example, consider a pipeline design in which a \fBselect\fP group bucket is to communicate to a later stage of processing a value based on which bucket was selected. An obvious design would be for the bucket to communicate the value via \fBset_field\fP on a register. This does not work because registers are part of the metadata that \fBgroup\fP saves and restores. The following alternative bucket designs do work: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Recursively invoke the rest of the pipeline with \fBresubmit\fP\&. .IP \(bu 2 Use \fBresubmit\fP into a table that uses \fBpush\fP to put the value on the stack for the caller to \fBpop\fP off. This works because \fBgroup\fP preserves only packet data and metadata, not the stack. .sp (This design requires indirection through \fBresubmit\fP because actions sets may not contain \fBpush\fP or \fBpop\fP actions.) .UNINDENT .UNINDENT .UNINDENT .sp An \fBexit\fP action within a group bucket terminates only execution of that bucket, not other buckets or the overall pipeline. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.1 introduced \fBgroup\fP\&. Open vSwitch 2.6 and later also supports \fBgroup\fP as an extension to OpenFlow 1.0. .UNINDENT .SH ENCAPSULATION AND DECAPSULATION ACTIONS .SS The \fBstrip_vlan\fP and \fBpop\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBstrip_vlan\fP \fBpop_vlan\fP .fi .sp .UNINDENT .sp Removes the outermost VLAN tag, if any, from the packet. .sp The two names for this action are synonyms with no semantic difference. The OpenFlow 1.0 specification uses the name \fBstrip_vlan\fP and later versions use \fBpop_vlan\fP, but OVS accepts either name regardless of version. .sp In OpenFlow 1.1 and later, consistency rules allow \fBstrip_vlan\fP only in a flow that matches only packets with a VLAN tag (or following an action that pushes a VLAN tag, such as \fBpush_vlan\fP). See \fI\%Inconsistencies\fP, above, for more information. .INDENT 0.0 .TP \fBConformance\fP All versions of OpenFlow and Open vSwitch support this action. .UNINDENT .SS The \fBpush_vlan\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBpush_vlan:\fP\fIethertype\fP .fi .sp .UNINDENT .sp Pushes a new outermost VLAN onto the packet. Uses TPID \fIethertype\fP, which must be \fB0x8100\fP for an 802.1Q C\-tag or \fB0x88a8\fP for a 802.1ad S\-tag. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.1 and later supports this action. Open vSwitch 2.8 added support for multiple VLAN tags (with a limit of 2) and 802.1ad S\-tags. .UNINDENT .SS The \fBpush_mpls\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBpush_mpls:\fP\fIethertype\fP .fi .sp .UNINDENT .sp Pushes a new outermost MPLS label stack entry (LSE) onto the packet and changes the packet’s Ethertype to \fIethertype\fP, which must be either \fBB0x8847\fP or \fB0x8848\fP\&. If the packet did not already contain any MPLS labels, initializes the new LSE as: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B Label 2, if the packet contains IPv6, 0 otherwise. .TP .B TC The low 3 bits of the packet’s DSCP value, or 0 if the packet is not IP. .TP .B TTL Copied from the IP TTL, or 64 if the packet is not IP. .UNINDENT .UNINDENT .UNINDENT .sp If the packet did already contain an MPLS label, initializes the new outermost label as a copy of the existing outermost label. .sp OVS currently supports at most 3 MPLS labels. .sp This action applies only to Ethernet packets. .INDENT 0.0 .TP \fBConformance\fP Open vSwitch 1.11 introduced support for MPLS. OpenFlow 1.1 and later support \fBpush_mpls\fP\&. Open vSwitch implements \fBpush_mpls\fP as an extension to OpenFlow 1.0. .UNINDENT .SS The \fBpop_mpls\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBpop_mpls:\fP\fIethertype\fP .fi .sp .UNINDENT .sp Strips the outermost MPLS label stack entry and changes the packet’s Ethertype to \fIethertype\fP\&. This action applies only to Ethernet packets with at least one MPLS label. If there is more than one MPLS label, then \fIethertype\fP should be an MPLS Ethertype (\fBB0x8847\fP or \fB0x8848\fP). .INDENT 0.0 .TP \fBConformance\fP Open vSwitch 1.11 introduced support for MPLS. OpenFlow 1.1 and later support \fBpop_mpls\fP\&. Open vSwitch implements \fBpop_mpls\fP as an extension to OpenFlow 1.0. .UNINDENT .SS The \fBencap\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBencap(nsh([md_type=\fP\fImd_type\fP\fB], [tlv(\fP\fIclass\fP,\fItype\fP,\fIvalue\fP\fB)]...))\fP \fBencap(ethernet)\fP \fBencap(mpls)\fP \fBencap(mpls_mc)\fP .fi .sp .UNINDENT .sp The \fBencap\fP action encapsulates a packet with a specified header. It has variants for different kinds of encapsulation. .sp The \fBencap(nsh(...))\fP variant encapsulates an Ethernet frame with NSH. The \fImd_type\fP may be \fB1\fP or \fB2\fP for metadata type 1 or 2, defaulting to 1. For metadata type 2, TLVs may be specified with \fIclass\fP as a 16\-bit hexadecimal integer beginning with \fB0x\fP, \fItype\fP as an 8\-bit decimal integer, and \fIvalue\fP a sequence of pairs of hex digits beginning with \fB0x\fP\&. For example: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBencap(nsh(md_type=1))\fP Encapsulates the packet with an NSH header with metadata type 1. .TP .B \fBencap(nsh(md_type=2,tlv(0x1000,10,0x12345678)))\fP Encapsulates the packet with an NSH header, NSH metadata type 2, and an NSH TLV with class 0x1000, type 10, and the 4\-byte value 0x12345678. .UNINDENT .UNINDENT .UNINDENT .sp The \fBencap(ethernet)\fP variant encapsulate a bare L3 packet in an Ethernet frame. The Ethernet type is initialized to the L3 packet’s type, e.g. 0x0800 if the L3 packet is IPv4. The Ethernet source and destination are initially zeroed. .sp The \fBencap(mpls)\fP variant adds a MPLS header at the start of the packet. When encap(ethernet) is applied after this action, the ethertype of ethernet header will be populated with MPLS unicast ethertype (\fB0x8847\fP). .sp The \fBencap(mpls_mc)\fP variant adds a MPLS header at the start of the packet. When encap(ethernet) is applied after this action, the ethertype of ethernet header will be populated with MPLS multicast ethertype (\fB0x8848\fP). .INDENT 0.0 .TP \fBConformance\fP This action is an Open vSwitch extension to OpenFlow 1.3 and later, introduced in Open vSwitch 2.8. .sp The MPLS support for this action is added in Open vSwitch 2.17. .UNINDENT .SS The \fBdecap\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBdecap\fP \fBdecap(packet_type(ns=\fP\fInamespace,\fP\fBtype=\fP\fItype\fP\fB))\fP .fi .sp .UNINDENT .sp Removes an outermost encapsulation from the packet: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 If the packet is an Ethernet packet, removes the Ethernet header, which changes the packet into a bare L3 packet. If the packet has VLAN tags, raises an unsupported packet type error (see \fI\%Error Handling\fP, above). .IP \(bu 2 Otherwise, if the packet is an NSH packet, removes the NSH header, revealing the inner packet. Open vSwitch supports Ethernet, IPv4, IPv6, and NSH inner packet types. Other types raise unsupported packet type errors. .IP \(bu 2 Otherwise, if the packet is encapsulated inside a MPLS header, removes the MPLS header and classifies the inner packet as mentioned in the packet type argument of the decap. The \fIpacket_type\fP field specifies the type of the packet in the format specified in OpenFlow 1.5 chapter \fI7.2.3.11 Packet Type Match Field\fP\&. The inner packet will be incorrectly classified, if the inner packet is different from mentioned in the \fIpacket_type\fP field. .IP \(bu 2 Otherwise, raises an unsupported packet type error. .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP \fBConformance\fP This action is an Open vSwitch extension to OpenFlow 1.3 and later, introduced in Open vSwitch 2.8. .sp The MPLS support for this action is added in Open vSwitch 2.17. .UNINDENT .SH FIELD MODIFICATION ACTIONS .sp These actions modify packet data and metadata fields. .SS The \fBset_field\fP and \fBload\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBset_field:\fP\fIvalue\fP\fB[/\fP\fImask\fP\fB]\->\fP\fIdst\fP \fBload:\fP\fIvalue\fP\fB\->\fP\fIdst\fP .fi .sp .UNINDENT .sp These actions loads a literal value into a field or part of a field. The \fBset_field\fP action takes \fIvalue\fP in the customary syntax for field \fIdst\fP, e.g. \fB00:11:22:33:44:55\fP for an Ethernet address, and \fIdst\fP as the field’s name. The optional \fImask\fP allows part of a field to be set. .sp The \fBload\fP action takes \fIvalue\fP as an integer value (in decimal or prefixed by \fB0x\fP for hexadecimal) and \fIdst\fP as a field or subfield in the syntax described under \fI\%Field Specifications\fP above. .sp The following all set the Ethernet source address to 00:11:22:33:44:55: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 \fBset_field:00:11:22:33:44:55\->eth_src\fP .IP \(bu 2 \fBload:0x001122334455\->eth_src\fP .IP \(bu 2 \fBload:0x001122334455\->OXM_OF_ETH_SRC[]\fP .UNINDENT .UNINDENT .UNINDENT .sp The following all set the multicast bit in the Ethernet destination address: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 \fBset_field:01:00:00:00:00:00/01:00:00:00:00:00\->eth_dst\fP .IP \(bu 2 \fBload:1\->eth_dst[40]\fP .UNINDENT .UNINDENT .UNINDENT .sp Open vSwitch prohibits a \fBset_field\fP or \fBload\fP action whose \fIdst\fP is not guaranteed to be part of the packet; for example, \fBset_field\fP of \fBnw_dst\fP is only allowed in a flow that matches on Ethernet type 0x800. In some cases, such as in an action set, Open vSwitch can’t statically check that \fIdst\fP is part of the packet, and in that case if it is not then Open vSwitch treats the action as a no\-op. .INDENT 0.0 .TP \fBConformance\fP Open vSwitch 1.1 introduced \fBNXAST_REG_LOAD\fP as a extension to OpenFlow 1.0 and used \fBload\fP to express it. Later, OpenFlow 1.2 introduced a standard \fBOFPAT_SET_FIELD\fP action that was restricted to loading entire fields, so Open vSwitch added the form \fBset_field\fP with this restriction. OpenFlow 1.5 extended \fBOFPAT_SET_FIELD\fP to the point that it became a superset of \fBNXAST_REG_LOAD\fP\&. Open vSwitch translates either syntax as necessary for the OpenFlow version in use: in OpenFlow 1.0 and 1.1, \fBNXAST_REG_LOAD\fP; in OpenFlow 1.2, 1.3, and 1.4, \fBNXAST_REG_LOAD\fP for \fBload\fP or for loading a subfield, \fBOFPAT_SET_FIELD\fP otherwise; and OpenFlow 1.5 and later, \fBOFPAT_SET_FIELD\fP\&. .UNINDENT .SS The \fBmove\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBmove:\fP\fIsrc\fP\fB\->\fP\fIdst\fP .fi .sp .UNINDENT .sp Copies the named bits from field or subfield \fIsrc\fP to field or subfield \fIdst\fP\&. \fIsrc\fP and \fIdst\fP should fields or subfields in the syntax described under \fI\%Field Specifications\fP above. The two fields or subfields must have the same width. .sp Examples: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 \fBmove:reg0[0..5]\->reg1[26..31]\fP copies the six bits numbered 0 through 5 in register 0 into bits 26 through 31 of register 1. .IP \(bu 2 \fBmove:reg0[0..15]\->vlan_tci\fP copies the least significant 16 bits of register 0 into the VLAN TCI field. .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP \fBConformance\fP In OpenFlow 1.0 through 1.4, \fBmove\fP ordinarily uses an Open vSwitch extension to OpenFlow. In OpenFlow 1.5, \fBmove\fP uses the OpenFlow 1.5 standard \fBOFPAT_COPY_FIELD\fP action. The ONF has also made \fBOFPAT_COPY_FIELD\fP available as an extension to OpenFlow 1.3. Open vSwitch 2.4 and later understands this extension and uses it if a controller uses it, but for backward compatibility with older versions of Open vSwitch, \fBovs\-ofctl\fP does not use it. .UNINDENT .SS The \fBmod_dl_src\fP and \fBmod_dl_dst\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBmod_dl_src:\fP\fImac\fP \fBmod_dl_dst:\fP\fImac\fP .fi .sp .UNINDENT .sp Sets the Ethernet source or destination address, respectively, to \fImac\fP, which should be expressed in the form \fBxx:xx:xx:xx:xx:xx\fP\&. .sp For L3\-only packets, that is, those that lack an Ethernet header, this action has no effect. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.0 and 1.1 have specialized actions for these purposes. OpenFlow 1.2 and later do not, so Open vSwitch translates them to appropriate \fBOFPAT_SET_FIELD\fP actions for those versions, .UNINDENT .SS The \fBmod_nw_src\fP and \fBmod_nw_dst\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBmod_nw_src:\fP\fIip\fP \fBmod_nw_dst:\fP\fIip\fP .fi .sp .UNINDENT .sp Sets the IPv4 source or destination address, respectively, to \fIip\fP, which should be expressed in the form \fBw.x.y.z\fP\&. .sp In OpenFlow 1.1 and later, consistency rules allow these actions only in a flow that matches only packets that contain an IPv4 header (or following an action that adds an IPv4 header, e.g. \fBpop_mpls:0x0800\fP). See \fI\%Inconsistencies\fP, above, for more information. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.0 and 1.1 have specialized actions for these purposes. OpenFlow 1.2 and later do not, so Open vSwitch translates them to appropriate \fBOFPAT_SET_FIELD\fP actions for those versions, .UNINDENT .SS The \fBmod_nw_tos\fP and \fBmod_nw_ecn\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBmod_nw_tos:\fP\fItos\fP \fBmod_nw_ecn:\fP\fIecn\fP .fi .sp .UNINDENT .sp The \fBmod_nw_tos\fP action sets the DSCP bits in the IPv4 ToS/DSCP or IPv6 traffic class field to \fItos\fP, which must be a multiple of 4 between 0 and 255. This action does not modify the two least significant bits of the ToS field (the ECN bits). .sp The \fBmod_nw_ecn\fP action sets the ECN bits in the IPv4 ToS or IPv6 traffic class field to \fIecn\fP, which must be a value between 0 and 3, inclusive. This action does not modify the six most significant bits of the field (the DSCP bits). .sp In OpenFlow 1.1 and later, consistency rules allow these actions only in a flow that matches only packets that contain an IPv4 or IPv6 header (or following an action that adds such a header). See \fI\%Inconsistencies\fP, above, for more information. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.0 has a \fBmod_nw_tos\fP action but not \fBmod_nw_ecn\fP\&. Open vSwitch implements the latter in OpenFlow 1.0 as an extension using \fBNXAST_REG_LOAD\fP\&. OpenFlow 1.1 has specialized actions for these purposes. OpenFlow 1.2 and later do not, so Open vSwitch translates them to appropriate \fBOFPAT_SET_FIELD\fP actions for those versions. .UNINDENT .SS The \fBmod_tp_src\fP and \fBmod_tp_dst\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBmod_tp_src:\fP\fIport\fP \fBmod_tp_dst:\fP\fIport\fP .fi .sp .UNINDENT .sp Sets the TCP or UDP or SCTP source or destination port, respectively, to \fIport\fP\&. Both IPv4 and IPv6 are supported. .sp In OpenFlow 1.1 and later, consistency rules allow these actions only in a flow that matches only packets that contain a TCP or UDP or SCTP header. See \fI\%Inconsistencies\fP, above, for more information. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.0 and 1.1 have specialized actions for these purposes. OpenFlow 1.2 and later do not, so Open vSwitch translates them to appropriate \fBOFPAT_SET_FIELD\fP actions for those versions, .UNINDENT .SS The \fBdec_ttl\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBdec_ttl\fP \fBdec_ttl(\fP\fIid1\fP\fB[,\fP\fIid2\fP\fB[, ...]])\fP .fi .sp .UNINDENT .sp Decrement TTL of IPv4 packet or hop limit of IPv6 packet. If the TTL or hop limit is initially 0 or 1, no decrement occurs, as packets reaching TTL zero must be rejected. Instead, Open vSwitch sends a \fBpacket\-in\fP message with reason code \fBOFPR_INVALID_TTL\fP to each connected controller that has enabled receiving such messages, and stops processing the current set of actions. (However, if the current set of actions was reached through \fBresubmit\fP, the remaining actions in outer levels resume processing.) .sp As an Open vSwitch extension to OpenFlow, this action supports the ability to specify a list of controller IDs. Open vSwitch will only send the message to controllers with the given ID or IDs. Specifying no list is equivalent to specifying a single controller ID of zero. .sp In OpenFlow 1.1 and later, consistency rules allow these actions only in a flow that matches only packets that contain an IPv4 or IPv6 header. See \fI\%Inconsistencies\fP, above, for more information. .INDENT 0.0 .TP \fBConformance\fP All versions of OpenFlow and Open vSwitch support this action. .UNINDENT .SS The \fBset_mpls_label\fP, \fBset_mpls_tc\fP, and \fBset_mpls_ttl\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBset_mpls_label:\fP\fIlabel\fP \fBset_mpls_tc:\fP\fItc\fP \fBset_mpls_ttl:\fP\fIttl\fP .fi .sp .UNINDENT .sp The \fBset_mpls_label\fP action sets the label of the packet’s outer MPLS label stack entry. \fIlabel\fP should be a 20\-bit value that is decimal by default; use a \fB0x\fP prefix to specify the value in hexadecimal. .sp The \fBset_mpls_tc\fP action sets the traffic class of the packet’s outer MPLS label stack entry. \fItc\fP should be in the range 0 to 7, inclusive. .sp The \fBset_mpls_ttl\fP action sets the TTL of the packet’s outer MPLS label stack entry. \fIttl\fP should be in the range 0 to 255 inclusive. In OpenFlow 1.1 and later, consistency rules allow these actions only in a flow that matches only packets that contain an MPLS label (or following an action that adds an MPLS label, e.g. \fBpush_mpls:0x8847\fP). See \fI\%Inconsistencies\fP, above, for more information. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.0 does not support MPLS, but Open vSwitch implements these actions as extensions. OpenFlow 1.1 has specialized actions for these purposes. OpenFlow 1.2 and later do not, so Open vSwitch translates them to appropriate \fBOFPAT_SET_FIELD\fP actions for those versions, .UNINDENT .SS The \fBdec_mpls_ttl\fP and \fBdec_nsh_ttl\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBdec_mpls_ttl\fP \fBdec_nsh_ttl\fP .fi .sp .UNINDENT .sp These actions decrement the TTL of the packet’s outer MPLS label stack entry or its NSH header, respectively. If the TTL is initially 0 or 1, no decrement occurs. Instead, Open vSwitch sends a \fBpacket\-in\fP message with reason code \fBBOFPR_INVALID_TTL\fP to OpenFlow controllers with ID 0, if it has enabled receiving them. Processing the current set of actions then stops. (However, if the current set of actions was reached through \fBresubmit\fP, remaining actions in outer levels resume processing.) .sp In OpenFlow 1.1 and later, consistency rules allow this actions only in a flow that matches only packets that contain an MPLS label or an NSH header, respectively. See \fI\%Inconsistencies\fP, above, for more information. .INDENT 0.0 .TP \fBConformance\fP Open vSwitch 1.11 introduced support for MPLS. OpenFlow 1.1 and later support \fBdec_mpls_ttl\fP\&. Open vSwitch implements \fBdec_mpls_ttl\fP as an extension to OpenFlow 1.0. .sp Open vSwitch 2.8 introduced support for NSH, although the NSH draft changed after release so that only Open vSwitch 2.9 and later conform to the final protocol specification. The \fBdec_nsh_ttl\fP action and NSH support in general is an Open vSwitch extension not supported by any version of OpenFlow. .UNINDENT .SS The \fBcheck_pkt_larger\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBcheck_pkt_larger(\fP\fIpkt_len\fP\fB)\->\fP\fIdst\fP .fi .sp .UNINDENT .sp Checks if the packet is larger than the specified length in \fIpkt_len\fP\&. If so, stores 1 in \fIdst\fP, which should be a 1\-bit field; if not, stores 0. .sp The packet length to check against the argument \fIpkt_len\fP includes the L2 header and L2 payload of the packet, but not the VLAN tag (if present). .sp Examples: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 \fBcheck_pkt_larger(1500)\->reg0[0]\fP .IP \(bu 2 \fBcheck_pkt_larger(8000)\->reg9[10]\fP .UNINDENT .UNINDENT .UNINDENT .sp This action was added in Open vSwitch 2.12. .SS The \fBdelete_field\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBdelete_field:\fP\fIfield\fP .fi .sp .UNINDENT .sp The \fBdelete_field\fP action deletes a \fIfield\fP in the syntax described under \fI\%Field Specifications\fP above. Currently, only the \fBtun_metadata\fP fields are supported. .sp This action was added in Open vSwitch 2.14. .SH METADATA ACTIONS .SS The \fBset_tunnel\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBset_tunnel:\fP\fIid\fP \fBset_tunnel64:\fP\fIid\fP .fi .sp .UNINDENT .sp Many kinds of tunnels support a tunnel ID, e.g. VXLAN and Geneve have a 24\-bit VNI, and GRE has an optional 32\-bit key. This action sets the value used for tunnel ID in such tunneled packets, although whether it is used for a particular tunnel depends on the tunnel’s configuration. See the tunnel ID documentation in \fBovs\-fields(7)\fP for more information. .INDENT 0.0 .TP \fBConformance\fP These actions are OpenFlow extensions. \fBset_tunnel\fP was introduced in Open vSwitch 1.0. \fBset_tunnel64\fP, which is needed if \fIid\fP is wider than 32 bits, was added in Open vSwitch 1.1. Both actions always set the entire tunnel ID field. Open vSwitch supports these actions in all versions of OpenFlow, but in OpenFlow 1.2 and later it translates them to an appropriate standardized \fBOFPAT_SET_FIELD\fP action. .UNINDENT .SS The \fBset_queue\fP and \fBpop_queue\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBset_queue:\fP\fIqueue\fP \fBpop_queue\fP .fi .sp .UNINDENT .sp The \fBset_queue\fP action sets the queue ID to be used for subsequent output actions to \fIqueue\fP, which must be a 32\-bit integer. The range of meaningful values of \fIqueue\fP, and their meanings, varies greatly from one OpenFlow implementation to another. Even within a single implementation, there is no guarantee that all OpenFlow ports have the same queues configured or that all OpenFlow ports in an implementation can be configured the same way queue\-wise. For more information, see the documentation for the output queue field in \fBovs\-fields(7)\fP\&. .sp The \fBpop_queue\fP restores the output queue to the default that was set when the packet entered the switch (generally 0). .sp Four billion queues ought to be enough for anyone: \fI\%https://mailman.stanford.edu/pipermail/openflow\-spec/2009\-August/000394.html\fP .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.1 introduced the \fBset_queue\fP action. Open vSwitch also supports it as an extension in OpenFlow 1.0. .sp The \fBpop_queue\fP action is an Open vSwitch extension. .UNINDENT .SH FIREWALLING ACTIONS .sp Open vSwitch is often used to implement a firewall. The preferred way to implement a firewall is \fBconnection tracking,\fP that is, to keep track of the connection state of individual TCP sessions. The \fBct\fP action described in this section, added in Open vSwitch 2.5, implements connection tracking. For new deployments, it is the recommended way to implement firewalling with Open vSwitch. .sp Before \fBct\fP was added, Open vSwitch did not have built\-in support for connection tracking. Instead, Open vSwitch supported the \fBlearn\fP action, which allows a received packet to add a flow to an OpenFlow flow table. This could be used to implement a primitive form of connection tracking: packets passing through the firewall in one direction could create flows that allowed response packets back through the firewall in the other direction. The additional \fBfin_timeout\fP action allowed the learned flows to expire quickly after TCP session termination. .SS The \fBct\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBct([\fP\fIargument\fP\fB]...)\fP \fBct(commit[,\fP\fIargument\fP\fB]...)\fP .fi .sp .UNINDENT .sp The action has two modes of operation, distinguished by whether \fBcommit\fP is present. The following arguments may be present in either mode: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBzone=\fP\fIvalue\fP A zone is a 16\-bit id that isolates connections into separate domains, allowing overlapping network addresses in different zones. If a zone is not provided, then the default is 0. The \fIvalue\fP may be specified either as a 16\-bit integer literal or a field or subfield in the syntax described under \fI\%Field Specifications\fP above. .UNINDENT .UNINDENT .UNINDENT .sp Without \fBcommit\fP, this action sends the packet through the connection tracker. The connection tracker keeps track of the state of TCP connections for packets passed through it. For each packet through a connection, it checks that it satisfies TCP invariants and signals the connection state to later actions using the \fBct_state\fP metadata field, which is documented in \fBovs\-fields(7)\fP\&. .sp In this form, \fBct\fP forks the OpenFlow pipeline: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 In one fork, \fBct\fP passes the packet to the connection tracker. Afterward, it reinjects the packet into the OpenFlow pipeline with the connection tracking fields initialized. The \fBct_state\fP field is initialized with connection state and \fBct_zone\fP to the connection tracking zone specified on the \fBzone\fP argument. If the connection is one that is already tracked, \fBct_mark\fP and \fBct_label\fP to its existing mark and label, respectively; otherwise they are zeroed. In addition, \fBct_nw_proto\fP, \fBct_nw_src\fP, \fBct_nw_dst\fP, \fBct_ipv6_src\fP, \fBct_ipv6_dst\fP, \fBct_tp_src\fP, and \fBct_tp_dst\fP are initialized appropriately for the original direction connection. See the \fBresubmit\fP action for a way to search the flow table with the connection tracking original direction fields swapped with the packet 5\-tuple fields. See \fBovs\-fields(7)\fP for details on the connection tracking fields. .IP \(bu 2 In the other fork, the original instance of the packet continues independent processing following the \fBct\fP action. The \fBct_state\fP field and other connection tracking metadata are cleared. .UNINDENT .UNINDENT .UNINDENT .sp Without \fBcommit\fP, the \fBct\fP action accepts the following arguments: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBtable=\fP\fItable\fP Sets the OpenFlow table where the packet is reinjected. The \fItable\fP must be a number between 0 and 254 inclusive, or a table’s name. If \fItable\fP is not specified, then the packet is not reinjected. .UNINDENT .sp \fBnat\fP .INDENT 0.0 .TP .B \fBnat(\fP\fItype\fP\fB=\fP\fIaddrs\fP\fB[:\fP\fIports\fP\fB][,\fP\fIflag\fP\fB]...)\fP Specify address and port translation for the connection being tracked. The \fItype\fP must be \fBsrc\fP, for source address/port translation (SNAT), or \fBdst\fP, for destination address/port translation (DNAT). Setting up address translation for a new connection takes effect only if the connection is later committed with \fBct(commit ...)\fP\&. .sp The \fBsrc\fP and \fBdst\fP options take the following arguments: .INDENT 7.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fIaddrs\fP The IP address \fBaddr\fP or range \fBaddr1\-addr2\fP from which the translated address should be selected. If only one address is given, then that address will always be selected, otherwise the address selection can be informed by the optional persistent flag as described below. Either IPv4 or IPv6 addresses can be provided, but both addresses must be of the same type, and the datapath behavior is undefined in case of providing IPv4 address range for an IPv6 packet, or IPv6 address range for an IPv4 packet. IPv6 addresses must be bracketed with \fB[\fP and \fB]\fP if a port range is also given. .TP .B \fIports\fP The L4 \fBport\fP or range \fBport1\-port2\fP from which the translated port should be selected. When a port range is specified, fallback to ephemeral ports does not happen, else, it will. The port number selection can be informed by the optional \fBrandom\fP and \fBhash\fP flags described below. The userspace datapath only supports the \fBhash\fP behavior. .UNINDENT .UNINDENT .UNINDENT .sp The optional \fIflags\fP are: .INDENT 7.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBrandom\fP The selection of the port from the given range should be done using a fresh random number. This flag is mutually exclusive with \fBhash\fP\&. .TP .B \fBhash\fP The selection of the port from the given range should be done using a datapath specific hash of the packet’s IP addresses and the other, non\-mapped port number. This flag is mutually exclusive with \fBrandom\fP\&. .TP .B \fBpersistent\fP The selection of the IP address from the given range should be done so that the same mapping can be provided after the system restarts. .UNINDENT .UNINDENT .UNINDENT .sp If \fBalg\fP is specified for the committing \fBct\fP action that also includes \fBnat\fP with a \fBsrc\fP or \fBdst\fP attribute, then the datapath tries to set up the helper to be NAT\-aware. This functionality is datapath specific and may not be supported by all datapaths. .sp A \fBbare\fP \fBnat\fP argument with no options will only translate the packet being processed in the way the connection has been set up with an earlier, committed \fBct\fP action. A \fBnat\fP action with \fBsrc\fP or \fBdst\fP, when applied to a packet belonging to an established (rather than new) connection, will behave the same as a bare \fBnat\fP\&. .sp For SNAT, there is a special case when the \fBsrc\fP IP address is configured as all 0’s, i.e., \fBnat(src=0.0.0.0)\fP\&. In this case, when a source port collision is detected during the commit, the source port will be translated to an ephemeral port. If there is no collision, no SNAT is performed. .sp Open vSwitch 2.6 introduced \fBnat\fP\&. Linux 4.6 was the earliest upstream kernel that implemented \fBct\fP support for \fBnat\fP\&. .UNINDENT .UNINDENT .UNINDENT .sp With \fBcommit\fP, the connection tracker commits the connection to the connection tracking module. The \fBcommit\fP flag should only be used from the pipeline within the first fork of \fBct\fP without \fBcommit\fP\&. Information about the connection is stored beyond the lifetime of the packet in the pipeline. Some \fBct_state\fP flags are only available for committed connections. .sp The following options are available only with \fBcommit\fP: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBforce\fP A committed connection always has the directionality of the packet that caused the connection to be committed in the first place. This is the \fBoriginal direction\fP of the connection, and the opposite direction is the \fBreply direction\fP\&. If a connection is already committed, but it is in the wrong direction, \fBforce\fP effectively terminates the existing connection and starts a new one in the current direction. This flag has no effect if the original direction of the connection is already the same as that of the current packet. .TP .B \fBexec(\fP\fIaction\fP\fB\&...)\fP Perform each \fIaction\fP within the context of connection tracking. Only actions which modify the \fBct_mark\fP or \fBct_label\fP fields are accepted within \fBexec\fP action, and these fields may only be modified with this option. For example: .INDENT 7.0 .TP .B \fBset_field:\fP\fIvalue\fP\fB[/\fP\fImask\fP\fB]\->ct_mark\fP Store a 32\-bit metadata value with the connection. Subsequent lookups for packets in this connection will populate \fBct_mark\fP when the packet is sent to the connection tracker with the table specified. .TP .B \fBset_field:\fP\fIvalue\fP\fB[/\fP\fImask\fP\fB]\->ct_label\fP Store a 128\-bit metadata value with the connection. Subsequent lookups for packets in this connection will populate \fBct_label\fP when the packet is sent to the connection tracker with the table specified. .UNINDENT .TP .B \fBalg=\fP\fIalg\fP Specify application layer gateway \fIalg\fP to track specific connection types. If subsequent related connections are sent through the \fBct\fP action, then the \fBrel\fP flag in the \fBct_state\fP field will be set. Supported types include: .INDENT 7.0 .TP .B \fBftp\fP Look for negotiation of FTP data connections. Specify this option for FTP control connections to detect related data connections and populate the \fBrel\fP flag for the data connections. .TP .B \fBtftp\fP Look for negotiation of TFTP data connections. Specify this option for TFTP control connections to detect related data connections and populate the \fBrel\fP flag for the data connections. .UNINDENT .sp Related connections inherit \fBct_mark\fP from that stored with the original connection (i.e. the connection created by \fBct(alg=...)\fP\&. .UNINDENT .UNINDENT .UNINDENT .sp With the Linux datapath, global sysctl options affect \fBct\fP behavior. In particular, if \fBnet.netfilter.nf_conntrack_helper\fP is enabled, which it is by default until Linux 4.7, then application layer gateway helpers may be executed even if \fIalg\fP is not specified. For security reasons, the netfilter team recommends users disable this option. For further details, please see \fI\%http://www.netfilter.org/news.html#2012\-04\-03\fP . .sp The \fBct\fP action may be used as a primitive to construct stateful firewalls by selectively committing some traffic, then matching \fBct_state\fP to allow established connections while denying new connections. The following flows provide an example of how to implement a simple firewall that allows new connections from port 1 to port 2, and only allows established connections to send traffic from port 2 to port 1: .INDENT 0.0 .INDENT 3.5 .sp .EX table=0,priority=1,action=drop table=0,priority=10,arp,action=normal table=0,priority=100,ip,ct_state=\-trk,action=ct(table=1) table=1,in_port=1,ip,ct_state=+trk+new,action=ct(commit),2 table=1,in_port=1,ip,ct_state=+trk+est,action=2 table=1,in_port=2,ip,ct_state=+trk+new,action=drop table=1,in_port=2,ip,ct_state=+trk+est,action=1 .EE .UNINDENT .UNINDENT .sp If \fBct\fP is executed on IPv4 (or IPv6) fragments, then the message is implicitly reassembled before sending to the connection tracker and refragmented upon output, to the original maximum received fragment size. Reassembly occurs within the context of the zone, meaning that IP fragments in different zones are not assembled together. Pipeline processing for the initial fragments is halted. When the final fragment is received, the message is assembled and pipeline processing continues for that flow. Packet ordering is not guaranteed by IP protocols, so it is not possible to determine which IP fragment will cause message reassembly (and therefore continue pipeline processing). As such, it is strongly recommended that multiple flows should not execute \fBct\fP to reassemble fragments from the same IP message. .INDENT 0.0 .TP \fBConformance\fP The \fBct\fP action was introduced in Open vSwitch 2.5. Some of its features were introduced later, noted individually above. .UNINDENT .SS The \fBct_clear\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBct_clear\fP .fi .sp .UNINDENT .sp Clears connection tracking state from the flow, zeroing \fBct_state\fP, \fBct_zone\fP, \fBct_mark\fP, and \fBct_label\fP\&. .sp This action was introduced in Open vSwitch 2.7. .SS The \fBlearn\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBlearn(\fP\fIargument\fP\fB\&...)\fP .fi .sp .UNINDENT .sp The \fBlearn\fP action adds or modifies a flow in an OpenFlow table, similar to \fBovs\-ofctl \-\-strict mod\-flows\fP\&. The arguments specify the match fields, actions, and other properties of the flow to be added or modified. .sp Match fields for the new flow are specified as follows. At least one match field should ordinarily be specified: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fIfield\fP\fB=\fP\fIvalue\fP Specifies that \fIfield\fP, in the new flow, must match the literal \fIvalue\fP, e.g. \fBdl_type=0x800\fP\&. Shorthand match syntax, such as \fBip\fP in place of \fBdl_type=0x800\fP, is not supported. .TP .B \fIfield\fP\fB=\fP\fIsrc\fP Specifies that \fIfield\fP in the new flow must match \fIsrc\fP taken from the packet currently being processed. For example, \fBudp_dst=udp_src\fP, applied to a UDP packet with source port 53, creates a flow which matches \fBudp_dst=53\fP\&. \fIfield\fP and \fIsrc\fP must have the same width. .TP .B \fIfield\fP Shorthand for the previous form when \fIfield\fP and \fIsrc\fP are the same. For example, \fBudp_dst\fP, applied to a UDP packet with destination port 53, creates a flow which matches \fBudp_dst=53\fP\&. .UNINDENT .UNINDENT .UNINDENT .sp The \fIfield\fP and \fIsrc\fP arguments above should be fields or subfields in the syntax described under \fI\%Field Specifications\fP above. .sp Match field specifications must honor prerequisites for both the flow with the \fBlearn\fP and the new flow that it creates. Consider the following complete flow, in the syntax accepted by \fBovs\-ofctl\fP\&. If the flow’s match on \fBudp\fP were omitted, then the flow would not satisfy the prerequisites for the \fBlearn\fP action’s use of \fBudp_src\fP\&. If \fBdl_type=0x800\fP or \fBnw_proto\fP were omitted from \fBlearn\fP, then the new flow would not satisfy the prerequisite for its match on \fBudp_dst\fP\&. For more information on prerequisites, please refer to \fBovs\-fields(7)\fP: .INDENT 0.0 .INDENT 3.5 .sp .EX udp, actions=learn(dl_type=0x800, nw_proto=17, udp_dst=udp_src) .EE .UNINDENT .UNINDENT .sp Actions for the new flow are specified as follows. At least one action should ordinarily be specified: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBload:\fP\fIvalue\fP\fB\->\fP\fIdst\fP Adds a \fBload\fP action to the new flow that loads the literal \fIvalue\fP into \fIdst\fP\&. The syntax is the same as the \fBload\fP action explained in the \fI\%Field Modification Actions\fP section. .TP .B \fBload:\fP\fIsrc\fP\fB\->\fP\fIdst\fP Adds a \fBload\fP action to the new flow that loads \fIsrc\fP, a field or subfield from the packet being processed, into \fIdst\fP\&. .TP .B \fBoutput:\fP\fIfield\fP Adds an \fBoutput\fP action to the new flow’s actions that outputs to the OpenFlow port taken from \fIfield\fP, which must be a field as described above. .TP .B \fBfin_idle_timeout=\fP\fIseconds\fP / \fBfin_hard_timeout=\fP\fIseconds\fP Adds a \fBfin_timeout\fP action with the specified arguments to the new flow. This feature was added in Open vSwitch 1.6. .UNINDENT .UNINDENT .UNINDENT .sp The following additional arguments are optional: .INDENT 0.0 .INDENT 3.5 \fBidle_timeout=\fP\fIseconds\fP .sp \fBhard_timeout=\fP\fIseconds\fP .sp \fBpriority=\fP\fIvalue\fP .sp \fBcookie=\fP\fIvalue\fP .INDENT 0.0 .TP .B \fBsend_flow_rem\fP These arguments have the same meaning as in the usual flow syntax documented in \fBovs\-ofctl(8)\fP\&. .TP .B \fBtable=\fP\fItable\fP The table in which the new flow should be inserted. Specify a decimal number between 0 and 254 inclusive or the name of a table. The default, if table is unspecified, is table 1 (not 0). .TP .B \fBdelete_learned\fP When this flag is specified, deleting the flow that contains the \fBlearn\fP action will also delete the flows created by \fBlearn\fP\&. Specifically, when the last \fBlearn\fP action with this flag and particular \fBtable\fP and \fBcookie\fP values is removed, the switch deletes all of the flows in the specified table with the specified cookie. .sp This flag was added in Open vSwitch 2.4. .TP .B \fBlimit=\fP\fInumber\fP If the number of flows in the new flow’s table with the same cookie exceeds \fInumber\fP, the action will not add a new flow. By default, or with \fBlimit=0\fP, there is no limit. .sp This flag was added in Open vSwitch 2.8. .TP .B \fBresult_dst=\fP\fIfield\fP\fB[\fP\fIbit\fP\fB]\fP If learn fails (because the number of flows exceeds \fBlimit\fP), the action sets \fIfield\fP[\fIbit\fP] to 0, otherwise it will be set to 1. \fIfield\fP[\fIbit\fP] must be a single bit. .sp This flag was added in Open vSwitch 2.8. .UNINDENT .UNINDENT .UNINDENT .sp By itself, the \fBlearn\fP action can only put two kinds of actions into the flows that it creates: \fBload\fP and \fBoutput\fP actions. If \fBlearn\fP is used in isolation, these are severe limits. .sp However, \fBlearn\fP is not meant to be used in isolation. It is a primitive meant to be used together with other Open vSwitch features to accomplish a task. Its existing features are enough to accomplish most tasks. .sp Here is an outline of a typical pipeline structure that allows for versatile behavior using \fBlearn\fP: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Flows in table \fBA\fP contain a \fBlearn\fP action, that populates flows in table \fBL\fP, that use a \fBload\fP action to populate register \fBR\fP with information about what was learned. .IP \(bu 2 Flows in table \fBB\fP contain two sequential resubmit actions: one to table \fBL\fP and another one to table \fBB + 1\fP\&. .IP \(bu 2 Flows in table \fBB + 1\fP match on register \fBR\fP and act differently depending on what the flows in table \fBL\fP loaded into it. .UNINDENT .UNINDENT .UNINDENT .sp This approach can be used to implement many \fBlearn\fP\-based features. For example: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Resubmit to a table selected based on learned information, e.g. see \fI\%https://mail.openvswitch.org/pipermail/ovs\-discuss/2016\-June/021694.html\fP . .IP \(bu 2 MAC learning in the middle of a pipeline, as described in the \fBOpen vSwitch Advanced Features Tutorial\fP in the OVS documentation. .IP \(bu 2 TCP state based firewalling, by learning outgoing connections based on SYN packets and matching them up with incoming packets. (This is usually better implemented using the \fBct\fP action.) .IP \(bu 2 At least some of the features described in T. A. Hoff, \fBExtending Open vSwitch to Facilitate Creation of Stateful SDN Applications\fP\&. .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP \fBConformance\fP The \fBlearn\fP action is an Open vSwitch extension to OpenFlow added in Open vSwitch 1.3. Some features of \fBlearn\fP were added in later versions, as noted individually above. .UNINDENT .SS The \fBfin_timeout\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBfin_timeout(\fP\fIkey\fP\fB=\fP\fIvalue\fP\fB\&...)\fP .fi .sp .UNINDENT .sp This action changes the idle timeout or hard timeout, or both, of the OpenFlow flow that contains it, when the flow matches a TCP packet with the FIN or RST flag. When such a packet is observed, the action reduces the rule’s timeouts to those specified on the action. If the rule’s existing timeout is already shorter than the one that the action specifies, then that timeout is unaffected. .sp The timeouts are specified as key\-value pairs: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBidle_timeout=\fP\fIseconds\fP Causes the flow to expire after the given number of seconds of inactivity. .TP .B \fBhard_timeout=\fP\fIseconds\fP Causes the flow to expire after the given number of \fIseconds\fP, regardless of activity. (\fIseconds\fP specifies time since the flow’s creation, not since the receipt of the FIN or RST.) .UNINDENT .UNINDENT .UNINDENT .sp This action is normally added to a learned flow by the \fBlearn\fP action. It is unlikely to be useful otherwise. .INDENT 0.0 .TP \fBConformance\fP This Open vSwitch extension action was added in Open vSwitch 1.6. .UNINDENT .SH PROGRAMMING AND CONTROL FLOW ACTIONS .SS The \fBresubmit\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBresubmit:\fP\fIport\fP \fBresubmit([\fP\fIport\fP\fB],[\fP\fItable\fP][,ct])\(ga\(ga .fi .sp .UNINDENT .sp Searches an OpenFlow flow table for a matching flow and executes the actions found, if any, before continuing to the following action in the current flow entry. Arguments can customize the search: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 If \fIport\fP is given as an OpenFlow port number or name, then it specifies a value to use for the input port metadata field as part of the search, in place of the input port currently in the flow. Specifying \fBin_port\fP as \fBport\fP is equivalent to omitting it. .IP \(bu 2 If \fItable\fP is given as an integer between 0 and 254 or a table name, it specifies the OpenFlow table to search. If it is not specified, the table from the current flow is used. .IP \(bu 2 If \fBct\fP is specified, then the search is done with packet 5\-tuple fields swapped with the corresponding conntrack original direction tuple fields. See the documentation for \fBct\fP above, for more information about connection tracking, or \fBovs\-fields(7)\fP for details about the connection tracking fields. .sp This flag requires a valid connection tracking state as a match prerequisite in the flow where this action is placed. Examples of valid connection tracking state matches include \fBct_state=+new\fP, \fBct_state=+est\fP, \fBct_state=+rel\fP, and \fBct_state=+trk\-inv\fP\&. .UNINDENT .UNINDENT .UNINDENT .sp The changes, if any, to the input port and connection tracking fields are just for searching the flow table. The changes are not visible to actions or to later flow table lookups. .sp The most common use of \fBresubmit\fP is to visit another flow table without \fIport\fP or \fBct\fP, like this: \fBresubmit(,\fP\fItable\fP\fB)\fP\&. .sp Recursive \fBresubmit\fP actions are permitted. .INDENT 0.0 .TP \fBConformance\fP The \fBresubmit\fP action is an Open vSwitch extension. However, the \fBgoto_table\fP instruction in OpenFlow 1.1 and later can be viewed as a kind of restricted \fBresubmit\fP\&. .sp Open vSwitch 1.3 added \fBtable\fP\&. Open vSwitch 2.7 added \fBct\fP\&. .sp Open vSwitch imposes a limit on \fBresubmit\fP recursion that varies among version: .INDENT 7.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 Open vSwitch 1.0.1 and earlier did not support recursion. .IP \(bu 2 Open vSwitch 1.0.2 and 1.0.3 limited recursion to 8 levels. .IP \(bu 2 Open vSwitch 1.1 and 1.2 limited recursion to 16 levels. .IP \(bu 2 Open vSwitch 1.2 through 1.8 limited recursion to 32 levels. .IP \(bu 2 Open vSwitch 1.9 through 2.0 limited recursion to 64 levels. .IP \(bu 2 Open vSwitch 2.1 through 2.5 limited recursion to 64 levels and impose a total limit of 4,096 resubmits per flow translation (earlier versions did not impose any total limit). .IP \(bu 2 Open vSwitch 2.6 and later imposes the same limits as 2.5, with one exception: resubmit from table \fBx\fP to any table \fBy > x\fP does not count against the recursion depth limit. .UNINDENT .UNINDENT .UNINDENT .UNINDENT .SS The \fBclone\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBclone(\fP\fIaction\fP\fB\&...)\fP .fi .sp .UNINDENT .sp Executes each nested \fIaction\fP, saving much of the packet and pipeline state beforehand and then restoring it afterward. The state that is saved and restored includes all flow data and metadata (including, for example, \fBin_port\fP and \fBct_state\fP), the stack accessed by \fBpush\fP and \fBpop\fP actions, and the OpenFlow action set. .sp This action was added in Open vSwitch 2.7. .SS The \fBpush\fP and \fBpop\fP actions .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBpush:\fP\fIsrc\fP \fBpop:\fP\fIdst\fP .fi .sp .UNINDENT .sp The \fBpush\fP action pushes \fIsrc\fP on a general\-purpose stack. The \fBpop\fP action pops an entry off the stack into \fIdst\fP\&. \fIsrc\fP and \fIdst\fP should be fields or subfields in the syntax described under \fI\%Field Specifications\fP above. .sp Controllers can use the stack for saving and restoring data or metadata around \fBresubmit\fP actions, for swapping or rearranging data and metadata, or for other purposes. Any data or metadata field, or part of one, may be pushed, and any modifiable field or subfield may be popped. .sp The number of bits pushed in a stack entry do not have to match the number of bits later popped from that entry. If more bits are popped from an entry than were pushed, then the entry is conceptually left\-padded with 0\-bits as needed. If fewer bits are popped than pushed, then bits are conceptually trimmed from the left side of the entry. .sp The stack’s size is limited. The limit is intended to be high enough that \fBnormal\fP use will not pose problems. Stack overflow or underflow is an error that stops action execution (see \fBStack too deep\fP under \fI\%Error Handling\fP, above). .sp Examples: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 \fBpush:reg2[0..5]\fP or \fBpush:NXM_NX_REG2[0..5]\fP pushes on the stack the 6 bits in register 2 bits 0 through 5. .IP \(bu 2 \fBpop:reg2[0..5]\fP or \fBpop:NXM_NX_REG2[0..5]\fP pops the value from top of the stack and copy bits 0 through 5 of that value into bits 0 through 5 of register 2. .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP \fBConformance\fP Open vSwitch 1.2 introduced \fBpush\fP and \fBpop\fP as OpenFlow extension actions. .UNINDENT .SS The \fBexit\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBexit\fP .fi .sp .UNINDENT .sp This action causes Open vSwitch to immediately halt execution of further actions. Actions which have already been executed are unaffected. Any further actions, including those which may be in other tables, or different levels of the \fBresubmit\fP call stack, are ignored. However, an \fBexit\fP action within a group bucket terminates only execution of that bucket, not other buckets or the overall pipeline. Actions in the action set are still executed (specify \fBclear_actions\fP before \fBexit\fP to discard them). .SS The \fBmultipath\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBmultipath(\fP\fIfields\fP,\fIbasis\fP,\fIalgorithm\fP,\fIn_links\fP,\fIarg\fP,\fIdst\fP\fB)\fP .fi .sp .UNINDENT .sp Hashes \fIfields\fP using \fIbasis\fP as a universal hash parameter, then the applies multipath link selection \fIalgorithm\fP (with parameter \fIarg\fP) to choose one of \fIn_links\fP output links numbered 0 through \fIn_links\fP minus 1, and stores the link into \fIdst\fP, which must be a field or subfield in the syntax described under \fI\%Field Specifications\fP above. .sp The \fBbundle\fP or \fBbundle_load\fP actions are usually easier to use than \fBmultipath\fP\&. .sp \fIfields\fP must be one of the following: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBeth_src\fP Hashes Ethernet source address only. .TP .B \fBsymmetric_l4\fP Hashes Ethernet source, destination, and type, VLAN ID, IPv4/IPv6 source, destination, and protocol, and TCP or SCTP (but not UDP) ports. The hash is computed so that pairs of corresponding flows in each direction hash to the same value, in environments where L2 paths are the same in each direction. UDP ports are not included in the hash to support protocols such as VXLAN that use asymmetric ports in each direction. .TP .B \fBsymmetric_l3l4\fP Hashes IPv4/IPv6 source, destination, and protocol, and TCP or SCTP (but not UDP) ports. Like \fBsymmetric_l4\fP, this is a symmetric hash, but by excluding L2 headers it is more effective in environments with asymmetric L2 paths (e.g. paths involving VRRP IP addresses on a router). Not an effective hash function for protocols other than IPv4 and IPv6, which hash to a constant zero. .TP .B \fBsymmetric_l3l4+udp\fP Like \fBsymmetric_l3l4+udp\fP, but UDP ports are included in the hash. This is a more effective hash when asymmetric UDP protocols such as VXLAN are not a consideration. .TP .B \fBsymmetric_l3\fP Hashes network source address and network destination address. .TP .B \fBnw_src\fP Hashes network source address only. .TP .B \fBnw_dst\fP Hashes network destination address only. .UNINDENT .UNINDENT .UNINDENT .sp The \fIalgorithm\fP used to compute the final result \fBlink\fP must be one of the following: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBmodulo_n\fP Computes \fBlink = hash(flow) % n_links\fP\&. .sp This algorithm redistributes all traffic when \fBn_links\fP changes. It has \fBO(1)\fP performance. .sp Use 65535 for \fBmax_link\fP to get a raw hash value. .sp This algorithm is specified by RFC 2992. .TP .B \fBhash_threshold\fP Computes \fBlink = hash(flow) / (MAX_HASH / n_links)\fP\&. .sp Redistributes between one\-quarter and one\-half of traffic when \fBn_links\fP changes. It has \fBO(1)\fP performance. .sp This algorithm is specified by RFC 2992. .TP .B \fBhrw\fP (Highest Random Weight) Computes the following: .INDENT 7.0 .INDENT 3.5 .sp .EX for i in [0, n_links]: weights[i] = hash(flow, i) link = { i such that weights[i] >= weights[j] for all j != i } .EE .UNINDENT .UNINDENT .sp Redistributes \fB1 / n_links\fP of traffic when \fBn_links\fP changes. It has \fBO(n_links)\fP performance. If \fBn_links\fP is greater than a threshold (currently 64, but subject to change), Open vSwitch will substitute another algorithm automatically. .sp This algorithm is specified by RFC 2992. .TP .B \fBiter_hash\fP (Iterative Hash) Computes the following: .INDENT 7.0 .INDENT 3.5 .sp .EX i = 0 repeat: i = i + 1 link = hash(flow, i) % arg while link > max_link .EE .UNINDENT .UNINDENT .sp Redistributes \fB1 / n_links\fP of traffic when \fBn_links\fP changes. \fBO(1)\fP performance when \fBarg / max_link\fP is bounded by a constant. .sp Redistributes all traffic when \fBarg\fP changes. .sp \fIarg\fP must be greater than \fBmax_link\fP and for best performance should be no more than approximately \fBmax_link * 2\fP\&. If \fIarg\fP is outside the acceptable range, Open vSwitch will automatically substitute the least power of 2 greater than \fBmax_link\fP\&. .sp This algorithm is specific to Open vSwitch. .UNINDENT .UNINDENT .UNINDENT .sp Only the \fBiter_hash\fP algorithm uses \fIarg\fP\&. .sp It is an error if \fBmax_link\fP is greater than or equal to \fB2**n_bits\fP\&. .INDENT 0.0 .TP \fBConformance\fP This is an OpenFlow extension added in Open vSwitch 1.1. .UNINDENT .SH OTHER ACTIONS .SS The \fBconjunction\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBconjunction(\fP\fIid\fP, \fIk\fP/\fIn\fP\fB)\fP .fi .sp .UNINDENT .sp This action allows for sophisticated \fBconjunctive match\fP flows. Refer to \fBConjunctive Match Fields\fP in \fBovs\-fields(7)\fP for details. .sp A flow that has one or more \fBconjunction\fP actions may not have any other actions except for \fBnote\fP actions. .INDENT 0.0 .TP \fBConformance\fP Open vSwitch 2.4 introduced the \fBconjunction\fP action and \fBconj_id\fP field. They are Open vSwitch extensions to OpenFlow. .UNINDENT .SS The \fBnote\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBnote:[\fP\fIhh\fP\fB]...\fP .fi .sp .UNINDENT .sp This action does nothing at all. OpenFlow controllers may use it to annotate flows with more data than can fit in a flow cookie. .sp The action may include any number of bytes represented as hex digits \fIhh\fP\&. Periods may separate pairs of hex digits, for readability. The \fBnote\fP action’s format doesn’t include an exact length for its payload, so the provided bytes will be padded on the right by enough bytes with value 0 to make the total number 6 more than a multiple of 8. .INDENT 0.0 .TP \fBConformance\fP This action is an extension to OpenFlow introduced in Open vSwitch 1.1. .UNINDENT .SS The \fBsample\fP action .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBsample(\fP\fIargument\fP\fB\&...)\fP .fi .sp .UNINDENT .sp Samples packets and sends one sample for every sampled packet. .sp The following \fIargument\fP forms are accepted: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .B \fBprobability=\fP\fIpackets\fP The number of sampled packets out of 65535. Must be greater or equal to 1. .TP .B \fBcollector_set_id=\fP\fIid\fP The unsigned 32\-bit integer identifier of the set of sample collectors to send sampled packets to. Defaults to 0. .TP .B \fBobs_domain_id=\fP\fIid\fP When sending samples to IPFIX collectors, the unsigned 32\-bit integer Observation Domain ID sent in every IPFIX flow record. Defaults to 0. .TP .B \fBobs_point_id=\fP\fIid\fP When sending samples to IPFIX collectors, the unsigned 32\-bit integer Observation Point ID sent in every IPFIX flow record. Defaults to 0. .TP .B \fBsampling_port=\fP\fIport\fP Sample packets on \fIport\fP, which should be the ingress or egress port. This option, which was added in Open vSwitch 2.6, allows the IPFIX implementation to export egress tunnel information. .UNINDENT .sp \fBingress\fP .INDENT 0.0 .TP .B \fBegress\fP Specifies explicitly that the packet is being sampled on ingress to or egress from the switch. IPFIX reports sent by Open vSwitch before version 2.6 did not include a direction. From 2.6 until 2.7, IPFIX reports inferred a direction from \fBsampling_port\fP: if it was the packet’s output port, then the direction was reported as egress, otherwise as ingress. Open vSwitch 2.7 introduced these options, which allow the inferred direction to be overridden. This is particularly useful when the ingress (or egress) port is not a tunnel. .UNINDENT .UNINDENT .UNINDENT .sp Refer to \fBovs\-vswitchd.conf.db(5)\fP for more details on configuring sample collector sets. .INDENT 0.0 .TP \fBConformance\fP This action is an OpenFlow extension added in Open vSwitch 2.4. .UNINDENT .SH INSTRUCTIONS .sp Every version of OpenFlow includes actions. OpenFlow 1.1 introduced the higher\-level, related concept of \fBinstructions\fP\&. In OpenFlow 1.1 and later, actions within a flow are always encapsulated within an instruction. Each flow has at most one instruction of each kind, which are executed in the following fixed order defined in the OpenFlow specification: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP 1. 3 \fBMeter\fP .IP 2. 3 \fBApply\-Actions\fP .IP 3. 3 \fBClear\-Actions\fP .IP 4. 3 \fBWrite\-Actions\fP .IP 5. 3 \fBWrite\-Metadata\fP .IP 6. 3 \fBStat\-Trigger\fP (not supported by Open vSwitch) .IP 7. 3 \fBGoto\-Table\fP .UNINDENT .UNINDENT .UNINDENT .sp The most important instruction is \fBApply\-Actions\fP\&. This instruction encapsulates any number of actions, which the instruction executes. Open vSwitch does not explicitly represent \fBApply\-Actions\fP\&. Instead, any action by itself is implicitly part of an \fBApply\-Actions\fP instructions. .sp Open vSwitch syntax requires other instructions, if present, to be in the order listed above. Otherwise it will flag an error. .SS The \fBmeter\fP action and instruction .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBmeter:\fP\fImeter_id\fP .fi .sp .UNINDENT .sp Apply meter \fImeter_id\fP\&. If a meter band rate is exceeded, the packet may be dropped, or modified, depending on the meter band type. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.3 introduced the \fBmeter\fP instruction. OpenFlow 1.5 changes \fBmeter\fP from an instruction to an action. .sp OpenFlow 1.5 allows implementations to restrict \fBmeter\fP to be the first action in an action list and to exclude \fBmeter\fP from action sets, for better compatibility with OpenFlow 1.3 and 1.4. Open vSwitch restricts the \fBmeter\fP action both ways. .sp Open vSwitch 2.0 introduced OpenFlow protocol support for meters, but it did not include a datapath implementation. Open vSwitch 2.7 added meter support to the userspace datapath. Open vSwitch 2.10 added meter support to the kernel datapath. Open vSwitch 2.12 added support for meter as an action in OpenFlow 1.5. .UNINDENT .SS The \fBclear_actions\fP instruction .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBclear_actions\fP .fi .sp .UNINDENT .sp Clears the action set. See \fI\%Action Sets\fP, above, for more information. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.1 introduced \fBclear_actions\fP\&. Open vSwitch 2.1 added support for \fBclear_actions\fP\&. .UNINDENT .SS The \fBwrite_actions\fP instruction .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBwrite_actions(\fP\fIaction\fP\fB\&...)\fP .fi .sp .UNINDENT .sp Adds each \fIaction\fP to the action set. The action set is carried between flow tables and then executed at the end of the pipeline. Only certain actions may be written to the action set. See \fI\%Action Sets\fP, above, for more information. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.1 introduced \fBwrite_actions\fP\&. Open vSwitch 2.1 added support for \fBwrite_actions\fP\&. .UNINDENT .SS The \fBwrite_metadata\fP instruction .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBwrite_metadata:\fP\fIvalue\fP\fB[/\fP\fImask\fP\fB]\fP .fi .sp .UNINDENT .sp Updates the flow’s \fBmetadata\fP field. If \fImask\fP is omitted, \fBmetadata\fP is set exactly to \fIvalue\fP; if \fImask\fP is specified, then a 1\-bit in \fImask\fP indicates that the corresponding bit in \fBmetadata\fP will be replaced with the corresponding bit from \fIvalue\fP\&. Both \fIvalue\fP and \fImask\fP are 64\-bit values that are decimal by default; use a \fB0x\fP prefix to specify them in hexadecimal. .sp The \fBmetadata\fP field can also be matched in the flow table and updated with actions such as \fBset_field\fP and \fBmove\fP\&. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.1 introduced \fBwrite_metadata\fP\&. Open vSwitch 2.1 added support for \fBwrite_metadata\fP\&. .UNINDENT .SS The \fBgoto_table\fP instruction .INDENT 0.0 .TP \fBSyntax\fP: .nf \fBgoto_table:\fP\fItable\fP .fi .sp .UNINDENT .sp Jumps to \fItable\fP as the next table in the process pipeline. The table may be a number between 0 and 254 or a table name. .sp It is an error if \fItable\fP is less than or equal to the table of the flow that contains it; that is, \fBgoto_table\fP must move forward in the OpenFlow pipeline. Since \fBgoto_table\fP must be the last instruction in a flow, it never leads to recursion. The \fBresubmit\fP extension action is more flexible. .INDENT 0.0 .TP \fBConformance\fP OpenFlow 1.1 introduced \fBgoto_table\fP\&. Open vSwitch 2.1 added support for \fBgoto_table\fP\&. .UNINDENT .SH AUTHOR The Open vSwitch Development Community .SH COPYRIGHT 2016-2024, The Open vSwitch Development Community .\" Generated by docutils manpage writer. .