summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2020-05-13 10:10:13 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2020-05-15 10:25:49 +0200
commitd4c2be5f2850b0590998fbf9c3a0c2d1ae6fc990 (patch)
tree791cb1e2c82fbe6dd2b914eb99ac061c6338a5db
parentae208023f26b89de36b8ca82d5c33b8f5e2d06f8 (diff)
downloadNetworkManager-d4c2be5f2850b0590998fbf9c3a0c2d1ae6fc990.tar.gz
ip-tunnel: set cloned-mac-address only for layer2 tunnel devices
For ip-tunnel modes that encapsulate layer2 packets (gretap and ip6gretap) we allow the presence of an ethernet setting in the connection and honor the cloned-mac-address specified in it. For all other modes, the ethernet setting is removed during normalization, but a value different from 'preserve' could be set via global default. The kernel doesn't allow setting a MAC for layer3 devices, don't do it. (cherry picked from commit 0494a84878e696baccbf3b1d16089b92cb7c7835) (cherry picked from commit 78ed14166c04006aaa0e15a2930066ff212f088b) (cherry picked from commit d69d92c658eb0ca21f789c131b73dd2508570653) (cherry picked from commit 60b4bdafcf71a68abc08afd388b4ff405b12fb19)
-rw-r--r--src/devices/nm-device-ip-tunnel.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c
index 68bf542327..de2f2afa55 100644
--- a/src/devices/nm-device-ip-tunnel.c
+++ b/src/devices/nm-device-ip-tunnel.c
@@ -970,13 +970,16 @@ set_property (GObject *object, guint prop_id,
static NMActStageReturn
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
{
+ NMDeviceIPTunnel *self = NM_DEVICE_IP_TUNNEL (device);
+ NMDeviceIPTunnelPrivate *priv = NM_DEVICE_IP_TUNNEL_GET_PRIVATE (self);
NMActStageReturn ret;
ret = NM_DEVICE_CLASS (nm_device_ip_tunnel_parent_class)->act_stage1_prepare (device, out_failure_reason);
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
return ret;
- if (!nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE))
+ if ( _nm_ip_tunnel_mode_is_layer2 (priv->mode)
+ && !nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE))
return NM_ACT_STAGE_RETURN_FAILURE;
return NM_ACT_STAGE_RETURN_SUCCESS;