From patchwork Wed Sep 5 05:14:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrell Ball X-Patchwork-Id: 966217 X-Patchwork-Delegate: jpettit@nicira.com 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UQdmtzNL"; dkim-atps=neutral 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 424sNf26y3z9s3Z for ; Wed, 5 Sep 2018 15:15:46 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 724AFC7A; Wed, 5 Sep 2018 05:15:07 +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 EF8D6C03 for ; Wed, 5 Sep 2018 05:15:05 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B39868B for ; Wed, 5 Sep 2018 05:15:05 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id h79-v6so2833565pfk.8 for ; Tue, 04 Sep 2018 22:15:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=XPoU9GWTbdDC2mdlqT2gH6MWZ6HYKTtlBGPLg6zB4dc=; b=UQdmtzNL7BtoSn7wA1k7s3uFY7ZRFIU867+xChZ1Qg5Avinx0d3J9/lH1K2beRsOk8 gq21G09j0QGWlW0eh1Q9p9vIsNyHgU/lFVwNuzglzSrWUFqYWVdDn50UXTHoaWb1FQzO yDDzW9q7fMcqXUPcKly9lPOj9076g2q8m05U+jxHXF+1ThLau8fkfzBaAUvmXhq7U5b5 6e1AvWnbYBWHSXglmZoGFAeL1q1U2mcp9Bdi5Q78bfv4bhAitsYxd17P13ifp3tFV0ut fKct6hGfrSTxWViJsaCzWJjLO20lMReuZ+yTDAAyz8vZFQpchjq4BGfrt+5hNQy5XSs/ 08zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=XPoU9GWTbdDC2mdlqT2gH6MWZ6HYKTtlBGPLg6zB4dc=; b=p+dhZ4nYCL/kIOQC77oDtBaaYKbcVQ6PG5hRJfCR0EJJDK6UhhUWLuNMIj/RSAz6j9 2sd7ThUI3ZebgxVHbTxmr3HCM1YJdpHPH8OMjqHvjMnAYSwwhw0D+8heDUVODnEgKAGz Tte7v37hGUXLWncWGlKiPUUqhPm1sF769oq4XrmMdm2BeMWSrBIdoIV5buoN6UCUVmjO fkOhGvMhWVicpCdnLNL/i7cfYBcVXG60XfGVeFNl9p/YQdvzRUQ6DM5Ov8Yszo1U+9sI d7U58iBvg9zVgrsnEA2nMddhpBZbuO26zVPKD6nBPUaUlCS+aOM4Ea85NjFBoUL0GqZf drjw== X-Gm-Message-State: APzg51Bkxu5a7o4eIRVSuuro5YIQkra5w+GQTIFlgpPSt/Q7IsODda7z XisP/x0jL25S1PT+ArCE0EE= X-Google-Smtp-Source: ANB0VdawPu7ryG+Z6oSLnBkOtSKChB2fNldtdovQhJYxV/U8xSkvDxzt6Uyw+Z1pvRgB6QX6P+9NQw== X-Received: by 2002:a65:448c:: with SMTP id l12-v6mr34958206pgq.277.1536124505404; Tue, 04 Sep 2018 22:15:05 -0700 (PDT) Received: from ubuntu.localdomain (8.sub-174-214-5.myvzw.com. [174.214.5.8]) by smtp.gmail.com with ESMTPSA id 3-v6sm1298999pfq.10.2018.09.04.22.15.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 22:15:04 -0700 (PDT) From: Darrell Ball To: dlu998@gmail.com, dev@openvswitch.org Date: Tue, 4 Sep 2018 22:14:46 -0700 Message-Id: <1536124490-86810-2-git-send-email-dlu998@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1536124490-86810-1-git-send-email-dlu998@gmail.com> References: <1536124490-86810-1-git-send-email-dlu998@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [patch v2 2/6] conntrack: Enforce conn_type in conntrack_flush_tuple(). 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: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The user should only reference a conntrack entry by the forward direction context, as per 'conntrack_flush()', enforce this by checking for 'default' conn_type. Needs backporting to 2.9. Fixes: 271e48a0e244 ("conntrack: Support conntrack flush by ct 5-tuple") Signed-off-by: Darrell Ball --- lib/conntrack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index 15984d2..4b53e82 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -2574,7 +2574,7 @@ conntrack_flush_tuple(struct conntrack *ct, const struct ct_dpif_tuple *tuple, ct_lock_lock(&ct->buckets[bucket].lock); conn_key_lookup(&ct->buckets[bucket], &ctx, time_msec()); - if (ctx.conn) { + if (ctx.conn && ctx.conn->conn_type == CT_CONN_TYPE_DEFAULT) { conn_clean(ct, ctx.conn, &ct->buckets[bucket]); } else { error = ENOENT;