From patchwork Sat Jun 11 01:55:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Benli Ye X-Patchwork-Id: 634025 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3rRMcx1w1lz9syB for ; Sat, 11 Jun 2016 11:57:53 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id D3119102D5; Fri, 10 Jun 2016 18:57:51 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id BACA6101E3 for ; Fri, 10 Jun 2016 18:57:50 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 28B4A420103 for ; Fri, 10 Jun 2016 19:57:50 -0600 (MDT) X-ASG-Debug-ID: 1465610269-09eadd16ec8e350001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id CrCAZIo0CE64B4UW (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 10 Jun 2016 19:57:49 -0600 (MDT) X-Barracuda-Envelope-From: daniely@vmware.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO smtp-outbound-2.vmware.com) (208.91.2.13) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 11 Jun 2016 01:57:48 -0000 Received-SPF: error (mx1-pf1.cudamail.com: error in processing during lookup of vmware.com: DNS problem) X-Barracuda-Apparent-Source-IP: 208.91.2.13 X-Barracuda-RBL-IP: 208.91.2.13 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 4738E9804D for ; Fri, 10 Jun 2016 18:57:48 -0700 (PDT) Received: from EX13-CAS-008.vmware.com (ex13-cas-008.vmware.com [10.113.191.58]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 47151B018C for ; Fri, 10 Jun 2016 18:57:48 -0700 (PDT) Received: from EX13-MBX-031.vmware.com (10.113.191.71) by EX13-MBX-009.vmware.com (10.113.191.29) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Fri, 10 Jun 2016 18:57:48 -0700 Received: from localhost.localdomain (10.113.170.11) by EX13-MBX-031.vmware.com (10.113.191.71) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Fri, 10 Jun 2016 18:57:46 -0700 X-CudaMail-Envelope-Sender: daniely@vmware.com From: Benli Ye To: , , , , X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-609080904 X-CudaMail-DTE: 061016 X-CudaMail-Originating-IP: 208.91.2.13 Date: Sat, 11 Jun 2016 09:55:39 +0800 X-ASG-Orig-Subj: [##CM-E1-609080904##][PATCH v1] ipfix: Bug fix for not sending template packets on 32-bit OS Message-ID: <1465610139-109725-1-git-send-email-daniely@vmware.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.113.170.11] X-ClientProxiedBy: EX13-CAS-003.vmware.com (10.113.191.53) To EX13-MBX-031.vmware.com (10.113.191.71) X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1465610269 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-ASG-Whitelist: EmailCat (corporate) Cc: Benli Ye Subject: [ovs-dev] [PATCH v1] ipfix: Bug fix for not sending template packets on 32-bit OS 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" 'last_template_set_time' in truct dpif_ipfix_exporter is declared as time_t and time_t is long int type. If we initialize 'last_template_set_time' as TIME_MIN, whose value is -2147483648 on 32-bit OS and -2^63 on 64-bit OS. There will be a problem on 32-bit OS when comparing 'last_template_set_time' with a unisgned int type variable, because type casting will happen and negative value could be a large positive number. Fix this problem by simply initialize 'last_template_set_time' as 0. Acked-by: William Tu --- ofproto/ofproto-dpif-ipfix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c index 79ba234..b1b2237 100644 --- a/ofproto/ofproto-dpif-ipfix.c +++ b/ofproto/ofproto-dpif-ipfix.c @@ -495,7 +495,7 @@ dpif_ipfix_exporter_init(struct dpif_ipfix_exporter *exporter) { exporter->collectors = NULL; exporter->seq_number = 1; - exporter->last_template_set_time = TIME_MIN; + exporter->last_template_set_time = 0; hmap_init(&exporter->cache_flow_key_map); ovs_list_init(&exporter->cache_flow_start_timestamp_list); exporter->cache_active_timeout = 0; @@ -511,7 +511,7 @@ dpif_ipfix_exporter_clear(struct dpif_ipfix_exporter *exporter) collectors_destroy(exporter->collectors); exporter->collectors = NULL; exporter->seq_number = 1; - exporter->last_template_set_time = TIME_MIN; + exporter->last_template_set_time = 0; exporter->cache_active_timeout = 0; exporter->cache_max_flows = 0; }