summaryrefslogtreecommitdiff
path: root/net/core/net_namespace.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-10-15 18:52:28 -0700
committerJakub Kicinski <kuba@kernel.org>2024-10-15 18:52:29 -0700
commit53bac8330865417332d4cf80cb671b15956b049d (patch)
tree52e8a7c4c33b2e89e1485d7325c767ce4e23a938 /net/core/net_namespace.c
parentdf24129567f8458de3c0c7e08f9f0f1563f5dc75 (diff)
parente1c6c383123ab1caadbfe39b3362ce0cc09dd766 (diff)
Merge branch 'rtnetlink-use-rtnl_register_many'
Kuniyuki Iwashima says: ==================== rtnetlink: Use rtnl_register_many(). This series converts all rtnl_register() and rtnl_register_module() to rtnl_register_many() and finally removes them. Once this series is applied, I'll start converting doit() to per-netns RTNL. v1: https://lore.kernel.org/20241011220550.46040-1-kuniyu@amazon.com/ ==================== Link: https://patch.msgid.link/20241014201828.91221-1-kuniyu@amazon.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r--net/core/net_namespace.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 0a86aff17f51..809b48c0a528 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -1169,6 +1169,14 @@ static void __init netns_ipv4_struct_check(void)
}
#endif
+static const struct rtnl_msg_handler net_ns_rtnl_msg_handlers[] __initconst = {
+ {.msgtype = RTM_NEWNSID, .doit = rtnl_net_newid,
+ .flags = RTNL_FLAG_DOIT_UNLOCKED},
+ {.msgtype = RTM_GETNSID, .doit = rtnl_net_getid,
+ .dumpit = rtnl_net_dumpid,
+ .flags = RTNL_FLAG_DOIT_UNLOCKED | RTNL_FLAG_DUMP_UNLOCKED},
+};
+
void __init net_ns_init(void)
{
struct net_generic *ng;
@@ -1206,11 +1214,7 @@ void __init net_ns_init(void)
if (register_pernet_subsys(&net_ns_ops))
panic("Could not register network namespace subsystems");
- rtnl_register(PF_UNSPEC, RTM_NEWNSID, rtnl_net_newid, NULL,
- RTNL_FLAG_DOIT_UNLOCKED);
- rtnl_register(PF_UNSPEC, RTM_GETNSID, rtnl_net_getid, rtnl_net_dumpid,
- RTNL_FLAG_DOIT_UNLOCKED |
- RTNL_FLAG_DUMP_UNLOCKED);
+ rtnl_register_many(net_ns_rtnl_msg_handlers);
}
static void free_exit_list(struct pernet_operations *ops, struct list_head *net_exit_list)