fix racy conntrack mark
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 6/8 fix racy conntrack mark
Signature · 3 lines
-- The dawn of the fourth age of Linux firewalling is coming; a time of great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris
Set conntrack mark before it is in hashes.
Signed-off-by Pablo Neira Ayuso <[email protected]>
net/ipv4/netfilter/ip_conntrack_netlink.c +5 -5
@@ -1032,6 +1032,11 @@ ctnetlink_create_conntrack(struct nfattrreturn err; } +#if defined(CONFIG_IP_NF_CONNTRACK_MARK ) +if (cda[CTA_MARK -1 ]) + ct->mark =ntohl (*(u_int32_t *)NFA_DATA (cda[CTA_MARK -1 ])); +#endif + ct->helper =ip_conntrack_helper_find_get (rtuple);add_timer (&ct->timeout);
@@ -1040,11 +1045,6 @@ ctnetlink_create_conntrack(struct nfattrif (ct->helper)ip_conntrack_helper_put (ct->helper); -#if defined(CONFIG_IP_NF_CONNTRACK_MARK ) -if (cda[CTA_MARK -1 ]) - ct->mark =ntohl (*(u_int32_t *)NFA_DATA (cda[CTA_MARK -1 ])); -#endif -DEBUGP ("conntrack with id %u inserted\n" , ct->id);return 0 ;