@@ -9247,9 +9247,13 @@ static int nf_tables_flowtable_event(struct notifier_block *this,
struct nft_table *table;
struct net *net;
- if (event != NETDEV_UNREGISTER &&
- event != NETDEV_REGISTER)
- return 0;
+ if (event == NETDEV_CHANGENAME) {
+ nf_tables_flowtable_event(this, NETDEV_UNREGISTER, ptr);
+ event = NETDEV_REGISTER;
+ } else if (event != NETDEV_UNREGISTER &&
+ event != NETDEV_REGISTER) {
+ return NOTIFY_DONE;
+ }
net = dev_net(dev);
nft_net = nft_pernet(net);
@@ -379,10 +379,13 @@ static int nf_tables_netdev_event(struct notifier_block *this,
.net = dev_net(dev),
};
- if (event != NETDEV_UNREGISTER &&
- event != NETDEV_REGISTER &&
- event != NETDEV_CHANGENAME)
+ if (event == NETDEV_CHANGENAME) {
+ nf_tables_netdev_event(this, NETDEV_UNREGISTER, ptr);
+ event = NETDEV_REGISTER;
+ } else if (event != NETDEV_UNREGISTER &&
+ event != NETDEV_REGISTER) {
return NOTIFY_DONE;
+ }
nft_net = nft_pernet(ctx.net);
mutex_lock(&nft_net->commit_mutex);
Treat a netdev rename like removal and recreation with a different name. In theory, one could leave hooks in place which still cover the new name, but this is both unlikely and needlessly complicates the code. Signed-off-by: Phil Sutter <phil@nwl.cc> --- net/netfilter/nf_tables_api.c | 10 +++++++--- net/netfilter/nft_chain_filter.c | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-)