Skip to content

Commit cc37c1a

Browse files
Liping Zhangummakynes
authored andcommitted
netfilter: nft_log: fix snaplen does not truncate packets
There's a similar problem in xt_NFLOG, and was fixed by commit 7643507 ("netfilter: xt_NFLOG: nflog-range does not truncate packets"). Only set copy_len here does not work, so we should enable NF_LOG_F_COPY_LEN also. Signed-off-by: Liping Zhang <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 1bc4e01 commit cc37c1a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/netfilter/nft_log.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ static int nft_log_init(const struct nft_ctx *ctx,
9292
case NF_LOG_TYPE_ULOG:
9393
li->u.ulog.group = ntohs(nla_get_be16(tb[NFTA_LOG_GROUP]));
9494
if (tb[NFTA_LOG_SNAPLEN] != NULL) {
95+
li->u.ulog.flags |= NF_LOG_F_COPY_LEN;
9596
li->u.ulog.copy_len =
9697
ntohl(nla_get_be32(tb[NFTA_LOG_SNAPLEN]));
9798
}
@@ -149,7 +150,7 @@ static int nft_log_dump(struct sk_buff *skb, const struct nft_expr *expr)
149150
if (nla_put_be16(skb, NFTA_LOG_GROUP, htons(li->u.ulog.group)))
150151
goto nla_put_failure;
151152

152-
if (li->u.ulog.copy_len) {
153+
if (li->u.ulog.flags & NF_LOG_F_COPY_LEN) {
153154
if (nla_put_be32(skb, NFTA_LOG_SNAPLEN,
154155
htonl(li->u.ulog.copy_len)))
155156
goto nla_put_failure;

0 commit comments

Comments
 (0)