]> www.infradead.org Git - users/jedix/linux-maple.git/commit
netfilter: nft_compat: skip family comparison in case of NFPROTO_UNSPEC
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 14 Sep 2015 16:04:09 +0000 (18:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Oct 2015 21:43:18 +0000 (14:43 -0700)
commit146560ee780bd92bda069ec7bf685ea4369ed4a3
tree54734605f6bff915d89c0bf51ebc6cf54e14b8df
parentcc2cc007bc8307f0f8f6e6686af2835d8fd0eecd
netfilter: nft_compat: skip family comparison in case of NFPROTO_UNSPEC

commit ba378ca9c04a5fc1b2cf0f0274a9d02eb3d1bad9 upstream.

Fix lookup of existing match/target structures in the corresponding list
by skipping the family check if NFPROTO_UNSPEC is used.

This is resulting in the allocation and insertion of one match/target
structure for each use of them. So this not only bloats memory
consumption but also severely affects the time to reload the ruleset
from the iptables-compat utility.

After this patch, iptables-compat-restore and iptables-compat take
almost the same time to reload large rulesets.

Fixes: 0ca743a55991 ("netfilter: nf_tables: add compatibility layer for x_tables")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nft_compat.c