Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   ovs-actions    ( 7 )

действия и инструкции OpenFlow с расширениями Open vSwitch (OpenFlow actions and instructions with Open vSwitch extensions)

FIELD MODIFICATION ACTIONS

These actions modify packet data and metadata fields.

The set_field and load actions Syntax: set_field:value[/mask]->dst load:value->dst

These actions loads a literal value into a field or part of a field. The set_field action takes value in the customary syntax for field dst, e.g. 00:11:22:33:44:55 for an Ethernet address, and dst as the field's name. The optional mask allows part of a field to be set.

The load action takes value as an integer value (in decimal or prefixed by 0x for hexadecimal) and dst as a field or subfield in the syntax described under ``Field Specifications'' above.

The following all set the Ethernet source address to 00:11:22:33:44:55:

set_field:00:11:22:33:44:55->eth_src

load:0x001122334455->eth_src

load:0x001122334455->OXM_OF_ETH_SRC[]

The following all set the multicast bit in the Ethernet destination address:

set_field:01:00:00:00:00:00/01:00:00:00:00:00->eth_dst

load:1->eth_dst[40]

Open vSwitch prohibits a set_field or load action whose dst is not guaranteed to be part of the packet; for example, set_field of nw_dst 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 dst is part of the packet, and in that case if it is not then Open vSwitch treats the action as a no-op.

Conformance:

Open vSwitch 1.1 introduced NXAST_REG_LOAD as a extension to OpenFlow 1.0 and used load to express it. Later, OpenFlow 1.2 introduced a standard OFPAT_SET_FIELD action that was restricted to loading entire fields, so Open vSwitch added the form set_field with this restriction. OpenFlow 1.5 extended OFPAT_SET_FIELD to the point that it became a superset of NXAST_REG_LOAD. Open vSwitch translates either syntax as necessary for the OpenFlow version in use: in OpenFlow 1.0 and 1.1, NXAST_REG_LOAD; in OpenFlow 1.2, 1.3, and 1.4, NXAST_REG_LOAD for load or for loading a subfield, OFPAT_SET_FIELD otherwise; and OpenFlow 1.5 and later, OFPAT_SET_FIELD.

The move action Syntax: move:src->dst

Copies the named bits from field or subfield src to field or subfield dst. src and dst should fields or subfields in the syntax described under ``Field Specifications'' above. The two fields or subfields must have the same width.

Examples:

move:reg0[0..5]->reg1[26..31] copies the six bits numbered 0 through 5 in register 0 into bits 26 through 31 of register 1.

move:reg0[0..15]->vlan_tci copies the least significant 16 bits of register 0 into the VLAN TCI field.

Conformance:

In OpenFlow 1.0 through 1.4, move ordinarily uses an Open vSwitch extension to OpenFlow. In OpenFlow 1.5, move uses the OpenFlow 1.5 standard OFPAT_COPY_FIELD action. The ONF has also made OFPAT_COPY_FIELD 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, ovs-ofctl does not use it.

The mod_dl_src and mod_dl_dst actions Syntax: mod_dl_src:mac mod_dl_dst:mac

Sets the Ethernet source or destination address, respectively, to mac, which should be expressed in the form xx:xx:xx:xx:xx:xx.

For L3-only packets, that is, those that lack an Ethernet header, this action has no effect.

Conformance:

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 OFPAT_SET_FIELD actions for those versions,

The mod_nw_src and mod_nw_dst actions Syntax: mod_nw_src:ip mod_nw_dst:ip

Sets the IPv4 source or destination address, respectively, to ip, which should be expressed in the form w.x.y.z.

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. pop_mpls:0x0800). See ``Inconsistencies'', above, for more information.

Conformance:

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 OFPAT_SET_FIELD actions for those versions,

The mod_nw_tos and mod_nw_ecn actions Syntax: mod_nw_tos:tos mod_nw_ecn:ecn

The mod_nw_tos action sets the DSCP bits in the IPv4 ToS/DSCP or IPv6 traffic class field to tos, 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).

The mod_nw_ecn action sets the ECN bits in the IPv4 ToS or IPv6 traffic class field to ecn, 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).

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 ``Inconsistencies'', above, for more information.

Conformance:

OpenFlow 1.0 has a mod_nw_tos action but not mod_nw_ecn. Open vSwitch implements the latter in OpenFlow 1.0 as an extension using NXAST_REG_LOAD. OpenFlow 1.1 has specialized actions for these purposes. OpenFlow 1.2 and later do not, so Open vSwitch translates them to appropriate OFPAT_SET_FIELD actions for those versions,

The mod_tp_src and mod_tp_dst actions Syntax: mod_tp_src:port mod_tp_dst:port

Sets the TCP or UDP or SCTP source or destination port, respectively, to port. Both IPv4 and IPv6 are supported.

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 ``Inconsistencies'', above, for more information.

Conformance:

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 OFPAT_SET_FIELD actions for those versions,

The dec_ttl action Syntax: dec_ttl dec_ttl(id1, [id2]...)

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 ``packet-in'' message with reason code OFPR_INVALID_TTL 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 resubmit, the remaining actions in outer levels resume processing.)

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.

Sets the TCP or UDP or SCTP source or destination port, respectively, to port. Both IPv4 and IPv6 are supported.

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 ``Inconsistencies'', above, for more information.

Conformance:

All versions of OpenFlow and Open vSwitch support this action.

The set_mpls_label, set_mpls_tc, and set_mpls_ttl actions Syntax: set_mpls_label:label set_mpls_tc:tc set_mpls_ttl:ttl

The set_mpls_label action sets the label of the packet's outer MPLS label stack entry. label should be a 20-bit value that is decimal by default; use a 0x prefix to specify the value in hexadecimal.

The set_mpls_tc action sets the traffic class of the packet's outer MPLS label stack entry. tc should be in the range 0 to 7, inclusive.

The set_mpls_ttl action sets the TTL of the packet's outer MPLS label stack entry. ttl 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. push_mpls:0x8847). See ``Inconsistencies'', above, for more information.

Conformance:

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 OFPAT_SET_FIELD actions for those versions,

The dec_mpls_ttl and dec_nsh_ttl actions Syntax: dec_mpls_ttl dec_nsh_ttl

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 ``packet-in'' message with reason code BOFPR_INVALID_TTL 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 resubmit, remaining actions in outer levels resume processing.)

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 ``Inconsistencies'', above, for more information.

Conformance:

Open vSwitch 1.11 introduced support for MPLS. OpenFlow 1.1 and later support dec_mpls_ttl. Open vSwitch implements dec_mpls_ttl as an extension to OpenFlow 1.0.

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 dec_nsh_ttl action and NSH support in general is an Open vSwitch extension not supported by any version of OpenFlow.

The check_pkt_larger action Syntax: check_pkt_larger(pkt_len)->dst

Checks if the packet is larger than the specified length in pkt_len. If so, stores 1 in dst, which should be a 1-bit field; if not, stores 0.

The packet length to check against the argument pkt_len includes the L2 header and L2 payload of the packet, but not the VLAN tag (if present).

Examples:

check_pkt_larger(1500)->reg0[0]

check_pkt_larger(8000)->reg9[10]

This action was added in Open vSwitch 2.11.90.

The delete_field action Syntax: delete_field:field

The delete_field action deletes a field in the syntax described under ``Field Specifications'' above. Currently, only the tun_metadta fields are supported.

This action was added in Open vSwitch 2.13.90.