summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>2021-10-12 20:17:07 +0900
committerPablo Neira Ayuso <pablo@netfilter.org>2021-11-23 14:49:54 +0100
commita8cedca43c63370ce400709fb81c34d7ece91bfb (patch)
treed401d8c65feb6c2388d695fe9cc8dfaad224a3d2
parentf6a615587a10e6b124b4d9a31fca54bb06da0ae7 (diff)
XML: show both nflog packet and conntrackHEADmaster
This patch enables to show "ct" as well as "raw" if output type is ULOGD_DTYPE_RAW and "ct" input exists. Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--output/ulogd_output_XML.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/output/ulogd_output_XML.c b/output/ulogd_output_XML.c
index ea7ed96..44af596 100644
--- a/output/ulogd_output_XML.c
+++ b/output/ulogd_output_XML.c
@@ -109,7 +109,7 @@ xml_output_flow(struct ulogd_key *inp, char *buf, ssize_t size)
if (tmp < 0 || tmp >= size)
return -1;
- return 0;
+ return tmp;
#else
return -1;
#endif
@@ -126,7 +126,7 @@ xml_output_packet(struct ulogd_key *inp, char *buf, ssize_t size)
if (tmp < 0 || tmp >= size)
return -1;
- return 0;
+ return tmp;
#else
return -1;
#endif
@@ -143,7 +143,7 @@ xml_output_sum(struct ulogd_key *inp, char *buf, ssize_t size)
NFACCT_SNPRINTF_F_TIME);
if (tmp < 0 || tmp >= size)
return -1;
- return 0;
+ return tmp;
#else
return -1;
#endif
@@ -155,14 +155,25 @@ static int xml_output(struct ulogd_pluginstance *upi)
struct ulogd_key *inp = upi->input.keys;
struct xml_priv *opi = (struct xml_priv *) &upi->private;
static char buf[4096];
- int ret = -1;
-
- if (pp_is_valid(inp, KEY_CT))
- ret = xml_output_flow(inp, buf, sizeof(buf));
- else if (pp_is_valid(inp, KEY_PCKT))
- ret = xml_output_packet(inp, buf, sizeof(buf));
- else if (pp_is_valid(inp, KEY_SUM))
- ret = xml_output_sum(inp, buf, sizeof(buf));
+ int ret = -1, tmp = 0;
+
+ if (pp_is_valid(inp, KEY_PCKT)) {
+ ret = xml_output_packet(inp, buf + tmp, sizeof(buf) - tmp);
+ if (ret < 0)
+ return ULOGD_IRET_ERR;
+ tmp += ret;
+ }
+ if (pp_is_valid(inp, KEY_CT)) {
+ ret = xml_output_flow(inp, buf + tmp, sizeof(buf) - tmp);
+ if (ret < 0)
+ return ULOGD_IRET_ERR;
+ tmp += ret;
+ }
+ if (pp_is_valid(inp, KEY_SUM)) {
+ ret = xml_output_sum(inp, buf + tmp, sizeof(buf) - tmp);
+ if (ret < 0)
+ return ULOGD_IRET_ERR;
+ }
if (ret < 0)
return ULOGD_IRET_ERR;