[ovs-dev] [PATCH 2/2] ofp-actions: Use specific error code for oxm_hasmask=1 in Set-Field.

Jarno Rajahalme jrajahalme at nicira.com
Mon Aug 11 21:11:02 UTC 2014


Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>

On Aug 11, 2014, at 1:44 PM, Ben Pfaff <blp at nicira.com> wrote:

> Based on the OpenFlow 1.5 draft.
> 
> ONF-JIRA: EXT-425
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> lib/ofp-actions.c    |    2 +-
> lib/ofp-errors.h     |    4 ++++
> tests/ofp-actions.at |   12 +++++++++---
> 3 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
> index 8f3af19..cdcd72d 100644
> --- a/lib/ofp-actions.c
> +++ b/lib/ofp-actions.c
> @@ -1965,7 +1965,7 @@ decode_OFPAT_RAW12_SET_FIELD(const struct ofp12_action_set_field *oasf,
>     }
> 
>     if (NXM_HASMASK(oxm_header)) {
> -        return OFPERR_OFPBAC_BAD_SET_TYPE;
> +        return OFPERR_OFPBAC_BAD_SET_MASK;
>     }
>     mf = mf_from_nxm_header(oxm_header);
>     if (!mf) {
> diff --git a/lib/ofp-errors.h b/lib/ofp-errors.h
> index d5c767b..e32b751 100644
> --- a/lib/ofp-errors.h
> +++ b/lib/ofp-errors.h
> @@ -222,6 +222,10 @@ enum ofperr {
>      * unsupported value, or modifies a read-only field. */
>     OFPERR_OFPBAC_BAD_SET_ARGUMENT,
> 
> +    /* NX1.3-1.4(14), OF1.5+(2,16).  Field in Set-Field action has Has-Mask bit
> +     * set to 1. */
> +    OFPERR_OFPBAC_BAD_SET_MASK,
> +
>     /* NX1.0-1.1(2,256), NX1.2+(11).  Must-be-zero action argument had nonzero
>      * value. */
>     OFPERR_NXBAC_MUST_BE_ZERO,
> diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at
> index 569f4ae..e9bd69a 100644
> --- a/tests/ofp-actions.at
> +++ b/tests/ofp-actions.at
> @@ -502,9 +502,8 @@ AT_CHECK(
>   [0], [expout], [experr])
> AT_CLEANUP
> 
> -dnl Our primary goal here is to verify that the copy_field action gets
> -dnl used instead of the Nicira extension reg_move in OpenFlow 1.5, so
> -dnl the list of action tests is very short.
> +dnl Our primary goal here is to verify that OpenFlow 1.5-specific changes,
> +dnl so the list of tests is short.
> AT_SETUP([OpenFlow 1.5 action translation])
> AT_KEYWORDS([ofp-actions OF1.5])
> AT_DATA([test-data], [dnl
> @@ -514,6 +513,13 @@ AT_DATA([test-data], [dnl
> # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
> 001c 0018 0010 0000 0000 0008 00000002 00000802 00000000
> 
> +dnl This action has a lot more wrong with it than the hasmask bit, but
> +dnl the current OVS implementation checks for that first.
> +# bad OpenFlow15 actions: OFPBAC_BAD_SET_MASK
> +& ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_SET_MASK):
> +& 00000000  00 19 00 08 00 00 01 00-
> +0019 0008 0000 0100
> +
> ])
> sed '/^[[#&]]/d' < test-data > input.txt
> sed -n 's/^# //p; /^$/p' < test-data > expout
> -- 
> 1.7.10.4
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list