diff options
| author | Michael Biebl <biebl@debian.org> | 2020-05-30 00:23:54 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2020-05-30 00:23:54 +0200 |
| commit | 45e8e1149027529194982212c804c0468aa01d98 (patch) | |
| tree | f3acb5e5824dd8b13f1a48bb516b0c92c5f052fd /src/devices | |
| parent | d460892bbfece74fb6d3cd846bf6ef548290be41 (diff) | |
New upstream version 1.24.2 upstream/1.24.2
Diffstat (limited to 'src/devices')
| -rw-r--r-- | src/devices/nm-device-ip-tunnel.c | 35 | ||||
| -rw-r--r-- | src/devices/nm-device.c | 13 |
2 files changed, 37 insertions, 11 deletions
diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c index 0a33c82e..2c9a6050 100644 --- a/src/devices/nm-device-ip-tunnel.c +++ b/src/devices/nm-device-ip-tunnel.c @@ -667,7 +667,8 @@ create_and_realize (NMDevice *device, mode = nm_setting_ip_tunnel_get_mode (s_ip_tunnel); - if ( nm_device_hw_addr_get_cloned (device, + if ( _nm_ip_tunnel_mode_is_layer2 (mode) + && nm_device_hw_addr_get_cloned (device, connection, FALSE, &hwaddr, @@ -686,13 +687,6 @@ create_and_realize (NMDevice *device, g_return_val_if_reached (FALSE); } - if (NM_IN_SET (mode, NM_IP_TUNNEL_MODE_GRE)) { - g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, - "Invalid hardware address '%s' for tunnel type", - hwaddr); - return FALSE; - } - mac_address_valid = TRUE; } @@ -849,7 +843,10 @@ create_and_realize (NMDevice *device, lnk_ip6tnl.is_tap = (mode == NM_IP_TUNNEL_MODE_IP6GRETAP); r = nm_platform_link_ip6gre_add (nm_device_get_platform (device), - iface, &lnk_ip6tnl, out_plink); + iface, + mac_address_valid ? mac_address : NULL, + mac_address_valid ? ETH_ALEN : 0, + &lnk_ip6tnl, out_plink); } else { lnk_ip6tnl.proto = nm_setting_ip_tunnel_get_mode (s_ip_tunnel) == NM_IP_TUNNEL_MODE_IPIP6 ? IPPROTO_IPIP @@ -929,6 +926,23 @@ can_reapply_change (NMDevice *device, error); } +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); + + if ( _nm_ip_tunnel_mode_is_layer2 (priv->mode) + && !nm_device_hw_addr_set_cloned (device, + nm_device_get_applied_connection (device), + FALSE)) { + *out_failure_reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED; + return NM_ACT_STAGE_RETURN_FAILURE; + } + + return NM_ACT_STAGE_RETURN_SUCCESS; +} + /*****************************************************************************/ static void @@ -1078,7 +1092,8 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *klass) NM_LINK_TYPE_IPIP, NM_LINK_TYPE_SIT); - device_class->act_stage1_prepare_set_hwaddr_ethernet = TRUE; + + device_class->act_stage1_prepare = act_stage1_prepare; device_class->link_changed = link_changed; device_class->can_reapply_change = can_reapply_change; device_class->complete_connection = complete_connection; diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 8a22cba8..76c24a38 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -10879,6 +10879,7 @@ fw_change_zone (NMDevice *self) NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMConnection *applied_connection; NMSettingConnection *s_con; + const char *zone; nm_assert (priv->fw_state >= FIREWALL_STATE_INITIALIZED); @@ -10896,9 +10897,19 @@ fw_change_zone (NMDevice *self) if (G_UNLIKELY (!priv->fw_mgr)) priv->fw_mgr = g_object_ref (nm_firewall_manager_get ()); + zone = nm_setting_connection_get_zone (s_con); +#if WITH_FIREWALLD_ZONE + if (!zone || zone[0] == '\0') { + if ( nm_streq0 (nm_device_get_effective_ip_config_method (self, AF_INET), + NM_SETTING_IP4_CONFIG_METHOD_SHARED) + || nm_streq0 (nm_device_get_effective_ip_config_method (self, AF_INET6), + NM_SETTING_IP6_CONFIG_METHOD_SHARED)) + zone = "nm-shared"; + } +#endif priv->fw_call = nm_firewall_manager_add_or_change_zone (priv->fw_mgr, nm_device_get_ip_iface (self), - nm_setting_connection_get_zone (s_con), + zone, FALSE, /* change zone */ fw_change_zone_cb, self); |