Atomically set/unset status bits
Subsystems (2)
PATCH 2/3 Atomically set/unset status bits
This patch guarantees that status bits are atomically set/unset. A minor cleanup to save one extra useless line in the code is introduced.
Signed-off-by Pablo Neira Ayuso <[email protected]>
[CTNETLINK] Check for status flags existence on conntrack creation
Check that status flags are available in the netlink message received to create a new conntrack.
Signed-off-by Pablo Neira Ayuso <[email protected]>
net/ipv4/netfilter/ip_conntrack_netlink.c +5 -3
@@ -945,9 +945,11 @@ ctnetlink_create_conntrack(struct nfattr ct->timeout.expires = jiffies + ct->timeout.expires *HZ ; ct->status |=IPS_CONFIRMED ; - err =ctnetlink_change_status (ct, cda); -if (err <0 ) - goto err; +if (cda[CTA_STATUS -1 ]) { + err =ctnetlink_change_status (ct, cda); +if (err <0 ) + goto err; + }if (cda[CTA_PROTOINFO -1 ]) { err =ctnetlink_change_protoinfo (ct, cda);
net/netfilter/nf_conntrack_netlink.c +5 -3
@@ -961,9 +961,11 @@ ctnetlink_create_conntrack(struct nfattr ct->timeout.expires = jiffies + ct->timeout.expires *HZ ; ct->status |=IPS_CONFIRMED ; - err =ctnetlink_change_status (ct, cda); -if (err <0 ) - goto err; +if (cda[CTA_STATUS -1 ]) { + err =ctnetlink_change_status (ct, cda); +if (err <0 ) + goto err; + }if (cda[CTA_PROTOINFO -1 ]) { err =ctnetlink_change_protoinfo (ct, cda);