diff options
author | Jakub Kicinski <kuba@kernel.org> | 2023-10-18 04:38:13 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-10-19 16:51:16 +0300 |
commit | 311cca40661f428b7aa114fb5af578cfdbe3e8b6 (patch) | |
tree | 635ca0397b0e60cb40069cf02ef581f2a0e672a9 /block/blk-mq-pci.c | |
parent | a602ee3176a81280b829c9f0cf259450f7982168 (diff) | |
download | linux-311cca40661f428b7aa114fb5af578cfdbe3e8b6.tar.xz |
net: fix ifname in netlink ntf during netns move
dev_get_valid_name() overwrites the netdev's name on success.
This makes it hard to use in prepare-commit-like fashion,
where we do validation first, and "commit" to the change
later.
Factor out a helper which lets us save the new name to a buffer.
Use it to fix the problem of notification on netns move having
incorrect name:
5: eth0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether be:4d:58:f9:d5:40 brd ff:ff:ff:ff:ff:ff
6: eth1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether 1e:4a:34:36:e3:cd brd ff:ff:ff:ff:ff:ff
[ ~]# ip link set dev eth0 netns 1 name eth1
ip monitor inside netns:
Deleted inet eth0
Deleted inet6 eth0
Deleted 5: eth1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether be:4d:58:f9:d5:40 brd ff:ff:ff:ff:ff:ff new-netnsid 0 new-ifindex 7
Name is reported as eth1 in old netns for ifindex 5, already renamed.
Fixes: d90310243fd7 ("net: device name allocation cleanups")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'block/blk-mq-pci.c')
0 files changed, 0 insertions, 0 deletions