libnm-core: add _nm_ip_tunnel_mode_is_layer2()

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

View file

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

View file

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