diff mbox

[ovs-dev] ipfix: Update Timestamp when flow updated

Message ID 1496694678-6945-1-git-send-email-gvrose8192@gmail.com
State Superseded
Headers show

Commit Message

Gregory Rose June 5, 2017, 8:31 p.m. UTC
Reported-by: Felix Konstantin Maurer <felix.maurer@comsys.rwth-aachen.de>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 ofproto/ofproto-dpif-ipfix.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Ben Pfaff June 6, 2017, 1:08 a.m. UTC | #1
On Mon, Jun 05, 2017 at 01:31:18PM -0700, Greg Rose wrote:
> Reported-by: Felix Konstantin Maurer <felix.maurer@comsys.rwth-aachen.de>
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>

I don't see an actual problem with this, but when I looked at it I found
myself wondering why IPFIX is so special, time-wise, so I made a patch
series that makes it more like this rest of OVS:
        https://patchwork.ozlabs.org/patch/771565/
        https://patchwork.ozlabs.org/patch/771567/

(It would also be nice to add or adjust a test, but time-based tests can
be super challenging on that front.)
Gregory Rose June 6, 2017, 3:36 a.m. UTC | #2
On 06/05/2017 06:08 PM, Ben Pfaff wrote:
> On Mon, Jun 05, 2017 at 01:31:18PM -0700, Greg Rose wrote:
> > Reported-by: Felix Konstantin Maurer <felix.maurer@comsys.rwth-aachen.de>
> > Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>
> I don't see an actual problem with this, but when I looked at it I found
> myself wondering why IPFIX is so special, time-wise, so I made a patch
> series that makes it more like this rest of OVS:
>          https://patchwork.ozlabs.org/patch/771565/
>          https://patchwork.ozlabs.org/patch/771567/
>
> (It would also be nice to add or adjust a test, but time-based tests can
> be super challenging on that front.)
>
I'll look into it.

Thanks,

- Greg
diff mbox

Patch

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