From: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
To: The netfilter developer mailinglist <netfilter-devel@vger.kernel.org>
Cc: Eric Leblond <eric@regit.org>
Subject: [PATCH v3 ulogd 06/12] ipfix: decide whether prepending template by send times
Date: Tue, 3 Jun 2014 19:10:33 +0900 [thread overview]
Message-ID: <20140603101033.GG24668@gmail.com> (raw)
In-Reply-To: <20140603100130.GA24668@gmail.com>
specified in config file and kept it until_template in struct ulogd_ipfix_template
Signed-off-by Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
---
output/ulogd_output_IPFIX.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/output/ulogd_output_IPFIX.c b/output/ulogd_output_IPFIX.c
index 352b5a7..f9e23bb 100644
--- a/output/ulogd_output_IPFIX.c
+++ b/output/ulogd_output_IPFIX.c
@@ -85,7 +85,7 @@ struct sctp_sndrcvinfo {
#define IPFIX_DEFAULT_TCPUDP_PORT 4739
static struct config_keyset ipfix_kset = {
- .num_ces = 4,
+ .num_ces = 5,
.ces = {
{
.key = "host",
@@ -110,6 +110,12 @@ static struct config_keyset ipfix_kset = {
.options = CONFIG_OPT_NONE,
.u.value = 0,
},
+ {
+ .key = "send_template_per",
+ .type = CONFIG_TYPE_INT,
+ .options = CONFIG_OPT_NONE,
+ .u.value = 16,
+ },
},
};
@@ -117,6 +123,7 @@ static struct config_keyset ipfix_kset = {
#define port_ce(x) (x->ces[1])
#define proto_ce(x) (x->ces[2])
#define domain_ce(x) (x->ces[3])
+#define template_per_ce(x) (x->ces[4])
struct ipfix_template {
struct ipfix_templ_rec_hdr hdr;
@@ -129,6 +136,7 @@ struct ulogd_ipfix_template {
unsigned int data_length; /* length of the DATA */
void *tmpl_cur; /* cursor into current template position */
struct ipfix_template tmpl;
+ int until_template; /* decide if it's time to retransmit our template */
};
struct ipfix_instance {
@@ -171,6 +179,7 @@ build_template_for_bitmask(struct ulogd_pluginstance *upi,
tmpl->tmpl_cur = tmpl->tmpl.buf;
tmpl->data_length = 0;
+ tmpl->until_template = template_per_ce(upi->config_kset).u.value;
for (i = 0, j = 0; i < upi->input.num_keys; i++) {
struct ulogd_key *key = &upi->input.keys[i];
@@ -355,7 +364,8 @@ static int output_ipfix(struct ulogd_pluginstance *upi)
{
struct ipfix_instance *ii = (struct ipfix_instance *) &upi->private;
struct ulogd_ipfix_template *template;
- unsigned int total_size, i;
+ unsigned int i;
+ bool need_template = false;
/* FIXME: it would be more cache efficient if the IS_VALID
* flags would be a separate bitmask outside of the array.
@@ -388,16 +398,12 @@ static int output_ipfix(struct ulogd_pluginstance *upi)
return ULOGD_IRET_ERR;
}
llist_add(&template->list, &ii->template_list);
+ need_template = true;
}
- total_size = template->data_length;
-
- /* decide if it's time to retransmit our template and (optionally)
- * prepend it into the to-be-sent IPFIX message */
- if (0 /* FIXME */) {
- /* add size of template */
- //total_size += (template->tmpl_cur - (void *)&template->tmpl);
- total_size += sizeof(template->tmpl);
+ if (template->until_template-- == 0) {
+ need_template = true;
+ template->until_template = template_per_ce(upi->config_kset).u.value;
}
return ULOGD_IRET_OK;
--
1.9.1
next prev parent reply other threads:[~2014-06-03 10:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-03 10:01 [PATCH v3 ulogd 0/12] make progress ulogd_output_IPFIX Ken-ichirou MATSUZAWA
2014-06-03 10:04 ` [PATCH v3 ulogd 01/12] ipfix: use nfct_bitmask Ken-ichirou MATSUZAWA
2014-06-03 10:05 ` [PATCH v3 ulogd 02/12] ipfix: fix enterprise bit handling Ken-ichirou MATSUZAWA
2014-06-03 10:07 ` [PATCH v3 ulogd 03/12] ipfix: some cleanups Ken-ichirou MATSUZAWA
2014-06-03 10:08 ` [PATCH v3 ulogd 04/12] ipfix: add functions for ipfix dataset creation Ken-ichirou MATSUZAWA
2014-06-03 10:09 ` [PATCH v3 ulogd 05/12] ipfix: add function for ipfix message creation Ken-ichirou MATSUZAWA
2014-06-03 10:10 ` Ken-ichirou MATSUZAWA [this message]
2014-06-03 10:11 ` [PATCH v3 ulogd 07/12] ipfix: print ipfix message Ken-ichirou MATSUZAWA
2014-06-03 10:12 ` [PATCH 08/12] ipfix: build headers with template Ken-ichirou MATSUZAWA
2014-06-03 10:13 ` [PATCH v3 ulogd 09/12] nfct: fix ipfix field_id of flow.end.usec Ken-ichirou MATSUZAWA
2014-06-03 10:15 ` [PATCH v3 ulogd 10/12] nfct: fix icmp type and code output key size Ken-ichirou MATSUZAWA
2014-06-03 10:16 ` [PATCH v3 ulogd 11/12] nfct/ipfix: introduce new vendor id Ken-ichirou MATSUZAWA
2014-06-03 10:18 ` [PATCH v3 ulogd 12/12] 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=20140603101033.GG24668@gmail.com \
--to=chamaken@gmail.com \
--cc=eric@regit.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).