Skip to content

Commit 2a67414

Browse files
Phil Sutterummakynes
authored andcommitted
netfilter: nf_tables: Flowtable hook's pf value never varies
When checking for duplicate hooks in nft_register_flowtable_net_hooks(), comparing ops.pf value is pointless as it is always NFPROTO_NETDEV with flowtable hooks. Dropping the check leaves the search identical to the one in nft_hook_list_find() so call that function instead of open coding. Signed-off-by: Phil Sutter <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent d01ed32 commit 2a67414

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8895,7 +8895,7 @@ static int nft_register_flowtable_net_hooks(struct net *net,
88958895
struct list_head *hook_list,
88968896
struct nft_flowtable *flowtable)
88978897
{
8898-
struct nft_hook *hook, *hook2, *next;
8898+
struct nft_hook *hook, *next;
88998899
struct nft_flowtable *ft;
89008900
int err, i = 0;
89018901

@@ -8904,12 +8904,9 @@ static int nft_register_flowtable_net_hooks(struct net *net,
89048904
if (!nft_is_active_next(net, ft))
89058905
continue;
89068906

8907-
list_for_each_entry(hook2, &ft->hook_list, list) {
8908-
if (hook->ops.dev == hook2->ops.dev &&
8909-
hook->ops.pf == hook2->ops.pf) {
8910-
err = -EEXIST;
8911-
goto err_unregister_net_hooks;
8912-
}
8907+
if (nft_hook_list_find(&ft->hook_list, hook)) {
8908+
err = -EEXIST;
8909+
goto err_unregister_net_hooks;
89138910
}
89148911
}
89158912

0 commit comments

Comments
 (0)