diff options
author | Thomas Haller <thaller@redhat.com> | 2016-01-25 13:03:51 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-01-25 13:35:10 +0100 |
commit | 66438de577f9f0f99ea11f4a4f8dfc4168362c1d (patch) | |
tree | f77461c061a2e11f834ed04aac450618e8a338bd /src | |
parent | 809c547b6c8522570add25581b41b3514a5c5dfb (diff) | |
download | NetworkManager-66438de577f9f0f99ea11f4a4f8dfc4168362c1d.tar.gz |
core: reject existing links when trying to add a link via platform
When we decide to add a new link, we alredy checked that no such link exists
(ignoring race conditions).
It is wrong to accept a EXITS failure when adding the link. There is no guarantee
that the existing link has all the same properties as the one we intend to add.
More importantly, this link was added externally outside of NetworkManager and it
should not be taken over.
Just treat EXISTS as a failure as any other.
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/nm-device-bond.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device-bridge.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device-infiniband.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device-ip-tunnel.c | 8 | ||||
-rw-r--r-- | src/devices/nm-device-macvlan.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device-tun.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device-vlan.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device-vxlan.c | 2 | ||||
-rw-r--r-- | src/devices/team/nm-device-team.c | 2 |
9 files changed, 12 insertions, 12 deletions
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index dfd1de6dfb..fda1085063 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -457,7 +457,7 @@ create_and_realize (NMDevice *device, g_assert (iface); plerr = nm_platform_link_bond_add (NM_PLATFORM_GET, iface, out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create bond interface '%s' for '%s': %s", iface, diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index 843c5be499..4e23de2bb4 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -405,7 +405,7 @@ create_and_realize (NMDevice *device, hwaddr ? mac_address : NULL, hwaddr ? ETH_ALEN : 0, out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create bridge interface '%s' for '%s': %s", iface, diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c index 45df49fe02..789cf5f39f 100644 --- a/src/devices/nm-device-infiniband.c +++ b/src/devices/nm-device-infiniband.c @@ -272,7 +272,7 @@ create_and_realize (NMDevice *device, } plerr = nm_platform_link_infiniband_add (NM_PLATFORM_GET, parent_ifindex, p_key, out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create InfiniBand P_Key interface '%s' for '%s': %s", nm_device_get_iface (device), diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c index fe105cc87b..7923d545ba 100644 --- a/src/devices/nm-device-ip-tunnel.c +++ b/src/devices/nm-device-ip-tunnel.c @@ -661,7 +661,7 @@ create_and_realize (NMDevice *device, } plerr = nm_platform_link_gre_add (NM_PLATFORM_GET, iface, &lnk_gre, out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create GRE interface '%s' for '%s': %s", iface, @@ -687,7 +687,7 @@ create_and_realize (NMDevice *device, lnk_sit.path_mtu_discovery = nm_setting_ip_tunnel_get_path_mtu_discovery (s_ip_tunnel); plerr = nm_platform_link_sit_add (NM_PLATFORM_GET, iface, &lnk_sit, out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create SIT interface '%s' for '%s': %s", iface, @@ -713,7 +713,7 @@ create_and_realize (NMDevice *device, lnk_ipip.path_mtu_discovery = nm_setting_ip_tunnel_get_path_mtu_discovery (s_ip_tunnel); plerr = nm_platform_link_ipip_add (NM_PLATFORM_GET, iface, &lnk_ipip, out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create IPIP interface '%s' for '%s': %s", iface, @@ -742,7 +742,7 @@ create_and_realize (NMDevice *device, lnk_ip6tnl.proto = nm_setting_ip_tunnel_get_mode (s_ip_tunnel) == NM_IP_TUNNEL_MODE_IPIP6 ? IPPROTO_IPIP : IPPROTO_IPV6; plerr = nm_platform_link_ip6tnl_add (NM_PLATFORM_GET, iface, &lnk_ip6tnl, out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create IPIP interface '%s' for '%s': %s", iface, diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c index 6f3ac4b181..01e5b6ab6b 100644 --- a/src/devices/nm-device-macvlan.c +++ b/src/devices/nm-device-macvlan.c @@ -238,7 +238,7 @@ create_and_realize (NMDevice *device, lnk.tap = nm_setting_macvlan_get_tap (s_macvlan); plerr = nm_platform_link_macvlan_add (NM_PLATFORM_GET, iface, parent_ifindex, &lnk, out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create %s interface '%s' for '%s': %s", lnk.tap ? "macvtap" : "macvlan", diff --git a/src/devices/nm-device-tun.c b/src/devices/nm-device-tun.c index 91ef8fe704..011cac0022 100644 --- a/src/devices/nm-device-tun.c +++ b/src/devices/nm-device-tun.c @@ -222,7 +222,7 @@ create_and_realize (NMDevice *device, nm_setting_tun_get_vnet_hdr (s_tun), nm_setting_tun_get_multi_queue (s_tun), out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create TUN/TAP interface '%s' for '%s': %s", iface, diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index f8710412b7..dfd7a8addf 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -237,7 +237,7 @@ create_and_realize (NMDevice *device, vlan_id, nm_setting_vlan_get_flags (s_vlan), out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create VLAN interface '%s' for '%s': %s", iface, diff --git a/src/devices/nm-device-vxlan.c b/src/devices/nm-device-vxlan.c index aab9053970..4e5e48f9ea 100644 --- a/src/devices/nm-device-vxlan.c +++ b/src/devices/nm-device-vxlan.c @@ -224,7 +224,7 @@ create_and_realize (NMDevice *device, props.l3miss = nm_setting_vxlan_get_l3_miss (s_vxlan); plerr = nm_platform_link_vxlan_add (NM_PLATFORM_GET, iface, &props, out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create VXLAN interface '%s' for '%s': %s", iface, diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index c0b83b8442..c6e527aa87 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -673,7 +673,7 @@ create_and_realize (NMDevice *device, NMPlatformError plerr; plerr = nm_platform_link_team_add (NM_PLATFORM_GET, iface, out_plink); - if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { + if (plerr != NM_PLATFORM_ERROR_SUCCESS) { g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, "Failed to create team master interface '%s' for '%s': %s", iface, |