diff mbox series

[nf-next,v3,13/16] netfilter: nf_tables: Handle NETDEV_CHANGENAME events

Message ID 20240912122148.12159-14-phil@nwl.cc
State Superseded, archived
Headers show
Series Dynamic hook interface binding | expand

Commit Message

Phil Sutter Sept. 12, 2024, 12:21 p.m. UTC
For the sake of simplicity, treat them like consecutive
NETDEV_UNREGISTER and NETDEV_REGISTER events.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 net/netfilter/nf_tables_api.c    | 4 ++++
 net/netfilter/nft_chain_filter.c | 4 ++++
 2 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 40cff8539c74..88528775732a 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -9361,6 +9361,10 @@  static int nf_tables_flowtable_event(struct notifier_block *this,
 	struct nft_table *table;
 	struct net *net;
 
+	if (event == NETDEV_CHANGENAME) {
+		nf_tables_flowtable_event(this, NETDEV_UNREGISTER, ptr);
+		event = NETDEV_REGISTER;
+	}
 	if (event != NETDEV_REGISTER &&
 	    event != NETDEV_UNREGISTER)
 		return NOTIFY_DONE;
diff --git a/net/netfilter/nft_chain_filter.c b/net/netfilter/nft_chain_filter.c
index ec44c27a9d91..4f13591e5cd1 100644
--- a/net/netfilter/nft_chain_filter.c
+++ b/net/netfilter/nft_chain_filter.c
@@ -372,6 +372,10 @@  static int nf_tables_netdev_event(struct notifier_block *this,
 		.net	= dev_net(dev),
 	};
 
+	if (event == NETDEV_CHANGENAME) {
+		nf_tables_netdev_event(this, NETDEV_UNREGISTER, ptr);
+		event = NETDEV_REGISTER;
+	}
 	if (event != NETDEV_REGISTER &&
 	    event != NETDEV_UNREGISTER)
 		return NOTIFY_DONE;