Skip to content

Commit d0d14ae

Browse files
q2venkuba-moo
authored andcommitted
neighbour: Use rtnl_register_many().
We will remove rtnl_register() in favour of rtnl_register_many(). When it succeeds, rtnl_register_many() guarantees all rtnetlink types in the passed array are supported, and there is no chance that a part of message types is not supported. Let's use rtnl_register_many() instead. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20241014201828.91221-4-kuniyu@amazon.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 181bc78 commit d0d14ae

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

net/core/neighbour.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3886,17 +3886,18 @@ EXPORT_SYMBOL(neigh_sysctl_unregister);
38863886

38873887
#endif /* CONFIG_SYSCTL */
38883888

3889+
static const struct rtnl_msg_handler neigh_rtnl_msg_handlers[] __initconst = {
3890+
{.msgtype = RTM_NEWNEIGH, .doit = neigh_add},
3891+
{.msgtype = RTM_DELNEIGH, .doit = neigh_delete},
3892+
{.msgtype = RTM_GETNEIGH, .doit = neigh_get, .dumpit = neigh_dump_info,
3893+
.flags = RTNL_FLAG_DUMP_UNLOCKED},
3894+
{.msgtype = RTM_GETNEIGHTBL, .dumpit = neightbl_dump_info},
3895+
{.msgtype = RTM_SETNEIGHTBL, .doit = neightbl_set},
3896+
};
3897+
38893898
static int __init neigh_init(void)
38903899
{
3891-
rtnl_register(PF_UNSPEC, RTM_NEWNEIGH, neigh_add, NULL, 0);
3892-
rtnl_register(PF_UNSPEC, RTM_DELNEIGH, neigh_delete, NULL, 0);
3893-
rtnl_register(PF_UNSPEC, RTM_GETNEIGH, neigh_get, neigh_dump_info,
3894-
RTNL_FLAG_DUMP_UNLOCKED);
3895-
3896-
rtnl_register(PF_UNSPEC, RTM_GETNEIGHTBL, NULL, neightbl_dump_info,
3897-
0);
3898-
rtnl_register(PF_UNSPEC, RTM_SETNEIGHTBL, neightbl_set, NULL, 0);
3899-
3900+
rtnl_register_many(neigh_rtnl_msg_handlers);
39003901
return 0;
39013902
}
39023903

0 commit comments

Comments
 (0)