]> www.infradead.org Git - users/jedix/linux-maple.git/commit
rtnetlink: Add peer_type in struct rtnl_link_ops.
authorKuniyuki Iwashima <kuniyu@amazon.com>
Fri, 8 Nov 2024 00:48:18 +0000 (16:48 -0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 12 Nov 2024 01:26:52 +0000 (17:26 -0800)
commit28690e5361c05fd4ef0ca3a17d1c667cba790554
tree1d11d4f82e4d6cbd2e9e1e734fc4aaca55110fab
parentcbaaa6326bc58e75239df437a8fdcdb2335d3b24
rtnetlink: Add peer_type in struct rtnl_link_ops.

In ops->newlink(), veth, vxcan, and netkit call rtnl_link_get_net() with
a net pointer, which is the first argument of ->newlink().

rtnl_link_get_net() could return another netns based on IFLA_NET_NS_PID
and IFLA_NET_NS_FD in the peer device's attributes.

We want to get it and fill rtnl_nets->nets[] in advance in rtnl_newlink()
for per-netns RTNL.

All of the three get the peer netns in the same way:

  1. Call rtnl_nla_parse_ifinfomsg()
  2. Call ops->validate() (vxcan doesn't have)
  3. Call rtnl_link_get_net_tb()

Let's add a new field peer_type to struct rtnl_link_ops and prefetch
netns in the peer ifla to add it to rtnl_nets in rtnl_newlink().

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/20241108004823.29419-6-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/rtnetlink.h
net/core/rtnetlink.c