summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2020-05-13 10:09:43 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2020-05-15 10:24:48 +0200
commitae208023f26b89de36b8ca82d5c33b8f5e2d06f8 (patch)
treeb12aa96273f34d1a70eed793aae7c286a888fb36
parent20fa4433f206c1c231490148b363e3c242d2c965 (diff)
downloadNetworkManager-ae208023f26b89de36b8ca82d5c33b8f5e2d06f8.tar.gz
libnm-core: add _nm_ip_tunnel_mode_is_layer2()
(cherry picked from commit 48c93b3bba928b594a5e5dec6b51382fcff97701) (cherry picked from commit 5d2f2a65493401e4d793890a22ebe7731d2f88f9) (cherry picked from commit d0f275e7f51cf8b7a78f56cc547a0c0ee270b387) (cherry picked from commit db82b52dbd90dfc7bab265c50947747dd4c27c5f)
-rw-r--r--libnm-core/nm-core-internal.h4
-rw-r--r--libnm-core/nm-setting-ip-tunnel.c12
2 files changed, 13 insertions, 3 deletions
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h
index 3e33dd930d..8253558213 100644
--- a/libnm-core/nm-core-internal.h
+++ b/libnm-core/nm-core-internal.h
@@ -802,4 +802,8 @@ void _nm_bridge_vlan_str_append_rest (const NMBridgeVlan *vlan,
GString *string,
gboolean leading_space);
+/*****************************************************************************/
+
+gboolean _nm_ip_tunnel_mode_is_layer2 (NMIPTunnelMode mode);
+
#endif
diff --git a/libnm-core/nm-setting-ip-tunnel.c b/libnm-core/nm-setting-ip-tunnel.c
index 42c44c1cd1..b72b6b4c6f 100644
--- a/libnm-core/nm-setting-ip-tunnel.c
+++ b/libnm-core/nm-setting-ip-tunnel.c
@@ -306,6 +306,14 @@ nm_setting_ip_tunnel_get_flags (NMSettingIPTunnel *setting)
/*****************************************************************************/
+gboolean
+_nm_ip_tunnel_mode_is_layer2 (NMIPTunnelMode mode)
+{
+ return NM_IN_SET (mode,
+ NM_IP_TUNNEL_MODE_GRETAP,
+ NM_IP_TUNNEL_MODE_IP6GRETAP);
+}
+
static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
@@ -459,9 +467,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
}
if ( nm_connection_get_setting_wired (connection)
- && !NM_IN_SET (priv->mode,
- NM_IP_TUNNEL_MODE_GRETAP,
- NM_IP_TUNNEL_MODE_IP6GRETAP)) {
+ && !_nm_ip_tunnel_mode_is_layer2 (priv->mode)) {
g_set_error (error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,