From patchwork Mon Jun 5 20:31:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 771459 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.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 3whRL83CYDz9s3w for ; Tue, 6 Jun 2017 06:31:28 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kKi6cm4Q"; dkim-atps=neutral Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 78BA0941; Mon, 5 Jun 2017 20:31: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 96CA892B for ; Mon, 5 Jun 2017 20:31:23 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 3B8C4288 for ; Mon, 5 Jun 2017 20:31:23 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id y7so3281961pfd.3 for ; Mon, 05 Jun 2017 13:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=UsQqWtbgICCE08TsVpjGIhKHLHhqd8D9QM8qQI8T3kI=; b=kKi6cm4Qu+CVF8uhRBVGhvsqdM5gKTdHGM6fEiG+5Qo9PnvyZVQlibjcNz1A0+Ac7G AC1KHHPkZM49CdaxqrttSe9YDWzXmO+bjk3qn/a9vOaC108iEReODHww5riJKvukjeO8 xGls1jrUo7KwiO3+1PkuRx++Bp+ohdnGJ4WgSOoirtF5ffNF0700ZUnq4JsjsQbfLsDz A4GSPwgo0atB72NVJUnAuUXl9f7xi7wrkBsc0XP02HwY05Ap2IvOf09UL4mI2JUzqEHT pl1Jqyu1ZZHW7527EV9lc2k12b1IU0WNql9LLFE3ymRF4sc8EPb7sM+1pqyVg3Z30tB3 5fhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=UsQqWtbgICCE08TsVpjGIhKHLHhqd8D9QM8qQI8T3kI=; b=i6p9x6FHSdg1RPXEdCUWITW/yi+i/eByEPI2+Ct31bF2R6+yQvZYTwD2p13NH0PIR0 oRnKfsXrMFaw5fYAHrRtOD9o8Pvgr5Uo+a86jyjrghdWBhotOjJoFeuXVgYUq5Jj2mDV ENm1aLH3c2N01RStM18fcmmZ6DpdmOZydefvGswUvNrtpUUWB2kitvECjoPL2diSHpkf 0r5743cvhVGyoHbJTJjtUJhf3bc45W7d8+pLFG4Rbeln9soc+uULYsldBxkl45j8mgK2 /MMvNLb5wVHLCpALAfXA657mreZm42P+QERSBqxOVZ9AcF469498s5sKhswiDgtQTkEG 7yAg== X-Gm-Message-State: AODbwcAkX3gw52D9X8nJTC5SLjcy0aCXIpy/VmgwvTrfgE7l6IFAkEkI Wr944wU5SRHm88xg X-Received: by 10.98.217.155 with SMTP id b27mr21257529pfl.17.1496694682412; Mon, 05 Jun 2017 13:31:22 -0700 (PDT) Received: from gizo.domain (67-5-137-97.ptld.qwest.net. [67.5.137.97]) by smtp.gmail.com with ESMTPSA id r126sm39379739pgr.65.2017.06.05.13.31.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jun 2017 13:31:21 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 5 Jun 2017 13:31:18 -0700 Message-Id: <1496694678-6945-1-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM 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] ipfix: Update Timestamp when flow updated 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 Reported-by: Felix Konstantin Maurer Signed-off-by: Greg Rose --- ofproto/ofproto-dpif-ipfix.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c index 23fc51b..0fec990 100644 --- a/ofproto/ofproto-dpif-ipfix.c +++ b/ofproto/ofproto-dpif-ipfix.c @@ -1602,6 +1602,16 @@ ipfix_update_stats(struct dpif_ipfix_exporter *exporter, } } +/* Update flow timestamp */ +static void +ipfix_update_timestamp(struct ipfix_flow_cache_entry *entry) +{ + struct timeval now; + + xgettimeofday(&now); + entry->flow_end_timestamp_usec = now.tv_usec + 1000000LL * now.tv_sec; +} + /* Add an entry into a flow cache. The entry is either aggregated into * an existing entry with the same flow key and free()d, or it is * inserted into the cache. And IPFIX stats will be updated */ @@ -1635,6 +1645,7 @@ ipfix_cache_update(struct dpif_ipfix_exporter *exporter, ipfix_cache_aggregate_entries(entry, old_entry); free(entry); ipfix_update_stats(exporter, false, current_flows, sampled_pkt_type); + ipfix_update_timestamp(old_entry); } }