]> git.proxmox.com Git - mirror_ovs.git/commit
ofp-actions: Fix variable length meta-flow OXMs.
authorYi-Hung Wei <yihung.wei@gmail.com>
Fri, 20 Jan 2017 23:12:21 +0000 (15:12 -0800)
committerJoe Stringer <joe@ovn.org>
Wed, 1 Feb 2017 21:05:34 +0000 (13:05 -0800)
commit04f48a68c42851348ad0ff6105c79b32f26c050a
treecc0d424c83e34a3bc66b5d8ea8acfc5780b4b011
parentdc2dab6e6de50a6b6ef25eb2cf761fae3a3a33a7
ofp-actions: Fix variable length meta-flow OXMs.

Previously, if a flow action that involves a tunnel metadata meta-flow
field is dumped from vswitchd, the replied field length in the OXM header
is filled with the maximum possible field length, instead of the length
configured in the tunnel TLV mapping table. To solve this issue, this patch
introduces the following changes.

In order to maintain the correct length of variable length mf_fields (i.e.
tun_metadata), this patch creates a per-switch based map (struct vl_mff_map)
that hosts the variable length mf_fields. This map is updated when a
controller adds/deletes tlv-mapping entries to/from a switch. Although the
per-swtch based vl_mff_map only hosts tun_metadata for now, it is able to
support new variable length mf_fields in the future.

With this commit, when a switch decodes a flow action with mf_field, the switch
firstly looks up the global mf_fields map to identify the mf_field type. For
the variable length mf_fields, the switch uses the vl_mff_map to get the
configured mf_field entries. By lookig up vl_mff_map, the switch can check
if the added flow action access beyond the configured size of a variable
length mf_field, and the switch reports an ofperr if the controller adds a flow
with unmapped variable length mf_field. Later on, when a controller request
flows from the switch, with the per-switch based mf_fields, the switch will
encode the OXM header with correct length for variable length mf_fields.

To use the vl_mff_map for decoding flow actions, extract-ofp-actions is
updated to pass the vl_mff_map to the required action decoding functions.
Also, a new error code is introduced to identify a flow with an invalid
variable length mf_field. Moreover, a testcase is added to prevent future
regressions.

Committer notes:
 - Factor out common code
 - Style fixups
 - Rename OFPERR_NXFMFC_INVALID_VL_MFF -> OFPERR_NXFMFC_INVALID_TLV_FIELD

VMWare-BZ: #1768370
Reported-by: Harold Lim <haroldl@vmware.com>
Suggested-by: Joe Stringer <joe@ovn.org>
Suggested-by: Jarno Rajahalme <jarno@ovn.org>
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
17 files changed:
build-aux/extract-ofp-actions
build-aux/extract-ofp-fields
include/openvswitch/meta-flow.h
include/openvswitch/ofp-actions.h
include/openvswitch/ofp-errors.h
include/openvswitch/ofp-util.h
lib/meta-flow.c
lib/nx-match.c
lib/nx-match.h
lib/ofp-actions.c
lib/ofp-print.c
lib/ofp-util.c
ofproto/ofproto-provider.h
ofproto/ofproto.c
ovn/controller/pinctrl.c
tests/ofproto.at
utilities/ovs-ofctl.c