mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-14 20:18:39 +00: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
This commit is contained in:
parent
1784fc9fa1
commit
4655b7c308
|
@ -82,6 +82,8 @@ create_and_realize(NMDevice *device,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const char *iface = nm_device_get_iface(device);
|
const char *iface = nm_device_get_iface(device);
|
||||||
|
const char *peer;
|
||||||
|
NMDevice *peer_device;
|
||||||
NMSettingVeth *s_veth;
|
NMSettingVeth *s_veth;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -96,10 +98,15 @@ create_and_realize(NMDevice *device,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = nm_platform_link_veth_add(nm_device_get_platform(device),
|
peer = nm_setting_veth_get_peer(s_veth);
|
||||||
iface,
|
peer_device = nm_manager_get_device(NM_MANAGER_GET, peer, NM_DEVICE_TYPE_VETH);
|
||||||
nm_setting_veth_get_peer(s_veth),
|
if (peer_device) {
|
||||||
out_plink);
|
/* 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) {
|
if (r < 0) {
|
||||||
g_set_error(error,
|
g_set_error(error,
|
||||||
NM_DEVICE_ERROR,
|
NM_DEVICE_ERROR,
|
||||||
|
|
Loading…
Reference in a new issue