* [PATCH ulogd] XML: show both nflog packet and conntrack
@ 2021-10-12 11:17 Ken-ichirou MATSUZAWA
2021-11-23 13:51 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Ken-ichirou MATSUZAWA @ 2021-10-12 11:17 UTC (permalink / raw)
To: netfilter-devel; +Cc: Ken-ichirou MATSUZAWA
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>
---
output/ulogd_output_XML.c | 33 ++++++++++++++++++++++-----------
1 file 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;
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH ulogd] XML: show both nflog packet and conntrack
2021-10-12 11:17 [PATCH ulogd] XML: show both nflog packet and conntrack Ken-ichirou MATSUZAWA
@ 2021-11-23 13:51 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2021-11-23 13:51 UTC (permalink / raw)
To: Ken-ichirou MATSUZAWA; +Cc: netfilter-devel
On Tue, Oct 12, 2021 at 08:17:07PM +0900, Ken-ichirou MATSUZAWA wrote:
> This patch enables to show "ct" as well as "raw" if output type is
> ULOGD_DTYPE_RAW and "ct" input exists.
Applied, thanks.
This is the patch I was referring to in my previous email.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-23 13:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-12 11:17 [PATCH ulogd] XML: show both nflog packet and conntrack Ken-ichirou MATSUZAWA
2021-11-23 13:51 ` Pablo Neira Ayuso
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.