From db82b52dbd90dfc7bab265c50947747dd4c27c5f Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 13 May 2020 10:09:43 +0200 Subject: [PATCH] libnm-core: add _nm_ip_tunnel_mode_is_layer2() (cherry picked from commit 48c93b3bba928b594a5e5dec6b51382fcff97701) (cherry picked from commit 5d2f2a65493401e4d793890a22ebe7731d2f88f9) (cherry picked from commit d0f275e7f51cf8b7a78f56cc547a0c0ee270b387) --- libnm-core/nm-core-internal.h | 4 ++++ libnm-core/nm-setting-ip-tunnel.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index 868f731214..1fa8ac5de6 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -875,4 +875,8 @@ gboolean nm_utils_connection_is_adhoc_wpa (NMConnection *connection); const char *nm_utils_wifi_freq_to_band (guint32 freq); +/*****************************************************************************/ + +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 b4921feaa2..844555f074 100644 --- a/libnm-core/nm-setting-ip-tunnel.c +++ b/libnm-core/nm-setting-ip-tunnel.c @@ -305,6 +305,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) { @@ -458,9 +466,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,