summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/expr/log.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/expr/log.c b/src/expr/log.c
index a231bac..b642255 100644
--- a/src/expr/log.c
+++ b/src/expr/log.c
@@ -15,6 +15,7 @@
#include <arpa/inet.h>
#include <errno.h>
#include <linux/netfilter/nf_tables.h>
+#include <linux/netfilter/nf_log.h>
#include "internal.h"
#include <libmnl/libmnl.h>
@@ -237,13 +238,37 @@ static int nftnl_expr_log_snprintf_default(char *buf, size_t size,
if (e->flags & (1 << NFTNL_EXPR_LOG_GROUP)) {
ret = snprintf(buf + offset, len,
- "group %u snaplen %u qthreshold %u",
+ "group %u snaplen %u qthreshold %u ",
log->group, log->snaplen, log->qthreshold);
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
- } else if (e->flags & (1 << NFTNL_EXPR_LOG_LEVEL)) {
- ret = snprintf(buf + offset, len, "level %u flags %u",
- log->level, log->flags);
- SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ } else {
+ if (e->flags & (1 << NFTNL_EXPR_LOG_LEVEL)) {
+ ret = snprintf(buf + offset, len, "level %u ",
+ log->level);
+ SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ }
+ if (e->flags & (1 << NFTNL_EXPR_LOG_FLAGS)) {
+ if (log->flags & NF_LOG_TCPSEQ) {
+ ret = snprintf(buf + offset, len, "tcpseq ");
+ SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ }
+ if (log->flags & NF_LOG_TCPOPT) {
+ ret = snprintf(buf + offset, len, "tcpopt ");
+ SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ }
+ if (log->flags & NF_LOG_IPOPT) {
+ ret = snprintf(buf + offset, len, "ipopt ");
+ SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ }
+ if (log->flags & NF_LOG_UID) {
+ ret = snprintf(buf + offset, len, "uid ");
+ SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ }
+ if (log->flags & NF_LOG_MACDECODE) {
+ ret = snprintf(buf + offset, len, "macdecode ");
+ SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ }
+ }
}
return offset;