Commit 311cca4
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: d903102 ("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>1 parent a602ee3 commit 311cca4
1 file changed
+31
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1123 | 1123 | | |
1124 | 1124 | | |
1125 | 1125 | | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
1126 | 1146 | | |
1127 | 1147 | | |
1128 | 1148 | | |
| |||
1160 | 1180 | | |
1161 | 1181 | | |
1162 | 1182 | | |
1163 | | - | |
1164 | | - | |
1165 | | - | |
1166 | | - | |
1167 | | - | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
1171 | | - | |
1172 | | - | |
1173 | | - | |
| 1183 | + | |
| 1184 | + | |
1174 | 1185 | | |
1175 | | - | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
1176 | 1190 | | |
1177 | 1191 | | |
1178 | 1192 | | |
| |||
11038 | 11052 | | |
11039 | 11053 | | |
11040 | 11054 | | |
| 11055 | + | |
11041 | 11056 | | |
11042 | 11057 | | |
11043 | 11058 | | |
| |||
11064 | 11079 | | |
11065 | 11080 | | |
11066 | 11081 | | |
11067 | | - | |
| 11082 | + | |
11068 | 11083 | | |
11069 | 11084 | | |
11070 | 11085 | | |
| |||
11135 | 11150 | | |
11136 | 11151 | | |
11137 | 11152 | | |
| 11153 | + | |
| 11154 | + | |
| 11155 | + | |
11138 | 11156 | | |
11139 | 11157 | | |
11140 | 11158 | | |
| |||
0 commit comments