@@ -328,8 +328,13 @@ ctnetlink_dump_timestamp(struct sk_buff *skb, const struct nf_conn *ct)
328
328
}
329
329
330
330
#ifdef CONFIG_NF_CONNTRACK_MARK
331
- static int ctnetlink_dump_mark (struct sk_buff * skb , u32 mark )
331
+ static int ctnetlink_dump_mark (struct sk_buff * skb , const struct nf_conn * ct )
332
332
{
333
+ u32 mark = READ_ONCE (ct -> mark );
334
+
335
+ if (!mark )
336
+ return 0 ;
337
+
333
338
if (nla_put_be32 (skb , CTA_MARK , htonl (mark )))
334
339
goto nla_put_failure ;
335
340
return 0 ;
@@ -543,7 +548,7 @@ static int ctnetlink_dump_extinfo(struct sk_buff *skb,
543
548
static int ctnetlink_dump_info (struct sk_buff * skb , struct nf_conn * ct )
544
549
{
545
550
if (ctnetlink_dump_status (skb , ct ) < 0 ||
546
- ctnetlink_dump_mark (skb , READ_ONCE ( ct -> mark ) ) < 0 ||
551
+ ctnetlink_dump_mark (skb , ct ) < 0 ||
547
552
ctnetlink_dump_secctx (skb , ct ) < 0 ||
548
553
ctnetlink_dump_id (skb , ct ) < 0 ||
549
554
ctnetlink_dump_use (skb , ct ) < 0 ||
@@ -722,7 +727,6 @@ ctnetlink_conntrack_event(unsigned int events, const struct nf_ct_event *item)
722
727
struct sk_buff * skb ;
723
728
unsigned int type ;
724
729
unsigned int flags = 0 , group ;
725
- u32 mark ;
726
730
int err ;
727
731
728
732
if (events & (1 << IPCT_DESTROY )) {
@@ -827,9 +831,8 @@ ctnetlink_conntrack_event(unsigned int events, const struct nf_ct_event *item)
827
831
}
828
832
829
833
#ifdef CONFIG_NF_CONNTRACK_MARK
830
- mark = READ_ONCE (ct -> mark );
831
- if ((events & (1 << IPCT_MARK ) || mark ) &&
832
- ctnetlink_dump_mark (skb , mark ) < 0 )
834
+ if (events & (1 << IPCT_MARK ) &&
835
+ ctnetlink_dump_mark (skb , ct ) < 0 )
833
836
goto nla_put_failure ;
834
837
#endif
835
838
nlmsg_end (skb , nlh );
@@ -2671,7 +2674,6 @@ static int __ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct)
2671
2674
{
2672
2675
const struct nf_conntrack_zone * zone ;
2673
2676
struct nlattr * nest_parms ;
2674
- u32 mark ;
2675
2677
2676
2678
zone = nf_ct_zone (ct );
2677
2679
@@ -2733,8 +2735,7 @@ static int __ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct)
2733
2735
goto nla_put_failure ;
2734
2736
2735
2737
#ifdef CONFIG_NF_CONNTRACK_MARK
2736
- mark = READ_ONCE (ct -> mark );
2737
- if (mark && ctnetlink_dump_mark (skb , mark ) < 0 )
2738
+ if (ctnetlink_dump_mark (skb , ct ) < 0 )
2738
2739
goto nla_put_failure ;
2739
2740
#endif
2740
2741
if (ctnetlink_dump_labels (skb , ct ) < 0 )
0 commit comments