mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-28 08:40:49 +01:00
veth: fix veth activation on booting
When creating one profile for each veth during activation the creation
of the veth could fail. When the link for the first profile is created
the link for the peer is generated in kernel. Therefore when trying to
activate the second profile it will fail because the link already
exists. NetworkManager must check if the link already exists and
corresponds to the same veth, if so, it should skip the link creation.
https://bugzilla.redhat.com/show_bug.cgi?id=2036023
https://bugzilla.redhat.com/show_bug.cgi?id=2105956
(cherry picked from commit 4655b7c308)
This commit is contained in:
parent
61cfdae2e6
commit
36bb9a569a
1 changed files with 11 additions and 4 deletions
|
|
@ -82,6 +82,8 @@ create_and_realize(NMDevice *device,
|
|||
GError **error)
|
||||
{
|
||||
const char *iface = nm_device_get_iface(device);
|
||||
const char *peer;
|
||||
NMDevice *peer_device;
|
||||
NMSettingVeth *s_veth;
|
||||
int r;
|
||||
|
||||
|
|
@ -96,10 +98,15 @@ create_and_realize(NMDevice *device,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
r = nm_platform_link_veth_add(nm_device_get_platform(device),
|
||||
iface,
|
||||
nm_setting_veth_get_peer(s_veth),
|
||||
out_plink);
|
||||
peer = nm_setting_veth_get_peer(s_veth);
|
||||
peer_device = nm_manager_get_device(NM_MANAGER_GET, peer, NM_DEVICE_TYPE_VETH);
|
||||
if (peer_device) {
|
||||
/* The veth device and its peer already exist. No need to create it again. */
|
||||
if (nm_streq0(nm_device_get_iface(nm_device_parent_get_device(peer_device)), iface))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
r = nm_platform_link_veth_add(nm_device_get_platform(device), iface, peer, out_plink);
|
||||
if (r < 0) {
|
||||
g_set_error(error,
|
||||
NM_DEVICE_ERROR,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue