From patchwork Tue Apr 30 23:27:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1093506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tyPf1LhGz9s5c for ; Wed, 1 May 2019 09:28:05 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 28CE91E10; Tue, 30 Apr 2019 23:28:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 88BAD1C5A for ; Tue, 30 Apr 2019 23:27:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E44345F4 for ; Tue, 30 Apr 2019 23:27:36 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from sigill.benpfaff.org (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 0A13F1C0004; Tue, 30 Apr 2019 23:27:33 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 30 Apr 2019 16:27:19 -0700 Message-Id: <20190430232728.31093-1-blp@ovn.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 01/10] ofp-actions: Make encap action really require OF1.3+. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This action is only supported in OpenFlow 1.3 and later, but the parser from text allowed it in earlier versions, which could cause confusion, e.g.: $ ovs-ofctl parse-flow 'actions=encap(ethernet())' usable protocols: any chosen protocol: OpenFlow10-table_id 2019-04-30T20:19:59Z|00001|ofp_actions|WARN|unknown OpenFlow10 action for vendor 0x2320 and type 46 2019-04-30T20:19:59Z|00002|ofp_actions|WARN|bad action at offset 0 (OFPBAC_BAD_VENDOR_TYPE): 00000000 ff ff 00 10 00 00 23 20-00 2e 00 00 00 00 00 00 OFPT_FLOW_MOD (xid=0x1): ***decode error: OFPBAC_BAD_VENDOR_TYPE*** 00000000 01 0e 00 58 00 00 00 01-00 38 20 ff 00 00 00 00 |...X.....8 .....| 00000010 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |................| 00000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 80 00 |................| 00000040 ff ff ff ff ff ff 00 00-ff ff 00 10 00 00 23 20 |..............# | 00000050 00 2e 00 00 00 00 00 00- |........ | Signed-off-by: Ben Pfaff Acked-by: Numan Siddique for the patches - 1 to 8 of --- lib/ofp-actions.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 1a24063d087c..182277da85cb 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -4430,6 +4430,8 @@ parse_ed_props(const uint16_t prop_class, char **arg, int *n_props, struct ofpbu static char * OVS_WARN_UNUSED_RESULT parse_ENCAP(char *arg, const struct ofpact_parse_params *pp) { + *pp->usable_protocols &= OFPUTIL_P_OF13_UP; + struct ofpact_encap *encap; char *key, *value, *str; char *error = NULL; From patchwork Tue Apr 30 23:27:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1093507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tyQF2g6cz9s5c for ; Wed, 1 May 2019 09:28:37 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 05D3E1E57; Tue, 30 Apr 2019 23:28:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 61F871C5A for ; Tue, 30 Apr 2019 23:27:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C98EC5F4 for ; Tue, 30 Apr 2019 23:27:37 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from sigill.benpfaff.org (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 6D08E1C0002; Tue, 30 Apr 2019 23:27:35 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 30 Apr 2019 16:27:20 -0700 Message-Id: <20190430232728.31093-2-blp@ovn.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190430232728.31093-1-blp@ovn.org> References: <20190430232728.31093-1-blp@ovn.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 02/10] ofp-actions: Make decap action format output match parsed input. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The action expects 'type' as a parameter name so it should use 'type' when it formats actions too. Signed-off-by: Ben Pfaff --- lib/ofp-actions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 182277da85cb..c2cef769e839 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -4625,7 +4625,7 @@ format_DECAP(const struct ofpact_decap *a, { ds_put_format(fp->s, "%sdecap(%s", colors.paren, colors.end); if (a->new_pkt_type != htonl(PT_USE_NEXT_PROTO)) { - ds_put_format(fp->s, "packet_type(ns=%"PRIu16",id=%#"PRIx16")", + ds_put_format(fp->s, "packet_type(ns=%"PRIu16",type=%#"PRIx16")", pt_ns(a->new_pkt_type), pt_ns_type(a->new_pkt_type)); } From patchwork Tue Apr 30 23:27:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1093508 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tyQv625Rz9s5c for ; Wed, 1 May 2019 09:29:11 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id DACD51F4C; Tue, 30 Apr 2019 23:28:22 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id AE9901C5A for ; Tue, 30 Apr 2019 23:27:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2ECE45F4 for ; Tue, 30 Apr 2019 23:27:38 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from sigill.benpfaff.org (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id D85381C0006; Tue, 30 Apr 2019 23:27:36 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 30 Apr 2019 16:27:21 -0700 Message-Id: <20190430232728.31093-3-blp@ovn.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190430232728.31093-1-blp@ovn.org> References: <20190430232728.31093-1-blp@ovn.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 03/10] ofp-actions: Enforce minimum length for packet truncation during parsing. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Otherwise, specifying something like output(port=1,max_len=5) would parse OK and then cause a failure when it was received by the switch. Signed-off-by: Ben Pfaff --- lib/ofp-actions.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index c2cef769e839..405b7c7eff81 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -640,6 +640,12 @@ parse_truncate_subfield(const char *arg_, if (err) { return err; } + + if (output_trunc->max_len < ETH_HEADER_LEN) { + return xasprintf("max_len %"PRIu32" is less than the minimum " + "value %d", + output_trunc->max_len, ETH_HEADER_LEN); + } } else { return xasprintf("invalid key '%s' in output_trunc argument", key); From patchwork Tue Apr 30 23:27:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1093510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tyRX4JyKz9s5c for ; Wed, 1 May 2019 09:29:44 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id BBF481F4A; Tue, 30 Apr 2019 23:28:23 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id EEC571C5A for ; Tue, 30 Apr 2019 23:27:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id CE4BD5F4 for ; Tue, 30 Apr 2019 23:27:40 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from sigill.benpfaff.org (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 479721C0004; Tue, 30 Apr 2019 23:27:37 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 30 Apr 2019 16:27:22 -0700 Message-Id: <20190430232728.31093-4-blp@ovn.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190430232728.31093-1-blp@ovn.org> References: <20190430232728.31093-1-blp@ovn.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 04/10] ofp-actions: Improve error messages for verification failures in parsing. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Verification can fail for a variety of reasons but the code here always reported "Incorrect instruction ordering". Signed-off-by: Ben Pfaff --- lib/ofp-actions.c | 90 ++++++++++++++++++++++++++++----------------- tests/classifier.at | 6 +-- 2 files changed, 59 insertions(+), 37 deletions(-) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 405b7c7eff81..10026ab5c95d 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017 Nicira, Inc. + * Copyright (c) 2008-2017, 2019 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -408,7 +408,8 @@ static void pad_ofpat(struct ofpbuf *openflow, size_t start_ofs); static enum ofperr ofpacts_verify(const struct ofpact[], size_t ofpacts_len, uint32_t allowed_ovsinsts, - enum ofpact_type outer_action); + enum ofpact_type outer_action, + char **errorp); static void put_set_field(struct ofpbuf *openflow, enum ofp_version, enum mf_field_id, uint64_t value); @@ -7683,7 +7684,7 @@ ofpacts_pull_openflow_actions__(struct ofpbuf *openflow, ofpacts_tlv_bitmap, ofpacts); if (!error) { error = ofpacts_verify(ofpacts->data, ofpacts->size, allowed_ovsinsts, - outer_action); + outer_action, NULL); } if (error) { ofpbuf_clear(ofpacts); @@ -8344,7 +8345,7 @@ ofpacts_pull_openflow_instructions(struct ofpbuf *openflow, } error = ofpacts_verify(ofpacts->data, ofpacts->size, - (1u << N_OVS_INSTRUCTIONS) - 1, 0); + (1u << N_OVS_INSTRUCTIONS) - 1, 0, NULL); exit: if (error) { ofpbuf_clear(ofpacts); @@ -8505,11 +8506,28 @@ ofpact_get_mf_dst(const struct ofpact *ofpact) return NULL; } +static void OVS_PRINTF_FORMAT(2, 3) +verify_error(char **errorp, const char *format, ...) +{ + va_list args; + va_start(args, format); + char *error = xvasprintf(format, args); + va_end(args); + + if (errorp) { + *errorp = error; + } else { + VLOG_WARN("%s", error); + free(error); + } +} + static enum ofperr -unsupported_nesting(enum ofpact_type action, enum ofpact_type outer_action) +unsupported_nesting(enum ofpact_type action, enum ofpact_type outer_action, + char **errorp) { - VLOG_WARN("%s action doesn't support nested action %s", - ofpact_name(outer_action), ofpact_name(action)); + verify_error(errorp, "%s action doesn't support nested action %s", + ofpact_name(outer_action), ofpact_name(action)); return OFPERR_OFPBAC_BAD_ARGUMENT; } @@ -8521,17 +8539,19 @@ field_requires_ct(enum mf_field_id field) /* Apply nesting constraints for actions */ static enum ofperr -ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action) +ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action, + char **errorp) { const struct mf_field *field = ofpact_get_mf_dst(a); if (field && field_requires_ct(field->id) && outer_action != OFPACT_CT) { - VLOG_WARN("cannot set CT fields outside of ct action"); + verify_error(errorp, "cannot set CT fields outside of ct action"); return OFPERR_OFPBAC_BAD_SET_ARGUMENT; } if (a->type == OFPACT_NAT) { if (outer_action != OFPACT_CT) { - VLOG_WARN("Cannot have NAT action outside of \"ct\" action"); + verify_error(errorp, + "Cannot have NAT action outside of \"ct\" action"); return OFPERR_OFPBAC_BAD_SET_ARGUMENT; } return 0; @@ -8543,10 +8563,11 @@ ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action) if (outer_action == OFPACT_CT) { if (!field) { - return unsupported_nesting(a->type, outer_action); + return unsupported_nesting(a->type, outer_action, errorp); } else if (!field_requires_ct(field->id)) { - VLOG_WARN("%s action doesn't support nested modification " - "of %s", ofpact_name(outer_action), field->name); + verify_error(errorp, + "%s action doesn't support nested modification " + "of %s", ofpact_name(outer_action), field->name); return OFPERR_OFPBAC_BAD_ARGUMENT; } } @@ -8566,7 +8587,8 @@ ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action) * within another action of type 'outer_action'. */ static enum ofperr ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len, - uint32_t allowed_ovsinsts, enum ofpact_type outer_action) + uint32_t allowed_ovsinsts, enum ofpact_type outer_action, + char **errorp) { const struct ofpact *a; enum ovs_instruction_type inst; @@ -8579,17 +8601,17 @@ ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len, if (a->type == OFPACT_CONJUNCTION) { OFPACT_FOR_EACH (a, ofpacts, ofpacts_len) { if (a->type != OFPACT_CONJUNCTION && a->type != OFPACT_NOTE) { - VLOG_WARN("\"conjunction\" actions may be used along with " - "\"note\" but not any other kind of action " - "(such as the \"%s\" action used here)", - ofpact_name(a->type)); + verify_error(errorp, "\"conjunction\" actions may be used " + "along with \"note\" but not any other kind " + "of action (such as the \"%s\" action used " + "here)", ofpact_name(a->type)); return OFPERR_NXBAC_BAD_CONJUNCTION; } } return 0; } - error = ofpacts_verify_nested(a, outer_action); + error = ofpacts_verify_nested(a, outer_action, errorp); if (error) { return error; } @@ -8603,19 +8625,20 @@ ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len, const char *next_name = ovs_instruction_name_from_type(next); if (next == inst) { - VLOG_WARN("duplicate %s instruction not allowed, for OpenFlow " - "1.1+ compatibility", name); + verify_error(errorp, "duplicate %s instruction not allowed, " + "for OpenFlow 1.1+ compatibility", name); } else { - VLOG_WARN("invalid instruction ordering: %s must appear " - "before %s, for OpenFlow 1.1+ compatibility", - next_name, name); + verify_error(errorp, "invalid instruction ordering: " + "%s must appear before %s, " + "for OpenFlow 1.1+ compatibility", + next_name, name); } return OFPERR_OFPBAC_UNSUPPORTED_ORDER; } if (!((1u << next) & allowed_ovsinsts)) { const char *name = ovs_instruction_name_from_type(next); - VLOG_WARN("%s instruction not allowed here", name); + verify_error(errorp, "%s instruction not allowed here", name); return OFPERR_OFPBIC_UNSUP_INST; } @@ -9141,7 +9164,6 @@ ofpacts_parse__(char *str, const struct ofpact_parse_params *pp, bool allow_instructions, enum ofpact_type outer_action) { int prev_inst = -1; - enum ofperr retval; char *key, *value; bool drop = false; char *pos; @@ -9206,13 +9228,15 @@ ofpacts_parse__(char *str, const struct ofpact_parse_params *pp, "or instruction"); } - retval = ofpacts_verify(pp->ofpacts->data, pp->ofpacts->size, - (allow_instructions - ? (1u << N_OVS_INSTRUCTIONS) - 1 - : 1u << OVSINST_OFPIT11_APPLY_ACTIONS), - outer_action); - if (retval) { - return xstrdup("Incorrect instruction ordering"); + char *error = NULL; + ofpacts_verify(pp->ofpacts->data, pp->ofpacts->size, + (allow_instructions + ? (1u << N_OVS_INSTRUCTIONS) - 1 + : ((1u << OVSINST_OFPIT11_APPLY_ACTIONS) + | (1u << OVSINST_OFPIT13_METER))), + outer_action, &error); + if (error) { + return error; } return NULL; diff --git a/tests/classifier.at b/tests/classifier.at index 86f872db6bff..88818618bea8 100644 --- a/tests/classifier.at +++ b/tests/classifier.at @@ -297,12 +297,10 @@ AT_CHECK([ovs-ofctl add-flow br0 'actions=conjunction(3,1/2),note:41.42.43.44.45 AT_CHECK([ovs-ofctl add-flow br0 'actions=note:41.42.43.44.45.46,conjunction(3,1/2)']) # It's not OK to use "conjunction" actions with other types of actions. AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' add-flow br0 'actions=output:1,conjunction(3,1/2)'], [1], [], [dnl -ofp_actions|WARN|"conjunction" actions may be used along with "note" but not any other kind of action (such as the "output" action used here) -ovs-ofctl: Incorrect instruction ordering +ovs-ofctl: "conjunction" actions may be used along with "note" but not any other kind of action (such as the "output" action used here) ]) AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' add-flow br0 'actions=conjunction(3,1/2),output:1'], [1], [], [dnl -ofp_actions|WARN|"conjunction" actions may be used along with "note" but not any other kind of action (such as the "output" action used here) -ovs-ofctl: Incorrect instruction ordering +ovs-ofctl: "conjunction" actions may be used along with "note" but not any other kind of action (such as the "output" action used here) ]) OVS_VSWITCHD_STOP AT_CLEANUP From patchwork Tue Apr 30 23:27:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1093511 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tyS63nTNz9s6w for ; Wed, 1 May 2019 09:30:14 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 96C2B1F3C; Tue, 30 Apr 2019 23:28:24 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C68161C5A for ; Tue, 30 Apr 2019 23:27:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 37C6E5F4 for ; Tue, 30 Apr 2019 23:27:41 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from sigill.benpfaff.org (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id DF4F11C0002; Tue, 30 Apr 2019 23:27:39 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 30 Apr 2019 16:27:23 -0700 Message-Id: <20190430232728.31093-5-blp@ovn.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190430232728.31093-1-blp@ovn.org> References: <20190430232728.31093-1-blp@ovn.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 05/10] ofp-actions: Eliminate redundant error messages from ofpacts_parse__(). X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org These duplicate messages emitted by ofpacts_verify(), so drop them. These were previously useful because ofpacts_verify()'s error messages were not as good as those emitted by ofpacts_parse__(), but that's been fixed now. Signed-off-by: Ben Pfaff --- lib/ofp-actions.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 10026ab5c95d..6efa0accf473 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -9163,20 +9163,17 @@ static char * OVS_WARN_UNUSED_RESULT ofpacts_parse__(char *str, const struct ofpact_parse_params *pp, bool allow_instructions, enum ofpact_type outer_action) { - int prev_inst = -1; char *key, *value; bool drop = false; char *pos; pos = str; while (ofputil_parse_key_value(&pos, &key, &value)) { - enum ovs_instruction_type inst = OVSINST_OFPIT11_APPLY_ACTIONS; enum ofpact_type type; char *error = NULL; ofp_port_t port; if (ofpact_type_from_name(key, &type)) { error = ofpact_parse(type, value, pp); - inst = ovs_instruction_type_from_ofpact_type(type); } else if (!strcasecmp(key, "mod_vlan_vid")) { error = parse_set_vlan_vid(value, true, pp); } else if (!strcasecmp(key, "mod_vlan_pcp")) { @@ -9203,24 +9200,6 @@ ofpacts_parse__(char *str, const struct ofpact_parse_params *pp, if (error) { return error; } - - if (inst != OVSINST_OFPIT11_APPLY_ACTIONS) { - if (!allow_instructions) { - return xasprintf("only actions are allowed here (not " - "instruction %s)", - ovs_instruction_name_from_type(inst)); - } - if (inst == prev_inst) { - return xasprintf("instruction %s may be specified only once", - ovs_instruction_name_from_type(inst)); - } - } - if (prev_inst != -1 && inst < prev_inst) { - return xasprintf("instruction %s must be specified before %s", - ovs_instruction_name_from_type(inst), - ovs_instruction_name_from_type(prev_inst)); - } - prev_inst = inst; } if (drop && pp->ofpacts->size) { From patchwork Tue Apr 30 23:27:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1093514 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tySf5dt0z9s5c for ; Wed, 1 May 2019 09:30:42 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 805CC1F3D; Tue, 30 Apr 2019 23:28:25 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 371CF1C5A for ; Tue, 30 Apr 2019 23:27:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id A3ADB5F4 for ; Tue, 30 Apr 2019 23:27:43 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from sigill.benpfaff.org (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 5214B1C0006; Tue, 30 Apr 2019 23:27:41 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 30 Apr 2019 16:27:24 -0700 Message-Id: <20190430232728.31093-6-blp@ovn.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190430232728.31093-1-blp@ovn.org> References: <20190430232728.31093-1-blp@ovn.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 06/10] ofp-actions: Improve a few error messages. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Signed-off-by: Ben Pfaff --- lib/multipath.c | 4 ++-- lib/ofp-actions.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/multipath.c b/lib/multipath.c index 43a3d8f30466..6896f94a1e2b 100644 --- a/lib/multipath.c +++ b/lib/multipath.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, 2012, 2013, 2014, 2016, 2017 Nicira, Inc. + * Copyright (c) 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2019 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -202,7 +202,7 @@ multipath_parse__(struct ofpact_multipath *mp, const char *s_, char *s) } if (!mf_nxm_header(mp->dst.field->id)) { return xasprintf("%s: experimenter OXM field '%s' not supported", - s, dst); + s_, dst); } if (mp->dst.n_bits < 16 && n_links > (1u << mp->dst.n_bits)) { return xasprintf("%s: %d-bit destination field has %u possible " diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 6efa0accf473..cabd5a05e1f4 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -4881,7 +4881,7 @@ parse_RESUBMIT(char *arg, const struct ofpact_parse_params *pp) if (resubmit->in_port == OFPP_IN_PORT && resubmit->table_id == 255) { return xstrdup("at least one \"in_port\" or \"table\" must be " - "specified on resubmit"); + "specified on resubmit"); } return NULL; } From patchwork Tue Apr 30 23:27:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1093515 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tyT80KX7z9s6w for ; Wed, 1 May 2019 09:31:07 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 655E81F62; Tue, 30 Apr 2019 23:28:26 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 04A1D1C5A for ; Tue, 30 Apr 2019 23:27:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 323A05F4 for ; Tue, 30 Apr 2019 23:27:44 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from sigill.benpfaff.org (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id C06181C0008; Tue, 30 Apr 2019 23:27:42 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 30 Apr 2019 16:27:25 -0700 Message-Id: <20190430232728.31093-7-blp@ovn.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190430232728.31093-1-blp@ovn.org> References: <20190430232728.31093-1-blp@ovn.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 07/10] ovs-ofctl: New testing command "parse-group". X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This will be used in an upcoming test. Signed-off-by: Ben Pfaff --- lib/ofp-group.c | 5 ++++- utilities/ovs-ofctl.c | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/lib/ofp-group.c b/lib/ofp-group.c index da5ff5848ccf..b675e802c317 100644 --- a/lib/ofp-group.c +++ b/lib/ofp-group.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017 Nicira, Inc. + * Copyright (c) 2008-2017, 2019 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -2014,6 +2014,8 @@ ofputil_encode_ofp11_group_mod(enum ofp_version ofp_version, ogm->type = gm->type; ogm->group_id = htonl(gm->group_id); + ofpmsg_update_length(b); + return b; } @@ -2080,6 +2082,7 @@ ofputil_encode_ofp15_group_mod(enum ofp_version ofp_version, } id_pool_destroy(bucket_ids); + ofpmsg_update_length(b); return b; } diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 63620e4fb331..754629d3dfbb 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017 Nicira, Inc. + * Copyright (c) 2008-2017, 2019 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -4175,6 +4175,44 @@ ofctl_parse_flows(struct ovs_cmdl_context *ctx) free(fms); } +/* "parse-group GROUP": parses the argument as a group (like add-group) and + * prints it back to stdout. */ +static void +ofctl_parse_group(struct ovs_cmdl_context *ctx) +{ + enum ofputil_protocol usable_protocols; + struct ofputil_group_mod gm; + char *error = parse_ofp_group_mod_str(&gm, OFPGC11_ADD, ctx->argv[1], NULL, + NULL, &usable_protocols); + if (error) { + ovs_fatal(0, "%s", error); + } + + char *usable_s = ofputil_protocols_to_string(usable_protocols); + printf("usable protocols: %s\n", usable_s); + free(usable_s); + + if (!(usable_protocols & allowed_protocols)) { + ovs_fatal(0, "no usable protocol"); + } + enum ofputil_protocol protocol = 0; + for (int i = 0; i < sizeof(enum ofputil_protocol) * CHAR_BIT; i++) { + protocol = 1 << i; + if (protocol & usable_protocols & allowed_protocols) { + break; + } + } + + enum ofp_version version = ofputil_protocol_to_ofp_version(protocol); + printf("chosen version: %s\n", ofputil_version_to_string(version)); + + struct ofpbuf *msg = ofputil_encode_group_mod(version, &gm, NULL, false); + ofp_print(stdout, msg->data, msg->size, NULL, NULL, verbosity); + ofpbuf_delete(msg); + + ofputil_uninit_group_mod(&gm); +} + static void ofctl_parse_nxm__(bool oxm, enum ofp_version version) { @@ -5033,6 +5071,7 @@ static const struct ovs_cmdl_command all_commands[] = { /* Undocumented commands for testing. */ { "parse-flow", NULL, 1, 1, ofctl_parse_flow, OVS_RW }, { "parse-flows", NULL, 1, 1, ofctl_parse_flows, OVS_RW }, + { "parse-group", NULL, 1, 1, ofctl_parse_group, OVS_RW }, { "parse-nx-match", NULL, 0, 0, ofctl_parse_nxm, OVS_RW }, { "parse-nxm", NULL, 0, 0, ofctl_parse_nxm, OVS_RW }, { "parse-oxm", NULL, 1, 1, ofctl_parse_oxm, OVS_RW }, From patchwork Tue Apr 30 23:27:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1093516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tyTc6Mcwz9s6w for ; Wed, 1 May 2019 09:31:32 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 382B81F65; Tue, 30 Apr 2019 23:28:27 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 40B721C5A for ; Tue, 30 Apr 2019 23:27:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id A82D85F4 for ; Tue, 30 Apr 2019 23:27:46 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from sigill.benpfaff.org (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 4E2B81C000A; Tue, 30 Apr 2019 23:27:43 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 30 Apr 2019 16:27:26 -0700 Message-Id: <20190430232728.31093-8-blp@ovn.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190430232728.31093-1-blp@ovn.org> References: <20190430232728.31093-1-blp@ovn.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 08/10] tests: Add negative tests for action and instruction parsing. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This adds a negative test for almost all of the error messages that parsing an action or instruction can produce. This commit removes now-redundant tests from multipath.at. Signed-off-by: Ben Pfaff --- tests/multipath.at | 30 ------- tests/ofp-actions.at | 209 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 209 insertions(+), 30 deletions(-) diff --git a/tests/multipath.at b/tests/multipath.at index a7c880b1b05d..fde006e63b2d 100644 --- a/tests/multipath.at +++ b/tests/multipath.at @@ -279,36 +279,6 @@ AT_CHECK([[ovstest test-multipath 'eth_src,50,iter_hash,1,0,NXM_NX_REG0[]']], #63 -> 64: disruption=0.02 (perfect=0.02); stddev/expected=0.0307 AT_CLEANUP -AT_SETUP([multipath action missing argument]) -AT_CHECK([ovs-ofctl parse-flow actions=multipath], [1], [], - [ovs-ofctl: : not enough arguments to multipath action -]) -AT_CLEANUP - -AT_SETUP([multipath action bad fields]) -AT_CHECK([ovs-ofctl parse-flow 'actions=multipath(xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]])'], [1], [], - [ovs-ofctl: xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]]: unknown fields `xyzzy' -]) -AT_CLEANUP - -AT_SETUP([multipath action bad algorithm]) -AT_CHECK([ovs-ofctl parse-flow 'actions=multipath(eth_src,50,fubar,1,0,NXM_NX_REG0[[]])'], [1], [], - [ovs-ofctl: eth_src,50,fubar,1,0,NXM_NX_REG0[[]]: unknown algorithm `fubar' -]) -AT_CLEANUP - -AT_SETUP([multipath action bad n_links]) -AT_CHECK([ovs-ofctl parse-flow 'actions=multipath(eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]])'], [1], [], - [ovs-ofctl: eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]]: n_links 0 is not in valid range 1 to 65536 -]) -AT_CLEANUP - -AT_SETUP([multipath action destination too narrow]) -AT_CHECK([ovs-ofctl parse-flow 'actions=multipath(eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]])'], [1], [], - [ovs-ofctl: eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]]: 8-bit destination field has 256 possible values, less than specified n_links 1024 -]) -AT_CLEANUP - AT_SETUP([modulo_n multipath symmetric_l3 link selection]) AT_CHECK([[ovstest test-multipath 'symmetric_l3,50,modulo_n,1,0,NXM_NX_REG0[]']], [0], [ignore]) diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at index 746af4f8adf9..f944369f4086 100644 --- a/tests/ofp-actions.at +++ b/tests/ofp-actions.at @@ -910,3 +910,212 @@ AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=set_field:2->ip_ecn'] OVS_VSWITCHD_STOP AT_CLEANUP +AT_SETUP([action parsing errors]) +bad_action () { + AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "actions=$1"], [1], [], + [ovs-ofctl: $2 +]) +} + +# output +bad_action 'output(port=xyzzy,max_len=5)' \ + "output to unknown truncate port: xyzzy" +bad_action 'output(port=all,max_len=64)' \ + "output to unsupported truncate port: all" +bad_action 'output(port=local,max_len=64,foo=bar)' \ + "invalid key 'foo' in output_trunc argument" +bad_action 'output(port=local,max_len=5)' \ + "max_len 5 is less than the minimum value 14" + +# controller +bad_action 'controller(reason=asdf)' 'unknown reason "asdf"' +bad_action 'controller(foo=bar)' 'unknown key "foo" parsing controller action' +bad_action 'controller(userdata=123x456)' \ + 'bad hex digit in `controller'\'' action `userdata'\' + +# enqueue +bad_action 'enqueue:123' \ + '"enqueue" syntax is "enqueue:PORT:QUEUE" or "enqueue(PORT,QUEUE)"' +bad_action 'enqueue:asdf:123' 'asdf: enqueue to unknown port' + +# bundle +bad_action 'bundle:123' '123: not enough arguments to bundle action' +bad_action 'bundle(symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5)' \ + "symmetric_l4,60,hrw,ofport,ports:1,2,3,4,5: missing slave delimiter, expected \`slaves' got \`ports'" +bad_action 'bundle(symmetric_l4,60,hrw,ofport,slaves:xyzzy,2,3,4,5)' \ + 'xyzzy: bad port number' +bad_action 'bundle(asymmetric_l4,60,hrw,ofport,slaves:1,2,3,4,5)' \ + "asymmetric_l4,60,hrw,ofport,slaves:1,2,3,4,5: unknown fields \`asymmetric_l4'" +bad_action 'bundle(symmetric_l4,60,hrt,ofport,slaves:1,2,3,4,5)' \ + "symmetric_l4,60,hrt,ofport,slaves:1,2,3,4,5: unknown algorithm \`hrt'" +bad_action 'bundle(symmetric_l4,60,hrw,odpport,slaves:1,2,3,4,5)' \ + "symmetric_l4,60,hrw,odpport,slaves:1,2,3,4,5: unknown slave_type \`odpport'" +bad_action 'bundle_load(symmetric_l4,60,hrw,ofport,actset_output,slaves:1,2,3,4,5)' \ + "symmetric_l4,60,hrw,ofport,actset_output,slaves:1,2,3,4,5: experimenter OXM field 'actset_output' not supported" + +# mod_vlan_vid +bad_action 'mod_vlan_vid:6000' '6000: not a valid VLAN VID' + +# mod_vlan_pcp +bad_action 'mod_vlan_pcp:8' '8: not a valid VLAN PCP' + +# push_vlan +bad_action 'push_vlan(0x1234)' '0x1234: not a valid VLAN ethertype' + +# mod_nw_tos +bad_action 'mod_nw_tos(1)' '1: not a valid TOS' + +# mod_nw_ecn +bad_action 'mod_nw_ecn(5)' '5: not a valid ECN' + +# set_field +bad_action 'set_field:1' "1: missing \`->'" +bad_action 'set_field:1->' "1->: missing field name following \`->'" +bad_action 'set_field:1->x' 'x is not a valid OXM field name' +bad_action 'set_field:1->eth_type' 'eth_type is read-only' +bad_action 'set_field:1->eth_src' '1: invalid Ethernet address' +bad_action 'set_field:0xffff->ip_dscp' '0xffff: value too large for 1-byte field ip_dscp' +bad_action 'set_field:0xff->ip_dscp' '0xff is not a valid value for field ip_dscp' + +# reg_load +bad_action 'load:xyzzy->eth_src' 'xyzzy->eth_src: cannot parse integer value' +bad_action 'load:0xff->eth_src[[1..5]]' '0xff->eth_src[[1..5]]: value 00:00:00:00:00:ff does not fit into 5 bits' + +# push/pop +bad_action 'push(eth_dst[[]]x)' 'x: trailing garbage following push or pop' + +# dec_ttl +bad_action 'dec_ttl(,)' 'dec_ttl_cnt_ids: expected at least one controller id.' + +# set_mpls_label +bad_action 'set_mpls_label' 'set_mpls_label: expected label.' + +# set_mpls_tc +bad_action 'set_mpls_tc' 'set_mpls_tc: expected tc.' + +# set_mpls_ttl +bad_action 'set_mpls_ttl' 'set_mpls_ttl: expected ttl.' + +# fin_timeout +bad_action 'fin_timeout(foo=bar)' "invalid key 'foo' in 'fin_timeout' argument" + +# encap +bad_action 'encap(,)' 'Missing encap hdr: ,' +bad_action 'encap(x(y))' 'Encap hdr not supported: y' +bad_action 'encap(nsh(type=1))' 'Invalid property: type' +bad_action 'encap(nsh(md_type))' 'Value missing for encap property' +bad_action 'encap(nsh(md_type=3))' 'invalid md_type' +bad_action 'encap(nsh(tlv(,,)))' 'Invalid NSH TLV header: ,,' + +# decap +bad_action 'decap(packet_type(x))' 'Missing packet_type attribute ns' +bad_action 'decap(packet_type(ns=99))' 'Unsupported ns value: 99' +bad_action 'decap(packet_type(ns=0))' 'Missing packet_type attribute type' +bad_action 'decap(foo=bar)' 'Invalid decap argument: foo' + +# resubmit +bad_action 'resubmit(asdf)' 'asdf: resubmit to unknown port' +bad_action 'resubmit(,asdf)' 'asdf: resubmit to unknown table' +bad_action 'resubmit(1,2,xyzzy)' 'xyzzy: unknown parameter' +bad_action 'resubmit(in_port,255)' 'at least one "in_port" or "table" must be specified on resubmit' + +# learn +bad_action 'learn(load:123->actset_output)' \ + "123->actset_output: experimenter OXM field 'actset_output' not supported" +bad_action 'learn(load:1234->eth_dst[[0..5]])' \ + '1234->eth_dst[[0..5]]: value does not fit into 6 bits' +bad_action 'learn(actset_output=0x1000)' \ + "actset_output=0x1000: experimenter OXM field 'actset_output' not supported" +bad_action 'learn(eth_type[[5]]=xyzzy)' \ + "eth_type[[5]]=xyzzy: eth_type[[5]] value xyzzy cannot be parsed as a subfield (xyzzy: unknown field \`xyzzy') or an immediate value (eth_type[[5]]=xyzzy: cannot parse integer value)" +bad_action 'learn(eth_type[[0]]=eth_type[[1..2]])' \ + 'eth_type[[0]]=eth_type[[1..2]]: bit widths of eth_type[[0]] (2) and eth_type[[1..2]] (1) differ' +bad_action 'learn(load:->)' "load: missing source before \`->' in \`->'" +bad_action 'learn(load:x)' "load: missing \`->' in \`x'" +bad_action 'learn(load:1x->foo)' "load: garbage before \`->' in \`1x->foo'" +bad_action 'learn(foo)' 'foo: unknown keyword foo' +bad_action 'learn(table=foo)' 'unknown table "foo"' +bad_action 'learn(table=255)' "table=255: table id 255 not valid for \`learn' action" +bad_action 'learn(result_dst=tcp_flags)' 'tcp_flags is read-only' +bad_action 'learn(result_dst=eth_dst)' "result_dst in 'learn' action must be a single bit" + +# conjunction +bad_action 'conjunction(1, 1/1)' 'conjunction must have at least 2 clauses' +bad_action 'conjunction(1, 1/65)' 'conjunction must have at most 64 clauses' +bad_action 'conjunction(1, 0/2)' 'clause index must be positive' +bad_action 'conjunction(1, 3/2)' \ + 'clause index must be less than or equal to number of clauses' + +# multipath +bad_action 'multipath(1,2,3,4)' \ + '1,2,3,4: not enough arguments to multipath action' +bad_action 'multipath(xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]])' \ + "xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]]: unknown fields \`xyzzy'" +bad_action 'multipath(eth_src,50,fubar,1,0,NXM_NX_REG0[[]])' \ + "eth_src,50,fubar,1,0,NXM_NX_REG0[[]]: unknown algorithm \`fubar'" +bad_action 'multipath(eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]])' \ + "eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]]: n_links 0 is not in valid range 1 to 65536" +bad_action 'multipath(eth_src,50,modulo_n,1024,0,actset_output)' \ + "eth_src,50,modulo_n,1024,0,actset_output: experimenter OXM field 'actset_output' not supported" +bad_action 'multipath(eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]])' \ + "eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]]: 8-bit destination field has 256 possible values, less than specified n_links 1024" + +# note +bad_action 'note:x' "bad hex digit in \`note' argument" + +# unroll_xlate +bad_action 'unroll_xlate' "UNROLL is an internal action that shouldn't be used via OpenFlow" + +# sample +bad_action 'sample(probability=0)' 'invalid probability value "0"' +bad_action 'sample(sampling_port=asdf)' 'asdf: unknown port' +bad_action 'sample(foo=bar)' 'invalid key "foo" in "sample" argument' +bad_action 'sample' 'non-zero "probability" must be specified on sample' + +# ct +bad_action 'ct(table=asdf)' 'unknown table asdf' +bad_action 'ct(table=255)' 'invalid table 0xff' +bad_action 'ct(foo=bar)' 'invalid argument to "ct" action: `foo'\' +bad_action 'ct(force)' '"force" flag requires "commit" flag.' + +# nat +bad_action 'nat(src=1.2.3.4x)' 'garbage (x) after nat range "1.2.3.4x" (pos: 7)' +bad_action 'nat(src=1.2.3.4-0.1.2.3)' 'invalid nat range "1.2.3.4-0.1.2.3"' +bad_action 'nat(foo=bar)' 'invalid key "foo" in "nat" argument' +bad_action 'nat(src=1.2.3.4,dst=2.3.4.5)' 'May only specify one of "src" or "dst".' +bad_action 'nat(persistent)' 'Flags allowed only with "src" or "dst".' +bad_action 'nat(src=1.2.3.4,hash,random)' 'Both "hash" and "random" are not allowed.' + +# check_pkt_larger +bad_action 'check_pkt_larger(1500)->reg0' \ + 'Only 1-bit destination field is allowed' + +# goto_table +bad_action 'goto_table:asdf' 'unknown table "asdf"' + +# nested actions +bad_action 'set_field:1234->ct_mark' \ + "cannot set CT fields outside of ct action" +bad_action 'nat' 'Cannot have NAT action outside of "ct" action' +bad_action 'ct(commit,exec(push_vlan(0x8100)))' \ + "ct action doesn't support nested action push_vlan" +bad_action 'ct(commit,exec(set_field:12:34:56:78:9a:bc->eth_dst))' \ + "ct action doesn't support nested modification of eth_dst" +bad_action 'conjunction(1, 2/3),ct_clear' \ + '"conjunction" actions may be used along with "note" but not any other kind of action (such as the "ct_clear" action used here)' + +# instructions +bad_action 'goto_table:5,goto_table:5' \ + 'duplicate goto_table instruction not allowed, for OpenFlow 1.1+ compatibility' +bad_action 'goto_table:5,clone()' \ + 'invalid instruction ordering: apply_actions must appear before goto_table, for OpenFlow 1.1+ compatibility' +AT_CHECK([ovs-ofctl parse-group 'group_id=1,type=select,bucket=actions=clear_actions'], [1], [], + [ovs-ofctl: clear_actions instruction not allowed here +]) + +# ofpacts_parse__() +bad_action 'apply_actions' 'apply_actions is the default instruction' +bad_action 'xyzzy' 'unknown action xyzzy' +bad_action 'drop,3' '"drop" must not be accompanied by any other action or instruction' + +AT_CLEANUP From patchwork Tue Apr 30 23:27:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1093517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tyV56r2Cz9s5c for ; Wed, 1 May 2019 09:31:57 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0CE041E0B; Tue, 30 Apr 2019 23:28:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C0D2D1C5A for ; Tue, 30 Apr 2019 23:27:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 4E4285F4 for ; Tue, 30 Apr 2019 23:27:48 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from sigill.benpfaff.org (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id BBC4F1C0006; Tue, 30 Apr 2019 23:27:45 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 30 Apr 2019 16:27:27 -0700 Message-Id: <20190430232728.31093-9-blp@ovn.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190430232728.31093-1-blp@ovn.org> References: <20190430232728.31093-1-blp@ovn.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 09/10] ofp-actions: Support OF1.5 meter action. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org OpenFlow 1.5 changed "meter" from an instruction to an action. This commit supports it properly. Signed-off-by: Ben Pfaff --- Documentation/topics/openflow.rst | 6 -- NEWS | 1 + include/openvswitch/ofp-actions.h | 4 +- lib/ofp-actions.c | 117 +++++++++++++++++++++--------- lib/ovs-actions.xml | 11 ++- tests/ofp-actions.at | 3 + 6 files changed, 100 insertions(+), 42 deletions(-) diff --git a/Documentation/topics/openflow.rst b/Documentation/topics/openflow.rst index b6a5c6b54920..b4e49be916be 100644 --- a/Documentation/topics/openflow.rst +++ b/Documentation/topics/openflow.rst @@ -242,12 +242,6 @@ features are listed in the previous section. (optional for OF1.5+) -* Meter action - - (EXT-379) - - (required for OF1.5+ if metering is supported) - * Port properties for pipeline fields Prototype for OVS was done during specification. diff --git a/NEWS b/NEWS index 293531db0615..43fd44bbd870 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ Post-v2.11.0 - OpenFlow: * Removed support for OpenFlow 1.6 (draft), which ONF abandoned. * New action "check_pkt_larger". + * Support for OpenFlow 1.5 "meter" action. - Userspace datapath: * ICMPv6 ND enhancements: support for match and set ND options type and reserved fields. diff --git a/include/openvswitch/ofp-actions.h b/include/openvswitch/ofp-actions.h index 436c4aadf548..792b2679d3a8 100644 --- a/include/openvswitch/ofp-actions.h +++ b/include/openvswitch/ofp-actions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017 Nicira, Inc. + * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2019 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1360,7 +1360,7 @@ enum { const char *ovs_instruction_name_from_type(enum ovs_instruction_type type); int ovs_instruction_type_from_name(const char *name); enum ovs_instruction_type ovs_instruction_type_from_ofpact_type( - enum ofpact_type); + enum ofpact_type, enum ofp_version); enum ofperr ovs_instruction_type_from_inst_type( enum ovs_instruction_type *instruction_type, const uint16_t inst_type); diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index cabd5a05e1f4..ddef3b0c8780 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -259,6 +259,9 @@ enum ofp_raw_action_type { /* NX1.0-1.4(6): struct nx_action_reg_move, ... VLMFF */ NXAST_RAW_REG_MOVE, + /* OF1.5+(29): uint32_t. */ + OFPAT_RAW15_METER, + /* ## ------------------------- ## */ /* ## Nicira extension actions. ## */ /* ## ------------------------- ## */ @@ -407,7 +410,7 @@ static void ofpacts_update_instruction_actions(struct ofpbuf *openflow, static void pad_ofpat(struct ofpbuf *openflow, size_t start_ofs); static enum ofperr ofpacts_verify(const struct ofpact[], size_t ofpacts_len, - uint32_t allowed_ovsinsts, + enum ofp_version, uint32_t allowed_ovsinsts, enum ofpact_type outer_action, char **errorp); @@ -5957,7 +5960,7 @@ parse_CLONE(char *arg, const struct ofpact_parse_params *pp) char *error; ofpbuf_pull(pp->ofpacts, sizeof *clone); - error = ofpacts_parse_copy(arg, pp, false, 0); + error = ofpacts_parse_copy(arg, pp, false, OFPACT_CLONE); /* header points to the action list */ pp->ofpacts->header = ofpbuf_push_uninit(pp->ofpacts, sizeof *clone); clone = pp->ofpacts->header; @@ -7216,14 +7219,32 @@ check_OUTPUT_TRUNC(const struct ofpact_output_trunc *a, return ofpact_check_output_port(a->port, cp->max_ports); } -/* Meter instruction. */ +/* Meter. + * + * In OpenFlow 1.3 and 1.4, "meter" is an instruction. + * In OpenFlow 1.5 and later, "meter" is an action. + * + * OpenFlow 1.5 */ + +static enum ofperr +decode_OFPAT_RAW15_METER(uint32_t meter_id, + enum ofp_version ofp_version OVS_UNUSED, + struct ofpbuf *out) +{ + struct ofpact_meter *om = ofpact_put_METER(out); + om->meter_id = meter_id; + om->provider_meter_id = UINT32_MAX; /* No provider meter ID. */ + return 0; +} static void encode_METER(const struct ofpact_meter *meter, enum ofp_version ofp_version, struct ofpbuf *out) { - if (ofp_version >= OFP13_VERSION) { + if (ofp_version == OFP13_VERSION || ofp_version == OFP14_VERSION) { instruction_put_OFPIT13_METER(out)->meter_id = htonl(meter->meter_id); + } else if (ofp_version >= OFP15_VERSION) { + put_OFPAT15_METER(out, meter->meter_id); } } @@ -7683,8 +7704,8 @@ ofpacts_pull_openflow_actions__(struct ofpbuf *openflow, error = ofpacts_decode(actions, actions_len, version, vl_mff_map, ofpacts_tlv_bitmap, ofpacts); if (!error) { - error = ofpacts_verify(ofpacts->data, ofpacts->size, allowed_ovsinsts, - outer_action, NULL); + error = ofpacts_verify(ofpacts->data, ofpacts->size, version, + allowed_ovsinsts, outer_action, NULL); } if (error) { ofpbuf_clear(ofpacts); @@ -7724,10 +7745,10 @@ ofpacts_pull_openflow_actions(struct ofpbuf *openflow, uint64_t *ofpacts_tlv_bitmap, struct ofpbuf *ofpacts) { - return ofpacts_pull_openflow_actions__(openflow, actions_len, version, - 1u << OVSINST_OFPIT11_APPLY_ACTIONS, - ofpacts, 0, vl_mff_map, - ofpacts_tlv_bitmap); + return ofpacts_pull_openflow_actions__( + openflow, actions_len, version, + (1u << OVSINST_OFPIT11_APPLY_ACTIONS) | (1u << OVSINST_OFPIT13_METER), + ofpacts, 0, vl_mff_map, ofpacts_tlv_bitmap); } /* OpenFlow 1.1 action sets. */ @@ -7981,11 +8002,14 @@ ovs_instruction_type_from_name(const char *name) } enum ovs_instruction_type -ovs_instruction_type_from_ofpact_type(enum ofpact_type type) +ovs_instruction_type_from_ofpact_type(enum ofpact_type type, + enum ofp_version version) { switch (type) { case OFPACT_METER: - return OVSINST_OFPIT13_METER; + return (version >= OFP15_VERSION + ? OVSINST_OFPIT11_APPLY_ACTIONS + : OVSINST_OFPIT13_METER); case OFPACT_CLEAR_ACTIONS: return OVSINST_OFPIT11_CLEAR_ACTIONS; case OFPACT_WRITE_ACTIONS: @@ -8080,7 +8104,7 @@ struct ovsinst_map { static const struct ovsinst_map * get_ovsinst_map(enum ofp_version version) { - /* OpenFlow 1.1 and 1.2 instructions. */ + /* OpenFlow 1.1, 1.2, and 1.5 instructions. */ static const struct ovsinst_map of11[] = { { OVSINST_OFPIT11_GOTO_TABLE, 1 }, { OVSINST_OFPIT11_WRITE_METADATA, 2 }, @@ -8090,7 +8114,7 @@ get_ovsinst_map(enum ofp_version version) { 0, -1 }, }; - /* OpenFlow 1.3+ instructions. */ + /* OpenFlow 1.3 and 1.4 instructions. */ static const struct ovsinst_map of13[] = { { OVSINST_OFPIT11_GOTO_TABLE, 1 }, { OVSINST_OFPIT11_WRITE_METADATA, 2 }, @@ -8101,7 +8125,7 @@ get_ovsinst_map(enum ofp_version version) { 0, -1 }, }; - return version < OFP13_VERSION ? of11 : of13; + return version == OFP13_VERSION || version == OFP14_VERSION ? of13 : of11; } /* Converts 'ovsinst_bitmap', a bitmap whose bits correspond to OVSINST_* @@ -8193,7 +8217,7 @@ OVS_INSTRUCTIONS static enum ofperr decode_openflow11_instructions(const struct ofp11_instruction insts[], - size_t n_insts, + size_t n_insts, enum ofp_version version, const struct ofp11_instruction *out[]) { const struct ofp11_instruction *inst; @@ -8209,6 +8233,11 @@ decode_openflow11_instructions(const struct ofp11_instruction insts[], return error; } + if (type == OVSINST_OFPIT13_METER && version >= OFP15_VERSION) { + /* "meter" is an action, not an instruction, in OpenFlow 1.5. */ + return OFPERR_OFPBIC_UNKNOWN_INST; + } + if (out[type]) { return OFPERR_OFPBIC_DUP_INST; } @@ -8271,7 +8300,7 @@ ofpacts_pull_openflow_instructions(struct ofpbuf *openflow, } error = decode_openflow11_instructions( - instructions, instructions_len / OFP11_INSTRUCTION_ALIGN, + instructions, instructions_len / OFP11_INSTRUCTION_ALIGN, version, insts); if (error) { goto exit; @@ -8344,7 +8373,7 @@ ofpacts_pull_openflow_instructions(struct ofpbuf *openflow, ogt->table_id = oigt->table_id; } - error = ofpacts_verify(ofpacts->data, ofpacts->size, + error = ofpacts_verify(ofpacts->data, ofpacts->size, version, (1u << N_OVS_INSTRUCTIONS) - 1, 0, NULL); exit: if (error) { @@ -8559,7 +8588,8 @@ ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action, if (outer_action) { ovs_assert(outer_action == OFPACT_WRITE_ACTIONS - || outer_action == OFPACT_CT); + || outer_action == OFPACT_CT + || outer_action == OFPACT_CLONE); if (outer_action == OFPACT_CT) { if (!field) { @@ -8571,6 +8601,10 @@ ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action, return OFPERR_OFPBAC_BAD_ARGUMENT; } } + + if (a->type == OFPACT_METER) { + return unsupported_nesting(a->type, outer_action, errorp); + } } return 0; @@ -8580,6 +8614,10 @@ ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action, * appropriate order as defined by the OpenFlow spec and as required by Open * vSwitch. * + * The 'version' is relevant only for error reporting: Open vSwitch enforces + * the same rules for every version of OpenFlow, but different versions require + * different error codes. + * * 'allowed_ovsinsts' is a bitmap of OVSINST_* values, in which 1-bits indicate * instructions that are allowed within 'ofpacts[]'. * @@ -8587,8 +8625,8 @@ ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action, * within another action of type 'outer_action'. */ static enum ofperr ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len, - uint32_t allowed_ovsinsts, enum ofpact_type outer_action, - char **errorp) + enum ofp_version version, uint32_t allowed_ovsinsts, + enum ofpact_type outer_action, char **errorp) { const struct ofpact *a; enum ovs_instruction_type inst; @@ -8616,7 +8654,7 @@ ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len, return error; } - next = ovs_instruction_type_from_ofpact_type(a->type); + next = ovs_instruction_type_from_ofpact_type(a->type, version); if (a > ofpacts && (inst == OVSINST_OFPIT11_APPLY_ACTIONS ? next < inst @@ -8638,8 +8676,13 @@ ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len, if (!((1u << next) & allowed_ovsinsts)) { const char *name = ovs_instruction_name_from_type(next); - verify_error(errorp, "%s instruction not allowed here", name); - return OFPERR_OFPBIC_UNSUP_INST; + if (next == OVSINST_OFPIT13_METER && version >= OFP15_VERSION) { + verify_error(errorp, "%s action not allowed here", name); + return OFPERR_OFPBAC_BAD_TYPE; + } else { + verify_error(errorp, "%s instruction not allowed here", name); + return OFPERR_OFPBIC_UNSUP_INST; + } } inst = next; @@ -8684,9 +8727,9 @@ ofpacts_put_openflow_actions(const struct ofpact ofpacts[], size_t ofpacts_len, } static enum ovs_instruction_type -ofpact_is_apply_actions(const struct ofpact *a) +ofpact_is_apply_actions(const struct ofpact *a, enum ofp_version version) { - return (ovs_instruction_type_from_ofpact_type(a->type) + return (ovs_instruction_type_from_ofpact_type(a->type, version) == OVSINST_OFPIT11_APPLY_ACTIONS); } @@ -8707,14 +8750,14 @@ ofpacts_put_openflow_instructions(const struct ofpact ofpacts[], a = ofpacts; while (a < end) { - if (ofpact_is_apply_actions(a)) { + if (ofpact_is_apply_actions(a, ofp_version)) { size_t ofs = openflow->size; instruction_put_OFPIT11_APPLY_ACTIONS(openflow); do { encode_ofpact(a, ofp_version, openflow); a = ofpact_next(a); - } while (a < end && ofpact_is_apply_actions(a)); + } while (a < end && ofpact_is_apply_actions(a, ofp_version)); ofpacts_update_instruction_actions(openflow, ofs); } else { encode_ofpact(a, ofp_version, openflow); @@ -9023,12 +9066,13 @@ ofpacts_get_meter(const struct ofpact ofpacts[], size_t ofpacts_len) const struct ofpact *a; OFPACT_FOR_EACH (a, ofpacts, ofpacts_len) { - enum ovs_instruction_type inst; - - inst = ovs_instruction_type_from_ofpact_type(a->type); if (a->type == OFPACT_METER) { return ofpact_get_METER(a)->meter_id; - } else if (inst > OVSINST_OFPIT13_METER) { + } + + enum ovs_instruction_type inst + = ovs_instruction_type_from_ofpact_type(a->type, 0); + if (inst > OVSINST_OFPIT13_METER) { break; } } @@ -9174,6 +9218,13 @@ ofpacts_parse__(char *str, const struct ofpact_parse_params *pp, ofp_port_t port; if (ofpact_type_from_name(key, &type)) { error = ofpact_parse(type, value, pp); + + if (type == OFPACT_METER && !allow_instructions) { + /* Meter is an action in OF1.5 and it's being used in a + * context where instructions aren't allowed. Therefore, + * this must be OF1.5+. */ + *pp->usable_protocols &= OFPUTIL_P_OF15_UP; + } } else if (!strcasecmp(key, "mod_vlan_vid")) { error = parse_set_vlan_vid(value, true, pp); } else if (!strcasecmp(key, "mod_vlan_pcp")) { @@ -9208,7 +9259,7 @@ ofpacts_parse__(char *str, const struct ofpact_parse_params *pp, } char *error = NULL; - ofpacts_verify(pp->ofpacts->data, pp->ofpacts->size, + ofpacts_verify(pp->ofpacts->data, pp->ofpacts->size, OFP11_VERSION, (allow_instructions ? (1u << N_OVS_INSTRUCTIONS) - 1 : ((1u << OVSINST_OFPIT11_APPLY_ACTIONS) diff --git a/lib/ovs-actions.xml b/lib/ovs-actions.xml index cfd9b81be604..93bc34b6fcf6 100644 --- a/lib/ovs-actions.xml +++ b/lib/ovs-actions.xml @@ -2787,11 +2787,20 @@ while link > max_link 1.5 changes meter from an instruction to an action.

+

+ OpenFlow 1.5 allows implementations to restrict meter to + be the first action in an action list and to exclude + meter from action sets, for better compatibility with + OpenFlow 1.3 and 1.4. Open vSwitch restricts the meter + action both ways. +

+

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. + meter support to the kernel datapath. Open vSwitch 2.12 added + support for meter as an action in OpenFlow 1.5.

diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at index f944369f4086..4893280a998f 100644 --- a/tests/ofp-actions.at +++ b/tests/ofp-actions.at @@ -792,6 +792,9 @@ AT_DATA([test-data], [dnl # actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src 0019 0018 8000090c 000000001234 00000000ffff 00000000 +# actions=meter:5 +001d 0008 00000005 + ]) sed '/^[[#&]]/d' < test-data > input.txt sed -n 's/^# //p; /^$/p' < test-data > expout From patchwork Tue Apr 30 23:27:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1093518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tyVc2x5lz9s5c for ; Wed, 1 May 2019 09:32:24 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id BC01D20FE; Tue, 30 Apr 2019 23:28:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 00AEF1C5A for ; Tue, 30 Apr 2019 23:27:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B7943711 for ; Tue, 30 Apr 2019 23:27:49 +0000 (UTC) X-Originating-IP: 66.170.99.95 Received: from sigill.benpfaff.org (unknown [66.170.99.95]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 78B1C1C0008; Tue, 30 Apr 2019 23:27:47 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Tue, 30 Apr 2019 16:27:28 -0700 Message-Id: <20190430232728.31093-10-blp@ovn.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190430232728.31093-1-blp@ovn.org> References: <20190430232728.31093-1-blp@ovn.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 10/10] OpenFlow: Enable OpenFlow 1.5 by default. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Open vSwitch now supports all OpenFlow 1.5 required features, so enable it by default. Signed-off-by: Ben Pfaff --- Documentation/faq/openflow.rst | 27 +++++++++---------- .../group-selection-method-property.txt | 16 +++++------ NEWS | 3 +++ include/openvswitch/ofp-protocol.h | 5 ++-- lib/ofp-version-opt.h | 2 +- lib/ofp-version.man | 7 +---- tests/test-vconn.c | 14 +++++----- vswitchd/vswitch.xml | 13 +++------ 8 files changed, 39 insertions(+), 48 deletions(-) diff --git a/Documentation/faq/openflow.rst b/Documentation/faq/openflow.rst index 561d793a6692..8c94891703a8 100644 --- a/Documentation/faq/openflow.rst +++ b/Documentation/faq/openflow.rst @@ -30,17 +30,18 @@ Q: What versions of OpenFlow does Open vSwitch support? A: The following table lists the versions of OpenFlow supported by each version of Open vSwitch: - =============== ===== ===== ===== ===== ===== ===== - Open vSwitch OF1.0 OF1.1 OF1.2 OF1.3 OF1.4 OF1.5 - =============== ===== ===== ===== ===== ===== ===== - 1.9 and earlier yes --- --- --- --- --- - 1.10, 1.11 yes --- (*) (*) --- --- - 2.0, 2.1 yes (*) (*) (*) --- --- - 2.2 yes (*) (*) (*) (%) (*) - 2.3, 2.4 yes yes yes yes (*) (*) - 2.5, 2.6, 2.7 yes yes yes yes (*) (*) - 2.8 yes yes yes yes yes (*) - =============== ===== ===== ===== ===== ===== ===== + ===================== ===== ===== ===== ===== ===== ===== + Open vSwitch OF1.0 OF1.1 OF1.2 OF1.3 OF1.4 OF1.5 + ===================== ===== ===== ===== ===== ===== ===== + 1.9 and earlier yes --- --- --- --- --- + 1.10, 1.11 yes --- (*) (*) --- --- + 2.0, 2.1 yes (*) (*) (*) --- --- + 2.2 yes (*) (*) (*) (%) (*) + 2.3, 2.4 yes yes yes yes (*) (*) + 2.5, 2.6, 2.7 yes yes yes yes (*) (*) + 2.8, 2.9, 2.10, 2.11 yes yes yes yes yes (*) + 2.12 yes yes yes yes yes yes + ===================== ===== ===== ===== ===== ===== ===== --- Not supported. yes Supported and enabled by default @@ -73,8 +74,6 @@ Q: What versions of OpenFlow does Open vSwitch support? could cause crashes. We don't recommend enabling it.) :doc:`/topics/openflow` tracks support for OpenFlow 1.1 and later features. - When support for OpenFlow 1.5 is solidly implemented, Open vSwitch will - enable it by default. Q: Does Open vSwitch support MPLS? @@ -476,7 +475,7 @@ Q: How does OVS divide flows among buckets in an OpenFlow "select" group? different hash function, using a Netronome extension to the OpenFlow 1.5+ group_mod message. For more information, see Documentation/group-selection-method-property.txt in the Open vSwitch - source tree. (OpenFlow 1.5 support in Open vSwitch is still experimental.) + source tree. Q: An OpenFlow "select" group isn't dividing packets evenly among the buckets. diff --git a/Documentation/group-selection-method-property.txt b/Documentation/group-selection-method-property.txt index 29e8249af6ac..0b13da908a4e 100644 --- a/Documentation/group-selection-method-property.txt +++ b/Documentation/group-selection-method-property.txt @@ -18,7 +18,7 @@ Contents 1. Introduction =============== -This text describes a Netronome Extension to (draft) OpenFlow 1.5 that allows a +This text describes a Netronome Extension to OpenFlow 1.5 that allows a controller to provide more information on the selection method for select groups. This proposal is in the form of an enhanced select group type. @@ -30,7 +30,7 @@ the OpenFlow specification. =============== A new Netronome group experimenter property is defined which provides -compatibility with the group mod message defined in draft Open Flow 1.5 +compatibility with the group mod message defined in Open Flow 1.5 (also known as ONF EXT-350) and allows parameters for the selection method of select groups to be passed by the controller. In particular it allows controllers to: @@ -60,14 +60,14 @@ enum ntr_group_mod_subtype { }; -Modifications to the group table from the controller may be done with a -OFPT_GROUP_MOD message described (draft) Open Flow 1.5. Group Entry -Message. Of relevance here is that (draft) Open Flow 1.5 group messages -have properties. +Modifications to the group table from the controller may be done with +a OFPT_GROUP_MOD message described Open Flow 1.5. Group Entry +Message. Of relevance here is that Open Flow 1.5 group messages have +properties. This proposal is defined in terms of an implementation of struct -ofp_group_prop_experimenter which is described in (draft) Open Flow 1.5. -The implementation is: +ofp_group_prop_experimenter which is described in Open Flow 1.5. The +implementation is: struct ntr_group_prop_selection_method { ovs_be16 type; /* OFPGPT_EXPERIMENTER. */ diff --git a/NEWS b/NEWS index 43fd44bbd870..dd1e01d18a94 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ Post-v2.11.0 * New option 'other_config:dpdk-socket-limit' to limit amount of hugepage memory that can be used by DPDK. - OpenFlow: + * All features required by OpenFlow 1.5 are now implemented, so + ovs-vswitchd now enables OpenFlow 1.5 by default (in addition to + OpenFlow 1.0 to 1.4). * Removed support for OpenFlow 1.6 (draft), which ONF abandoned. * New action "check_pkt_larger". * Support for OpenFlow 1.5 "meter" action. diff --git a/include/openvswitch/ofp-protocol.h b/include/openvswitch/ofp-protocol.h index 7873fdd12853..741ddc458bd2 100644 --- a/include/openvswitch/ofp-protocol.h +++ b/include/openvswitch/ofp-protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017 Nicira, Inc. + * Copyright (c) 2008-2017, 2019 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -151,7 +151,8 @@ enum ofputil_protocol ofputil_protocols_from_version_bitmap(uint32_t bitmap); (1u << OFP11_VERSION) | \ (1u << OFP12_VERSION) | \ (1u << OFP13_VERSION) | \ - (1u << OFP14_VERSION)) + (1u << OFP14_VERSION) | \ + (1u << OFP15_VERSION)) #define OFPUTIL_DEFAULT_VERSIONS OFPUTIL_SUPPORTED_VERSIONS enum ofputil_protocol ofputil_protocols_from_string(const char *s); diff --git a/lib/ofp-version-opt.h b/lib/ofp-version-opt.h index 525fd8ac41b9..f50f400d3293 100644 --- a/lib/ofp-version-opt.h +++ b/lib/ofp-version-opt.h @@ -10,7 +10,7 @@ #define OFP_VERSION_OPTION_HANDLERS \ case 'V': \ - ovs_print_version(OFP10_VERSION, OFP14_VERSION); \ + ovs_print_version(OFP10_VERSION, OFP15_VERSION); \ exit(EXIT_SUCCESS); \ \ case 'O': \ diff --git a/lib/ofp-version.man b/lib/ofp-version.man index 0e5391db72ba..301eb91152b6 100644 --- a/lib/ofp-version.man +++ b/lib/ofp-version.man @@ -27,12 +27,7 @@ by default: . .IP \(bu \fBOpenFlow14\fR, for OpenFlow 1.4. -.RE -. -.IP -Support for the following protocol versions is provided for testing -and development purposes. They are not enabled by default: . -.RS .IP \(bu \fBOpenFlow15\fR, for OpenFlow 1.5. +.RE diff --git a/tests/test-vconn.c b/tests/test-vconn.c index 73ef9a9587ab..fc8ce4a2c0e1 100644 --- a/tests/test-vconn.c +++ b/tests/test-vconn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2017 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2017, 2019 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -239,7 +239,7 @@ test_read_hello(struct ovs_cmdl_context *ctx) if (retval == sizeof hello) { enum ofpraw raw; - CHECK(hello.version, OFP14_VERSION); + CHECK(hello.version, OFP15_VERSION); CHECK(ofpraw_decode_partial(&raw, &hello, sizeof hello), 0); CHECK(raw, OFPRAW_OFPT_HELLO); CHECK(ntohs(hello.length), sizeof hello); @@ -312,7 +312,7 @@ test_send_hello(const char *type, const void *out, size_t out_size, if (retval == sizeof hello) { enum ofpraw raw; - CHECK(hello.version, OFP14_VERSION); + CHECK(hello.version, OFP15_VERSION); CHECK(ofpraw_decode_partial(&raw, &hello, sizeof hello), 0); CHECK(raw, OFPRAW_OFPT_HELLO); CHECK(ntohs(hello.length), sizeof hello); @@ -363,7 +363,7 @@ test_send_plain_hello(struct ovs_cmdl_context *ctx) const char *type = ctx->argv[1]; struct ofpbuf *hello; - hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP14_VERSION, + hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP15_VERSION, htonl(0x12345678), 0); test_send_hello(type, hello->data, hello->size, 0); ofpbuf_delete(hello); @@ -379,7 +379,7 @@ test_send_long_hello(struct ovs_cmdl_context *ctx) struct ofpbuf *hello; enum { EXTRA_BYTES = 8 }; - hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP14_VERSION, + hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP15_VERSION, htonl(0x12345678), EXTRA_BYTES); ofpbuf_put_zeros(hello, EXTRA_BYTES); ofpmsg_update_length(hello); @@ -395,7 +395,7 @@ test_send_echo_hello(struct ovs_cmdl_context *ctx) const char *type = ctx->argv[1]; struct ofpbuf *echo; - echo = ofpraw_alloc_xid(OFPRAW_OFPT_ECHO_REQUEST, OFP14_VERSION, + echo = ofpraw_alloc_xid(OFPRAW_OFPT_ECHO_REQUEST, OFP15_VERSION, htonl(0x12345678), 0); test_send_hello(type, echo->data, echo->size, EPROTO); ofpbuf_delete(echo); @@ -421,7 +421,7 @@ test_send_invalid_version_hello(struct ovs_cmdl_context *ctx) const char *type = ctx->argv[1]; struct ofpbuf *hello; - hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP14_VERSION, + hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP15_VERSION, htonl(0x12345678), 0); ((struct ofp_header *) hello->data)->version = 0; test_send_hello(type, hello->data, hello->size, EPROTO); diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 08001dbce3d3..376688ea4b90 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1248,16 +1248,9 @@ -

- List of OpenFlow protocols that may be used when negotiating - a connection with a controller. OpenFlow 1.0, 1.1, 1.2, 1.3, and - 1.4 are enabled by default if this column is empty. -

- -

- OpenFlow 1.5 is not enabled by default because its - implementations is missing features. -

+ List of OpenFlow protocols that may be used when negotiating a + connection with a controller. OpenFlow 1.0, 1.1, 1.2, 1.3, 1.4, and + 1.5 are enabled by default if this column is empty.