Skip to content

Commit bbb3357

Browse files
ummakynesDavid S. Miller
authored andcommitted
[NETFILTER]: ctnetlink: check for status attribute 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 <pablo@netfilter.org> Signed-off-by: Patrick McHardy <kaber@trash.net>
1 parent 1b683b5 commit bbb3357

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

net/ipv4/netfilter/ip_conntrack_netlink.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -945,9 +945,11 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
945945
ct->timeout.expires = jiffies + ct->timeout.expires * HZ;
946946
ct->status |= IPS_CONFIRMED;
947947

948-
err = ctnetlink_change_status(ct, cda);
949-
if (err < 0)
950-
goto err;
948+
if (cda[CTA_STATUS-1]) {
949+
err = ctnetlink_change_status(ct, cda);
950+
if (err < 0)
951+
goto err;
952+
}
951953

952954
if (cda[CTA_PROTOINFO-1]) {
953955
err = ctnetlink_change_protoinfo(ct, cda);

net/netfilter/nf_conntrack_netlink.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -963,9 +963,11 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
963963
ct->timeout.expires = jiffies + ct->timeout.expires * HZ;
964964
ct->status |= IPS_CONFIRMED;
965965

966-
err = ctnetlink_change_status(ct, cda);
967-
if (err < 0)
968-
goto err;
966+
if (cda[CTA_STATUS-1]) {
967+
err = ctnetlink_change_status(ct, cda);
968+
if (err < 0)
969+
goto err;
970+
}
969971

970972
if (cda[CTA_PROTOINFO-1]) {
971973
err = ctnetlink_change_protoinfo(ct, cda);

0 commit comments

Comments
 (0)