libnm-core: add _nm_ip_tunnel_mode_is_layer2()

This commit is contained in:
Beniamino Galvani 2020-05-13 10:09:43 +02:00
parent 623cb3dc87
commit 48c93b3bba
2 changed files with 14 additions and 3 deletions

View file

@ -927,4 +927,9 @@ gboolean _nmtst_variant_attribute_spec_assert_sorted (const NMVariantAttributeSp
const NMVariantAttributeSpec *_nm_variant_attribute_spec_find_binary_search (const NMVariantAttributeSpec *const*array,
gsize len,
const char *name);
/*****************************************************************************/
gboolean _nm_ip_tunnel_mode_is_layer2 (NMIPTunnelMode mode);
#endif

View file

@ -291,6 +291,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)
{
@ -444,9 +452,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,