diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2020-05-05 10:54:10 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2020-05-06 11:40:41 +0200 |
commit | 426f0b60ec12dab0b1df12b44e598a62c943c94c (patch) | |
tree | 88bfe075387df2a96e41efd9513328990525f779 /src/devices/nm-device.c | |
parent | 05fd2a9272faf8a57116d1624e1a32b4aa9f2994 (diff) | |
download | NetworkManager-bg/shared-firewalld.tar.gz |
core: install a firewalld zone for connection sharingbg/shared-firewalld
https://bugzilla.redhat.com/show_bug.cgi?id=1829637
Diffstat (limited to 'src/devices/nm-device.c')
-rw-r--r-- | src/devices/nm-device.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 27b1b600b1..cb255df1e1 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -10922,6 +10922,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); @@ -10939,9 +10940,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); |