summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorJoerg Goltermann <gollo@cvs.openbsd.org>2009-06-17 06:35:31 +0000
committerJoerg Goltermann <gollo@cvs.openbsd.org>2009-06-17 06:35:31 +0000
commita2ceab491fcf18b64deec13cd9f70e839f7dc719 (patch)
tree74e5fac281bfb4a020143a5837683d4b662fec69 /sys/net
parente668e3fd4236b45350755c692599868e4d1a48d6 (diff)
fix flow data values: first and last time, found by f-kons at yandex ru
OK: sthen@, henning@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_pflow.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c
index b26f5daced4..606dd4079e3 100644
--- a/sys/net/if_pflow.c
+++ b/sys/net/if_pflow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.c,v 1.10 2009/02/27 11:09:36 gollo Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.11 2009/06/17 06:35:30 gollo Exp $ */
/*
* Copyright (c) 2008 Henning Brauer <henning@openbsd.org>
@@ -356,8 +356,12 @@ copy_flow_data(struct pflow_flow *flow1, struct pflow_flow *flow2,
flow1->flow_octets = htonl(st->bytes[0]);
flow2->flow_octets = htonl(st->bytes[1]);
- flow1->flow_start = flow2->flow_start = htonl(st->creation * 1000);
- flow1->flow_finish = flow2->flow_finish = htonl(time_second * 1000);
+ flow1->flow_start = flow2->flow_start =
+ htonl((st->creation - (time_second - time_uptime)) * 1000);
+ flow1->flow_finish = flow2->flow_finish =
+ htonl((time_uptime - (st->rule.ptr->timeout[st->timeout] ?
+ st->rule.ptr->timeout[st->timeout] :
+ pf_default_rule.timeout[st->timeout])) * 1000);
flow1->tcp_flags = flow2->tcp_flags = 0;
flow1->protocol = flow2->protocol = sk->proto;
flow1->tos = flow2->tos = st->rule.ptr->tos;