mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
netfilter: nf_tables: Prepare for handling NETDEV_REGISTER events
Put NETDEV_UNREGISTER handling code into a switch, no functional change intended as the function is only called for that event yet. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
73319a8ee1
commit
104031ac89
|
|
@ -9696,14 +9696,19 @@ static void nft_flowtable_event(unsigned long event, struct net_device *dev,
|
|||
struct nft_hook *hook;
|
||||
|
||||
list_for_each_entry(hook, &flowtable->hook_list, list) {
|
||||
ops = nft_hook_find_ops(hook, dev);
|
||||
if (!ops)
|
||||
continue;
|
||||
switch (event) {
|
||||
case NETDEV_UNREGISTER:
|
||||
ops = nft_hook_find_ops(hook, dev);
|
||||
if (!ops)
|
||||
continue;
|
||||
|
||||
/* flow_offload_netdev_event() cleans up entries for us. */
|
||||
nft_unregister_flowtable_ops(dev_net(dev), flowtable, ops);
|
||||
list_del_rcu(&ops->list);
|
||||
kfree_rcu(ops, rcu);
|
||||
/* flow_offload_netdev_event() cleans up entries for us. */
|
||||
nft_unregister_flowtable_ops(dev_net(dev),
|
||||
flowtable, ops);
|
||||
list_del_rcu(&ops->list);
|
||||
kfree_rcu(ops, rcu);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -321,19 +321,24 @@ static const struct nft_chain_type nft_chain_filter_netdev = {
|
|||
static void nft_netdev_event(unsigned long event, struct net_device *dev,
|
||||
struct nft_base_chain *basechain)
|
||||
{
|
||||
struct nft_table *table = basechain->chain.table;
|
||||
struct nf_hook_ops *ops;
|
||||
struct nft_hook *hook;
|
||||
|
||||
list_for_each_entry(hook, &basechain->hook_list, list) {
|
||||
ops = nft_hook_find_ops(hook, dev);
|
||||
if (!ops)
|
||||
continue;
|
||||
switch (event) {
|
||||
case NETDEV_UNREGISTER:
|
||||
ops = nft_hook_find_ops(hook, dev);
|
||||
if (!ops)
|
||||
continue;
|
||||
|
||||
if (!(basechain->chain.table->flags & NFT_TABLE_F_DORMANT))
|
||||
nf_unregister_net_hook(dev_net(dev), ops);
|
||||
if (!(table->flags & NFT_TABLE_F_DORMANT))
|
||||
nf_unregister_net_hook(dev_net(dev), ops);
|
||||
|
||||
list_del_rcu(&ops->list);
|
||||
kfree_rcu(ops, rcu);
|
||||
list_del_rcu(&ops->list);
|
||||
kfree_rcu(ops, rcu);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user