]> git.baikalelectronics.ru Git - kernel.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)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 14 Sep 2015 16:10:57 +0000 (18:10 +0200)
commit6b670abf042d0db3e3cff4b21d147642f4ae55b9
tree8665ae84918021d813e2f072ab6ae6cfb1fdc424
parent0000e5a10c1e1be9df06e428c3bcd6f925af71e5
netfilter: nft_compat: skip family comparison in case of NFPROTO_UNSPEC

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: 27289a89ace7 ("netfilter: nf_tables: add compatibility layer for x_tables")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_compat.c