libnm-core: add _nm_ip_tunnel_mode_is_layer2()

(cherry picked from commit 48c93b3bba)
(cherry picked from commit 5d2f2a6549)
(cherry picked from commit d0f275e7f5)
This commit is contained in:
Beniamino Galvani 2020-05-13 10:09:43 +02:00
parent 53cb8ce245
commit db82b52dbd
2 changed files with 13 additions and 3 deletions

View file

@ -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

View file

@ -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,