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);