linux/net
Xiao Liang 69c7be1b90 rtnetlink: Pack newlink() params into struct
There are 4 net namespaces involved when creating links:

 - source netns - where the netlink socket resides,
 - target netns - where to put the device being created,
 - link netns - netns associated with the device (backend),
 - peer netns - netns of peer device.

Currently, two nets are passed to newlink() callback - "src_net"
parameter and "dev_net" (implicitly in net_device). They are set as
follows, depending on netlink attributes in the request.

 +------------+-------------------+---------+---------+
 | peer netns | IFLA_LINK_NETNSID | src_net | dev_net |
 +------------+-------------------+---------+---------+
 |            | absent            | source  | target  |
 | absent     +-------------------+---------+---------+
 |            | present           | link    | link    |
 +------------+-------------------+---------+---------+
 |            | absent            | peer    | target  |
 | present    +-------------------+---------+---------+
 |            | present           | peer    | link    |
 +------------+-------------------+---------+---------+

When IFLA_LINK_NETNSID is present, the device is created in link netns
first and then moved to target netns. This has some side effects,
including extra ifindex allocation, ifname validation and link events.
These could be avoided if we create it in target netns from
the beginning.

On the other hand, the meaning of src_net parameter is ambiguous. It
varies depending on how parameters are passed. It is the effective
link (or peer netns) by design, but some drivers ignore it and use
dev_net instead.

To provide more netns context for drivers, this patch packs existing
newlink() parameters, along with the source netns, link netns and peer
netns, into a struct. The old "src_net" is renamed to "net" to avoid
confusion with real source netns, and will be deprecated later. The use
of src_net are converted to params->net trivially.

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250219125039.18024-3-shaw.leon@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-02-21 15:28:02 -08:00
..
6lowpan
9p net/9p/usbg: allow building as standalone module 2024-11-22 23:48:14 +09:00
802 net: 802: LLC+SNAP OID:PID lookup on start of skb data 2025-01-04 08:06:24 -08:00
8021q rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
appletalk net: appletalk: Drop aarp_send_probe_phase1() 2025-01-20 10:08:19 +00:00
atm
ax25 ax25: Fix refcount leak caused by setting SO_BINDTODEVICE sockopt 2025-02-06 17:02:40 -08:00
batman-adv rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
bluetooth Including fixes from netfilter, wireless and bluetooth. 2025-02-13 12:17:04 -08:00
bpf bpf-next-6.14 2025-01-23 08:04:07 -08:00
bridge rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
caif rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
can net: initialize mark in sockcm_init 2025-02-18 18:27:19 -08:00
ceph ceph: allocate sparse_ext map only for sparse reads 2024-12-16 23:25:44 +01:00
core rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
dcb
dccp inet: consolidate inet_csk_clone_lock() 2025-02-14 13:40:33 -08:00
devlink devlink: Improve the port attributes description 2025-01-02 17:10:57 -08:00
dns_resolver
dsa net: dsa: allow use of phylink managed EEE support 2025-02-12 18:20:04 -08:00
ethernet
ethtool net: move stale comment about ntuple validation 2025-02-17 16:47:01 -08:00
handshake module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
hsr rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
ieee802154 rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
ife
ipv4 rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
ipv6 rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
iucv s390/iucv: MSG_PEEK causes memory leak in iucv_sock_destruct() 2024-11-26 10:02:53 +01:00
kcm
key
l2tp ipv6: replace ipcm6_init calls with ipcm6_init_sk 2025-02-18 18:27:20 -08:00
l3mdev
lapb
llc sysctl net: Remove macro checks for CONFIG_SYSCTL 2025-01-20 12:01:34 -08:00
mac80211 Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
mac802154 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-01-09 16:11:47 -08:00
mctp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-12-19 11:35:07 -08:00
mpls
mptcp mptcp: micro-optimize __mptcp_move_skb() 2025-02-19 19:05:29 -08:00
ncsi net/ncsi: use dev_set_mac_address() for Get MC MAC Address handling 2025-01-27 09:20:07 +00:00
netfilter Revert "netfilter: flowtable: teardown flow if cached mtu is stale" 2025-02-12 10:35:20 +01:00
netlabel net: corrections for security_secid_to_secctx returns 2025-01-04 22:11:22 -05:00
netlink netlink: Unset cb_running when terminating dump on release 2025-02-18 18:03:12 -08:00
netrom netrom: check buffer length before accessing it 2024-12-23 10:04:55 -08:00
nfc nfc: hci: Remove unused nfc_llc_unregister 2025-02-19 19:04:26 -08:00
nsh
openvswitch openvswitch: use RCU protection in ovs_vport_cmd_fill_info() 2025-02-10 18:09:09 -08:00
packet net: initialize mark in sockcm_init 2025-02-18 18:27:19 -08:00
phonet phonet: do not call synchronize_rcu() from phonet_route_del() 2024-11-07 20:34:16 -08:00
psample psample: adjust size if rate_as_probability is set 2024-12-18 19:23:04 -08:00
qrtr
rds rds: sysctl: rds_tcp_{rcv,snd}buf: avoid using current->nsproxy 2025-01-09 08:53:35 -08:00
rfkill Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
rose net: rose: lock the socket in rose_bind() 2025-02-04 14:03:58 -08:00
rxrpc rxrpc: Fix ipv6 path MTU discovery 2025-02-13 10:00:12 -08:00
sched ip_tunnel: Use ip_tunnel_info() helper instead of 'info + 1' 2025-02-20 13:17:16 -08:00
sctp sctp: Fix undefined behavior in left shift operation 2025-02-19 18:55:40 -08:00
shaper net: add netdev_lock() / netdev_unlock() helpers 2025-01-15 19:13:33 -08:00
smc net/smc: fix data error when recvmsg with MSG_PEEK flag 2025-01-13 18:59:00 -08:00
strparser
sunrpc assorted stuff for this merge window 2025-02-01 15:07:56 -08:00
switchdev
tipc tipc: re-order conditions in tipc_crypto_key_rcv() 2025-01-20 12:18:26 +00:00
tls tls: skip setting sk_write_space on rekey 2025-01-10 18:34:45 -08:00
unix af_unix: Fix undefined 'other' error 2025-02-20 15:28:46 -08:00
vmw_vsock vsock/bpf: Warn on socket without transport 2025-02-18 12:00:01 +01:00
wireless Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
x25
xdp net: use napi_id_valid helper 2025-02-17 16:43:04 -08:00
xfrm rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
compat.c
devres.c
Kconfig
Kconfig.debug
Makefile
socket.c fsnotify: disable notification by default for all pseudo files 2025-02-07 10:27:26 +01:00
sysctl_net.c