From: Eric Leblond <eric@inl.fr>
To: netfilter-devel@vger.kernel.org
Cc: Eric Leblond <eric@inl.fr>
Subject: [ULOGD PATCH 3/3] Modify printflow filter to display event type in output message.
Date: Mon, 17 Mar 2008 01:07:03 +0100 [thread overview]
Message-ID: <12057124233697-git-send-email-eric@inl.fr> (raw)
In-Reply-To: <12057124233723-git-send-email-eric@inl.fr>
This patch adds support of event type display in printflow filter. This is used
to display event type in textual output modules. Here's an output example:
[DESTROY] ORIG: SRC=192.168.1.2 DST=192.168.1.255 PROTO=UDP SPT=631 DPT=631 \\
PKTS=1 BYTES=197 , REPLY: SRC=192.168.1.255 DST=192.168.1.2 \\
PROTO=UDP SPT=631 DPT=631 PKTS=0 BYTES=0
Signed-off-by: Eric Leblond <eric@inl.fr>
---
include/ulogd/printflow.h | 2 +-
util/printflow.c | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/include/ulogd/printflow.h b/include/ulogd/printflow.h
index 979f673..b793426 100644
--- a/include/ulogd/printflow.h
+++ b/include/ulogd/printflow.h
@@ -1,7 +1,7 @@
#ifndef _PRINTFLOW_H
#define _PRINTFLOW_H
-#define FLOW_IDS 16
+#define FLOW_IDS 17
extern struct ulogd_key printflow_keys[FLOW_IDS];
int printflow_print(struct ulogd_key *res, char *buf);
diff --git a/util/printflow.c b/util/printflow.c
index 92c4f0f..6c2ffd5 100644
--- a/util/printflow.c
+++ b/util/printflow.c
@@ -45,6 +45,7 @@ enum printflow_fields {
PRINTFLOW_REPLY_RAW_PKTCOUNT,
PRINTFLOW_ICMP_CODE,
PRINTFLOW_ICMP_TYPE,
+ PRINTFLOW_EVENT_TYPE,
};
struct ulogd_key printflow_keys[FLOW_IDS] = {
@@ -128,6 +129,11 @@ struct ulogd_key printflow_keys[FLOW_IDS] = {
.flags = ULOGD_RETF_NONE,
.name = "icmp.type",
},
+ {
+ .type = ULOGD_RET_UINT32,
+ .flags = ULOGD_RETF_NONE,
+ .name = "ct.event",
+ },
};
int printflow_keys_num = sizeof(printflow_keys)/sizeof(*printflow_keys);
@@ -139,6 +145,20 @@ int printflow_print(struct ulogd_key *res, char *buf)
{
char *buf_cur = buf;
+ if (pp_is_valid(res, PRINTFLOW_EVENT_TYPE)) {
+ switch (GET_VALUE(res, PRINTFLOW_EVENT_TYPE).ui32) {
+ case 1:
+ buf_cur += sprintf(buf_cur, "[NEW] ");
+ break;
+ case 2:
+ buf_cur += sprintf(buf_cur, "[UPDATE] ");
+ break;
+ case 3:
+ buf_cur += sprintf(buf_cur, "[DESTROY] ");
+ break;
+ }
+ }
+
buf_cur += sprintf(buf_cur, "ORIG: ");
if (pp_is_valid(res, PRINTFLOW_ORIG_IP_SADDR))
--
1.5.4.3
next prev parent reply other threads:[~2008-03-17 0:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-17 0:07 [ULOGD PATCH 0/3] Add event type to NFCT plugin Eric Leblond
2008-03-17 0:07 ` [ULOGD PATCH 1/3] Add some plugin loading and stack example to configuration file Eric Leblond
2008-03-26 0:32 ` Pablo Neira Ayuso
2008-03-17 0:07 ` [ULOGD PATCH 2/3] Add event output and make event mask configurable in NFCT Eric Leblond
2008-03-26 0:40 ` Pablo Neira Ayuso
2008-03-26 0:56 ` [Resend ULOGD PATCH] " Eric Leblond
2008-03-26 9:34 ` Pablo Neira Ayuso
2008-04-05 10:21 ` Eric Leblond
2008-04-05 15:29 ` Pablo Neira Ayuso
2008-04-05 19:24 ` Eric Leblond
2008-03-17 0:07 ` Eric Leblond [this message]
2008-03-26 9:34 ` [ULOGD PATCH 3/3] Modify printflow filter to display event type in output message Pablo Neira Ayuso
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=12057124233697-git-send-email-eric@inl.fr \
--to=eric@inl.fr \
--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.