Skip to content

Commit 9f7dd42

Browse files
colonaummakynes
authored andcommitted
netfilter: ctnetlink: revert to dumping mark regardless of event type
It seems that change was unintentional, we have userspace code that needs the mark while listening for events like REPLY, DESTROY, etc. Also include 0-marks in requested dumps, as they were before that fix. Fixes: 1feeae0 ("netfilter: ctnetlink: fix compilation warning after data race fixes in ct mark") Signed-off-by: Ivan Delalande <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 5281252 commit 9f7dd42

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

net/netfilter/nf_conntrack_netlink.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,12 @@ ctnetlink_dump_timestamp(struct sk_buff *skb, const struct nf_conn *ct)
328328
}
329329

330330
#ifdef CONFIG_NF_CONNTRACK_MARK
331-
static int ctnetlink_dump_mark(struct sk_buff *skb, const struct nf_conn *ct)
331+
static int ctnetlink_dump_mark(struct sk_buff *skb, const struct nf_conn *ct,
332+
bool dump)
332333
{
333334
u32 mark = READ_ONCE(ct->mark);
334335

335-
if (!mark)
336+
if (!mark && !dump)
336337
return 0;
337338

338339
if (nla_put_be32(skb, CTA_MARK, htonl(mark)))
@@ -343,7 +344,7 @@ static int ctnetlink_dump_mark(struct sk_buff *skb, const struct nf_conn *ct)
343344
return -1;
344345
}
345346
#else
346-
#define ctnetlink_dump_mark(a, b) (0)
347+
#define ctnetlink_dump_mark(a, b, c) (0)
347348
#endif
348349

349350
#ifdef CONFIG_NF_CONNTRACK_SECMARK
@@ -548,7 +549,7 @@ static int ctnetlink_dump_extinfo(struct sk_buff *skb,
548549
static int ctnetlink_dump_info(struct sk_buff *skb, struct nf_conn *ct)
549550
{
550551
if (ctnetlink_dump_status(skb, ct) < 0 ||
551-
ctnetlink_dump_mark(skb, ct) < 0 ||
552+
ctnetlink_dump_mark(skb, ct, true) < 0 ||
552553
ctnetlink_dump_secctx(skb, ct) < 0 ||
553554
ctnetlink_dump_id(skb, ct) < 0 ||
554555
ctnetlink_dump_use(skb, ct) < 0 ||
@@ -831,8 +832,7 @@ ctnetlink_conntrack_event(unsigned int events, const struct nf_ct_event *item)
831832
}
832833

833834
#ifdef CONFIG_NF_CONNTRACK_MARK
834-
if (events & (1 << IPCT_MARK) &&
835-
ctnetlink_dump_mark(skb, ct) < 0)
835+
if (ctnetlink_dump_mark(skb, ct, events & (1 << IPCT_MARK)))
836836
goto nla_put_failure;
837837
#endif
838838
nlmsg_end(skb, nlh);
@@ -2735,7 +2735,7 @@ static int __ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct)
27352735
goto nla_put_failure;
27362736

27372737
#ifdef CONFIG_NF_CONNTRACK_MARK
2738-
if (ctnetlink_dump_mark(skb, ct) < 0)
2738+
if (ctnetlink_dump_mark(skb, ct, true) < 0)
27392739
goto nla_put_failure;
27402740
#endif
27412741
if (ctnetlink_dump_labels(skb, ct) < 0)

0 commit comments

Comments
 (0)