From patchwork Fri Mar 18 17:28:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 599607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3qRXJ131phz9sBM for ; Sat, 19 Mar 2016 04:28:32 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 92ED410936; Fri, 18 Mar 2016 10:28:21 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id D5DB510930 for ; Fri, 18 Mar 2016 10:28:20 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 47C25162324 for ; Fri, 18 Mar 2016 11:28:20 -0600 (MDT) X-ASG-Debug-ID: 1458322099-0b32372761341d20001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar6.cudamail.com with ESMTP id oZQiHcB0QOW99G4n (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 18 Mar 2016 11:28:19 -0600 (MDT) X-Barracuda-Envelope-From: dan.carpenter@oracle.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO userp1040.oracle.com) (156.151.31.81) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 18 Mar 2016 17:28:18 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at spf_s.oracle.com designates 156.151.31.81 as permitted sender) X-Barracuda-Apparent-Source-IP: 156.151.31.81 X-Barracuda-RBL-IP: 156.151.31.81 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u2IHS8Ni022857 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Mar 2016 17:28:08 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u2IHS8SE015070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 18 Mar 2016 17:28:08 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u2IHS7Ax028698; Fri, 18 Mar 2016 17:28:07 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 18 Mar 2016 10:28:06 -0700 Date: Fri, 18 Mar 2016 20:28:01 +0300 X-CudaMail-Envelope-Sender: dan.carpenter@oracle.com From: Dan Carpenter To: Pravin Shelar , Pablo Neira Ayuso , Jarno Rajahalme X-CudaMail-MID: CM-E2-317052881 X-CudaMail-DTE: 031816 X-CudaMail-Originating-IP: 156.151.31.81 Message-ID: <20160318172801.GA16519@mwanda> X-ASG-Orig-Subj: [##CM-E2-317052881##][patch v2] openvswitch: using a bit shift as a mask MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: userv0021.oracle.com [156.151.31.71] X-GBUdb-Analysis: 0, 156.151.31.81, Ugly c=0.398928 p=-0.25 Source Normal X-MessageSniffer-Rules: 0-0-0-3772-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1458322099 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.10 X-Barracuda-Spam-Status: No, SCORE=0.10 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC0_MISMATCH_TO, RDNS_NONE, UNPARSEABLE_RELAY X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27953 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 BSF_SC0_MISMATCH_TO Envelope rcpt doesn't match header 0.00 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS Cc: dev@openvswitch.org, kernel-janitors@vger.kernel.org Subject: [ovs-dev] [patch v2] openvswitch: using a bit shift as a mask X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" The original condition is never true. We want to test if BIT(0) is set but the code is ANDing with zero. Fixes: 05752523e565 ('openvswitch: Interface with NAT.') Signed-off-by: Dan Carpenter --- v2: use test_bit() instead diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index dc5eb29..9c9cac0 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c @@ -668,7 +668,7 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, */ if (info->nat & OVS_CT_NAT && ctinfo != IP_CT_NEW && ct->status & IPS_NAT_MASK && - (!(ct->status & IPS_EXPECTED_BIT) || info->commit)) { + (!test_bit(IPS_EXPECTED_BIT, &ct->status) || info->commit)) { /* NAT an established or related connection like before. */ if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) /* This is the REPLY direction for a connection