summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2019-06-28 06:05:08 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2019-06-28 06:05:08 +0000
commit44a155e1887bc84b8e0d1f2619165a2672d1a898 (patch)
tree064584bb6fc9c14b18ce33ec32d750d0821cb499 /usr.sbin/smtpd
parentecd2a5a3dc3979246be55c81a942143e84c36053 (diff)
switch timestamps to use timevals in filters like we do in reporting
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/lka_filter.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/usr.sbin/smtpd/lka_filter.c b/usr.sbin/smtpd/lka_filter.c
index 94945955b7e..04f2d8a43d9 100644
--- a/usr.sbin/smtpd/lka_filter.c
+++ b/usr.sbin/smtpd/lka_filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka_filter.c,v 1.36 2019/05/02 11:39:45 martijn Exp $ */
+/* $OpenBSD: lka_filter.c,v 1.37 2019/06/28 06:05:07 gilles Exp $ */
/*
* Copyright (c) 2018 Gilles Chehade <gilles@poolp.org>
@@ -726,22 +726,23 @@ static void
filter_protocol_query(struct filter *filter, uint64_t token, uint64_t reqid, const char *phase, const char *param)
{
int n;
- time_t tm;
struct filter_session *fs;
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+
fs = tree_xget(&sessions, reqid);
- time(&tm);
if (strcmp(phase, "connect") == 0)
n = io_printf(lka_proc_get_io(filter->proc),
- "filter|%d|%zd|smtp-in|%s|%016"PRIx64"|%016"PRIx64"|%s|%s\n",
+ "filter|%d|%lld.%06ld|smtp-in|%s|%016"PRIx64"|%016"PRIx64"|%s|%s\n",
PROTOCOL_VERSION,
- tm,
+ tv.tv_sec, tv.tv_usec,
phase, reqid, token, fs->rdns, param);
else
n = io_printf(lka_proc_get_io(filter->proc),
- "filter|%d|%zd|smtp-in|%s|%016"PRIx64"|%016"PRIx64"|%s\n",
+ "filter|%d|%lld.%06ld|smtp-in|%s|%016"PRIx64"|%016"PRIx64"|%s\n",
PROTOCOL_VERSION,
- tm,
+ tv.tv_sec, tv.tv_usec,
phase, reqid, token, param);
if (n == -1)
fatalx("failed to write to processor");
@@ -751,14 +752,16 @@ static void
filter_data_query(struct filter *filter, uint64_t token, uint64_t reqid, const char *line)
{
int n;
- time_t tm;
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
- time(&tm);
n = io_printf(lka_proc_get_io(filter->proc),
- "filter|%d|%zd|smtp-in|data-line|"
+ "filter|%d|%lld.%06ld|smtp-in|data-line|"
"%016"PRIx64"|%016"PRIx64"|%s\n",
PROTOCOL_VERSION,
- tm, reqid, token, line);
+ tv.tv_sec, tv.tv_usec,
+ reqid, token, line);
if (n == -1)
fatalx("failed to write to processor");
}