Skip to content

Commit 91a089d

Browse files
Phil Sutterummakynes
authored andcommitted
netfilter: nf_tables: Pass nf_hook_ops to nft_unregister_flowtable_hook()
The function accesses only the hook's ops field, pass it directly. This prepares for nft_hooks holding a list of nf_hook_ops in future. While at it, make use of the function in __nft_unregister_flowtable_net_hooks() as well. Signed-off-by: Phil Sutter <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 21aa0a0 commit 91a089d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8895,12 +8895,12 @@ nft_flowtable_type_get(struct net *net, u8 family)
88958895
}
88968896

88978897
/* Only called from error and netdev event paths. */
8898-
static void nft_unregister_flowtable_hook(struct net *net,
8899-
struct nft_flowtable *flowtable,
8900-
struct nft_hook *hook)
8898+
static void nft_unregister_flowtable_ops(struct net *net,
8899+
struct nft_flowtable *flowtable,
8900+
struct nf_hook_ops *ops)
89018901
{
8902-
nf_unregister_net_hook(net, &hook->ops);
8903-
flowtable->data.type->setup(&flowtable->data, hook->ops.dev,
8902+
nf_unregister_net_hook(net, ops);
8903+
flowtable->data.type->setup(&flowtable->data, ops->dev,
89048904
FLOW_BLOCK_UNBIND);
89058905
}
89068906

@@ -8912,9 +8912,7 @@ static void __nft_unregister_flowtable_net_hooks(struct net *net,
89128912
struct nft_hook *hook, *next;
89138913

89148914
list_for_each_entry_safe(hook, next, hook_list, list) {
8915-
nf_unregister_net_hook(net, &hook->ops);
8916-
flowtable->data.type->setup(&flowtable->data, hook->ops.dev,
8917-
FLOW_BLOCK_UNBIND);
8915+
nft_unregister_flowtable_ops(net, flowtable, &hook->ops);
89188916
if (release_netdev) {
89198917
list_del(&hook->list);
89208918
nft_netdev_hook_free_rcu(hook);
@@ -8983,7 +8981,7 @@ static int nft_register_flowtable_net_hooks(struct net *net,
89838981
if (i-- <= 0)
89848982
break;
89858983

8986-
nft_unregister_flowtable_hook(net, flowtable, hook);
8984+
nft_unregister_flowtable_ops(net, flowtable, &hook->ops);
89878985
list_del_rcu(&hook->list);
89888986
nft_netdev_hook_free_rcu(hook);
89898987
}
@@ -9066,7 +9064,7 @@ static int nft_flowtable_update(struct nft_ctx *ctx, const struct nlmsghdr *nlh,
90669064
err_flowtable_update_hook:
90679065
list_for_each_entry_safe(hook, next, &flowtable_hook.list, list) {
90689066
if (unregister)
9069-
nft_unregister_flowtable_hook(ctx->net, flowtable, hook);
9067+
nft_unregister_flowtable_ops(ctx->net, flowtable, &hook->ops);
90709068
list_del_rcu(&hook->list);
90719069
nft_netdev_hook_free_rcu(hook);
90729070
}
@@ -9639,7 +9637,7 @@ static void nft_flowtable_event(unsigned long event, struct net_device *dev,
96399637
continue;
96409638

96419639
/* flow_offload_netdev_event() cleans up entries for us. */
9642-
nft_unregister_flowtable_hook(dev_net(dev), flowtable, hook);
9640+
nft_unregister_flowtable_ops(dev_net(dev), flowtable, ops);
96439641
list_del_rcu(&hook->list);
96449642
kfree_rcu(hook, rcu);
96459643
break;

0 commit comments

Comments
 (0)