All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
To: The netfilter developer mailinglist <netfilter-devel@vger.kernel.org>
Subject: [ulogd PATCH 12/13] nfct: introduce new out keys for ipfix timestamp
Date: Mon, 28 Apr 2014 20:56:21 +0900	[thread overview]
Message-ID: <20140428115621.GM12523@gmail.com> (raw)
In-Reply-To: <20140428113936.GA12523@gmail.com>

Signed-off-by Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
---
 input/flow/ulogd_inpflow_NFCT.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/input/flow/ulogd_inpflow_NFCT.c b/input/flow/ulogd_inpflow_NFCT.c
index 4f4301e..b31c46f 100644
--- a/input/flow/ulogd_inpflow_NFCT.c
+++ b/input/flow/ulogd_inpflow_NFCT.c
@@ -186,8 +186,10 @@ enum nfct_keys {
 	NFCT_CT_EVENT,
 	NFCT_FLOW_START_SEC,
 	NFCT_FLOW_START_USEC,
+	NFCT_FLOW_START_MCSEC,
 	NFCT_FLOW_END_SEC,
 	NFCT_FLOW_END_USEC,
+	NFCT_FLOW_END_MCSEC,
 	NFCT_OOB_FAMILY,
 	NFCT_OOB_PROTOCOL,
 	NFCT_CT,
@@ -379,6 +381,11 @@ static struct ulogd_key nfct_okeys[] = {
 		.type 	= ULOGD_RET_UINT32,
 		.flags 	= ULOGD_RETF_NONE,
 		.name	= "flow.start.usec",
+	},
+	{
+		.type 	= ULOGD_RET_UINT64,
+		.flags 	= ULOGD_RETF_NONE,
+		.name	= "flow.start.mcsec",
 		.ipfix	= {
 			.vendor		= IPFIX_VENDOR_IETF,
 			.field_id	= IPFIX_flowStartMicroSeconds,
@@ -397,6 +404,11 @@ static struct ulogd_key nfct_okeys[] = {
 		.type	= ULOGD_RET_UINT32,
 		.flags	= ULOGD_RETF_NONE,
 		.name	= "flow.end.usec",
+	},
+	{
+		.type	= ULOGD_RET_UINT64,
+		.flags	= ULOGD_RETF_NONE,
+		.name	= "flow.end.mcsec",
 		.ipfix	= {
 			.vendor		= IPFIX_VENDOR_IETF,
 			.field_id	= IPFIX_flowEndMicroSeconds,
@@ -485,6 +497,13 @@ static int compare(const void *data1, const void *data2)
 	return nfct_cmp(u1->ct, ct, NFCT_CMP_ORIG | NFCT_CMP_REPL);
 }
 
+static inline uint64_t tv2ntp(const struct timeval t)
+{
+	/* RFC7101 - 6.1.10. dateTimeNanoseconds */
+	return (uint64_t) (t.tv_sec << 32)
+		+ (t.tv_usec << 32) / (NSEC_PER_SEC / 1000);
+}
+
 /* only the main_upi plugin instance contains the correct private data. */
 static int propagate_ct(struct ulogd_pluginstance *main_upi,
 			struct ulogd_pluginstance *upi,
@@ -579,12 +598,16 @@ static int propagate_ct(struct ulogd_pluginstance *main_upi,
 				     ts->time[START].tv_sec);
 			okey_set_u32(&ret[NFCT_FLOW_START_USEC],
 				     ts->time[START].tv_usec);
+			okey_set_u64(&ret[NFCT_FLOW_START_MCSEC],
+				     tv2ntp(ts->time[START]));
 		}
 		if (ts->time[STOP].tv_sec) {
 			okey_set_u32(&ret[NFCT_FLOW_END_SEC],
 				     ts->time[STOP].tv_sec);
 			okey_set_u32(&ret[NFCT_FLOW_END_USEC],
 				     ts->time[STOP].tv_usec);
+			okey_set_u64(&ret[NFCT_FLOW_END_MCSEC],
+				     tv2ntp(ts->time[STOP]));
 		}
 	}
 	okey_set_ptr(&ret[NFCT_CT], cpi->ct);
-- 
1.9.1


  parent reply	other threads:[~2014-04-28 11:56 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-08  1:03 [ulogd PATCH 0/8] make progress ulogd_output_IPFIX Ken-ichirou MATSUZAWA
2014-03-08  1:07 ` [PATCH 1/8] ipfix: use nfct_bitmask Ken-ichirou MATSUZAWA
2014-03-23 18:55   ` Eric Leblond
2014-03-08  1:09 ` [PATCH 2/8] ipfix: fix enterprise bit handling Ken-ichirou MATSUZAWA
2014-03-08  1:10 ` [PATCH 3/8] ipfix: some cleanups Ken-ichirou MATSUZAWA
2014-03-08  1:12 ` [PATCH 4/8] ipfix: add functions for ipfix dataset creation Ken-ichirou MATSUZAWA
2014-03-08  1:13 ` [PATCH 5/8] ipfix: add function for ipfix message creation Ken-ichirou MATSUZAWA
2014-03-23 20:06   ` Eric Leblond
2014-03-08  1:15 ` [PATCH 6/8] ipfix: decide whether prepending template by send times Ken-ichirou MATSUZAWA
2014-03-08  1:17 ` [PATCH 7/8] ipfix: print ipfix message Ken-ichirou MATSUZAWA
2014-03-08  1:19 ` [PATCH 8/8] ipfix: build headers with template Ken-ichirou MATSUZAWA
2014-03-08  1:24 ` [libnetfilter_conntrack PATCH] conntrack: introduce clear and equal functions for bitmask object Ken-ichirou MATSUZAWA
2014-03-08  9:25   ` Florian Westphal
2014-03-23 18:50 ` [ulogd PATCH 0/8] make progress ulogd_output_IPFIX Eric Leblond
2014-03-26 12:11   ` Ken-ichirou MATSUZAWA
2014-03-26 12:16     ` [ulogd PATCH 1/8] ipfix: use nfct_bitmask Ken-ichirou MATSUZAWA
2014-03-26 12:18     ` [ulogd PATCH 2/8] ipfix: fix enterprise bit handling Ken-ichirou MATSUZAWA
2014-03-26 12:19     ` [ulogd PATCH 3/8] ipfix: some cleanups Ken-ichirou MATSUZAWA
2014-03-26 12:23     ` [ulogd PATCH 4/8] ipfix: add functions for ipfix dataset creation Ken-ichirou MATSUZAWA
2014-03-26 12:25     ` [ulogd PATCH 5/8] ipfix: add function for ipfix message creation Ken-ichirou MATSUZAWA
2014-03-26 12:26     ` [ulogd PATCH 6/8] ipfix: decide whether prepending template by send times Ken-ichirou MATSUZAWA
2014-03-26 12:28     ` [ulogd PATCH 7/8] ipfix: print ipfix message Ken-ichirou MATSUZAWA
2014-03-26 12:30     ` [ulogd PATCH 8/8] ipfix: build headers with template Ken-ichirou MATSUZAWA
2014-04-19 13:36     ` [ulogd PATCH 0/8] make progress ulogd_output_IPFIX Eric Leblond
2014-04-22 11:56       ` [ulogd PATCH 1/8 resend] ipfix: use nfct_bitmask Ken-ichirou MATSUZAWA
2014-04-22 12:03       ` [ulogd PATCH 0/8] make progress ulogd_output_IPFIX Ken-ichirou MATSUZAWA
2014-04-22 15:20         ` Eric Leblond
2014-04-28 11:39 ` [ulogd PATCH 0/13] " Ken-ichirou MATSUZAWA
2014-04-28 11:42   ` [libnetfilter_conntrack PATCH 1/13] conntrack: introduce clear and equal functions for bitmask object Ken-ichirou MATSUZAWA
2014-04-28 11:44   ` [ulogd PATCH 2/13] ipfix: use nfct_bitmask Ken-ichirou MATSUZAWA
2014-04-28 11:45   ` [ulogd PATCH 3/13] ipfix: fix enterprise bit handling Ken-ichirou MATSUZAWA
2014-04-28 11:46   ` [ulogd PATCH 4/13] ipfix: some cleanups Ken-ichirou MATSUZAWA
2014-04-28 11:48   ` [ulogd PATCH 5/13] ipfix: add functions for ipfix dataset creation Ken-ichirou MATSUZAWA
2014-04-28 11:49   ` [ulogd PATCH 6/13] ipfix: add function for ipfix message creation Ken-ichirou MATSUZAWA
2014-04-28 11:50   ` [ulogd PATCH 7/13] ipfix: decide whether prepending template by send times Ken-ichirou MATSUZAWA
2014-04-28 11:51   ` [ulogd PATCH 8/13] ipfix: print ipfix message Ken-ichirou MATSUZAWA
2014-04-28 11:52   ` [ulogd PATCH 9/13] ipfix: build headers with template Ken-ichirou MATSUZAWA
2014-04-28 11:53   ` [ulogd PATCH 10/13] nfct: fix ipfix field_id of flow.end.usec Ken-ichirou MATSUZAWA
2014-04-28 11:54   ` [ulogd PATCH 11/13] nfct/ipfix: introduce new vendor id Ken-ichirou MATSUZAWA
2014-04-28 11:56   ` Ken-ichirou MATSUZAWA [this message]
2014-06-01 10:28     ` [ulogd PATCH 12/13] nfct: introduce new out keys for ipfix timestamp Eric Leblond
2014-06-02  9:52       ` Pablo Neira Ayuso
2014-06-02 12:51         ` Ken-ichirou MATSUZAWA
2014-06-02 18:59           ` Eric Leblond
2014-04-28 11:57   ` [ulogd PATCH 13/13] ipfix: add debug symbol for yafscii Ken-ichirou MATSUZAWA

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140428115621.GM12523@gmail.com \
    --to=chamaken@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.