mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 10:46:59 +00:00
libnm-core: add ovs-bridge setting
This commit is contained in:
parent
8a1ae40a80
commit
cb9b024ddb
|
@ -393,6 +393,7 @@ libnm_core_lib_h_pub_real = \
|
|||
libnm-core/nm-setting-macsec.h \
|
||||
libnm-core/nm-setting-macvlan.h \
|
||||
libnm-core/nm-setting-olpc-mesh.h \
|
||||
libnm-core/nm-setting-ovs-bridge.h \
|
||||
libnm-core/nm-setting-ovs-interface.h \
|
||||
libnm-core/nm-setting-ovs-patch.h \
|
||||
libnm-core/nm-setting-ovs-port.h \
|
||||
|
@ -477,6 +478,7 @@ libnm_core_lib_c_real = \
|
|||
libnm-core/nm-setting-macsec.c \
|
||||
libnm-core/nm-setting-macvlan.c \
|
||||
libnm-core/nm-setting-olpc-mesh.c \
|
||||
libnm-core/nm-setting-ovs-bridge.c \
|
||||
libnm-core/nm-setting-ovs-interface.c \
|
||||
libnm-core/nm-setting-ovs-patch.c \
|
||||
libnm-core/nm-setting-ovs-port.c \
|
||||
|
|
|
@ -262,6 +262,11 @@
|
|||
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this MAC-VLAN interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PROMISCUOUS N_("Whether the interface should be put in promiscuous mode.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_TAP N_("Whether the interface should be a MACVTAP.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_FAIL_MODE N_("The bridge failure mode. One of \"secure\", \"standalone\" or empty.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE N_("Enable or disable multicast snooping.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_RSTP_ENABLE N_("Enable or disable RSTP.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_STP_ENABLE N_("Enable or disable STP.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_TYPE N_("The interface type. Either \"internal\", or empty.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_PATCH_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
|
||||
|
|
|
@ -729,6 +729,10 @@ _nm_connection_detect_slave_type (NMConnection *connection, NMSetting **out_s_po
|
|||
i_slave_type = NM_SETTING_BRIDGE_SETTING_NAME;
|
||||
else if (!strcmp (name, NM_SETTING_TEAM_PORT_SETTING_NAME))
|
||||
i_slave_type = NM_SETTING_TEAM_SETTING_NAME;
|
||||
else if (!strcmp (name, NM_SETTING_OVS_PORT_SETTING_NAME))
|
||||
i_slave_type = NM_SETTING_OVS_BRIDGE_SETTING_NAME;
|
||||
else if (!strcmp (name, NM_SETTING_OVS_INTERFACE_SETTING_NAME))
|
||||
i_slave_type = NM_SETTING_OVS_PORT_SETTING_NAME;
|
||||
else
|
||||
continue;
|
||||
|
||||
|
@ -2017,6 +2021,7 @@ nm_connection_is_virtual (NMConnection *connection)
|
|||
|| !strcmp (type, NM_SETTING_IP_TUNNEL_SETTING_NAME)
|
||||
|| !strcmp (type, NM_SETTING_MACSEC_SETTING_NAME)
|
||||
|| !strcmp (type, NM_SETTING_MACVLAN_SETTING_NAME)
|
||||
|| !strcmp (type, NM_SETTING_OVS_BRIDGE_SETTING_NAME)
|
||||
|| !strcmp (type, NM_SETTING_OVS_INTERFACE_SETTING_NAME)
|
||||
|| !strcmp (type, NM_SETTING_OVS_PORT_SETTING_NAME)
|
||||
|| !strcmp (type, NM_SETTING_VXLAN_SETTING_NAME))
|
||||
|
@ -2371,6 +2376,22 @@ nm_connection_get_setting_olpc_mesh (NMConnection *connection)
|
|||
return _connection_get_setting_check (connection, NM_TYPE_SETTING_OLPC_MESH);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_get_setting_ovs_bridge:
|
||||
* @connection: the #NMConnection
|
||||
*
|
||||
* A shortcut to return any #NMSettingOvsBridge the connection might contain.
|
||||
*
|
||||
* Returns: (transfer none): an #NMSettingOvsBridge if the connection contains one, otherwise %NULL
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
NMSettingOvsBridge *
|
||||
nm_connection_get_setting_ovs_bridge (NMConnection *connection)
|
||||
{
|
||||
return _connection_get_setting_check (connection, NM_TYPE_SETTING_OVS_BRIDGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_get_setting_ovs_interface:
|
||||
* @connection: the #NMConnection
|
||||
|
|
|
@ -214,6 +214,8 @@ NM_AVAILABLE_IN_1_2
|
|||
NMSettingMacvlan * nm_connection_get_setting_macvlan (NMConnection *connection);
|
||||
NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection);
|
||||
NM_AVAILABLE_IN_1_10
|
||||
NMSettingOvsBridge * nm_connection_get_setting_ovs_bridge (NMConnection *connection);
|
||||
NM_AVAILABLE_IN_1_10
|
||||
NMSettingOvsInterface * nm_connection_get_setting_ovs_interface (NMConnection *connection);
|
||||
NMSettingOvsPatch * nm_connection_get_setting_ovs_patch (NMConnection *connection);
|
||||
NM_AVAILABLE_IN_1_10
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "nm-setting-macsec.h"
|
||||
#include "nm-setting-macvlan.h"
|
||||
#include "nm-setting-olpc-mesh.h"
|
||||
#include "nm-setting-ovs-bridge.h"
|
||||
#include "nm-setting-ovs-interface.h"
|
||||
#include "nm-setting-ovs-patch.h"
|
||||
#include "nm-setting-ovs-port.h"
|
||||
|
|
|
@ -50,6 +50,7 @@ typedef struct _NMSettingIP6Config NMSettingIP6Config;
|
|||
typedef struct _NMSettingMacsec NMSettingMacsec;
|
||||
typedef struct _NMSettingMacvlan NMSettingMacvlan;
|
||||
typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh;
|
||||
typedef struct _NMSettingOvsBridge NMSettingOvsBridge;
|
||||
typedef struct _NMSettingOvsInterface NMSettingOvsInterface;
|
||||
typedef struct _NMSettingOvsPatch NMSettingOvsPatch;
|
||||
typedef struct _NMSettingOvsPort NMSettingOvsPort;
|
||||
|
|
|
@ -1006,6 +1006,18 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
}
|
||||
|
||||
if ( g_strcmp0 (priv->type, NM_SETTING_OVS_PORT_SETTING_NAME) != 0
|
||||
&& g_strcmp0 (priv->slave_type, NM_SETTING_OVS_BRIDGE_SETTING_NAME) == 0) {
|
||||
g_set_error (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_MISSING_PROPERTY,
|
||||
_("Only '%s' connections can be enslaved to '%s'"),
|
||||
NM_SETTING_OVS_PORT_SETTING_NAME,
|
||||
NM_SETTING_OVS_BRIDGE_SETTING_NAME);
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_TYPE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->metered != NM_METERED_UNKNOWN &&
|
||||
priv->metered != NM_METERED_YES &&
|
||||
priv->metered != NM_METERED_NO) {
|
||||
|
|
337
libnm-core/nm-setting-ovs-bridge.c
Normal file
337
libnm-core/nm-setting-ovs-bridge.c
Normal file
|
@ -0,0 +1,337 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2017 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-setting-ovs-bridge.h"
|
||||
|
||||
#include "nm-connection-private.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-private.h"
|
||||
|
||||
/**
|
||||
* SECTION:nm-setting-ovs-bridge
|
||||
* @short_description: Describes connection properties for OpenVSwitch bridges.
|
||||
*
|
||||
* The #NMSettingOvsBridge object is a #NMSetting subclass that describes properties
|
||||
* necessary for OpenVSwitch bridges.
|
||||
**/
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_FAIL_MODE,
|
||||
PROP_MCAST_SNOOPING_ENABLE,
|
||||
PROP_RSTP_ENABLE,
|
||||
PROP_STP_ENABLE,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
/**
|
||||
* NMSettingOvsBridge:
|
||||
*
|
||||
* OvsBridge Link Settings
|
||||
*/
|
||||
struct _NMSettingOvsBridge {
|
||||
NMSetting parent;
|
||||
|
||||
char *fail_mode;
|
||||
gboolean mcast_snooping_enable;
|
||||
gboolean rstp_enable;
|
||||
gboolean stp_enable;
|
||||
};
|
||||
|
||||
struct _NMSettingOvsBridgeClass {
|
||||
NMSettingClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (NMSettingOvsBridge, nm_setting_ovs_bridge, NM_TYPE_SETTING,
|
||||
_nm_register_setting (OVS_BRIDGE, NM_SETTING_PRIORITY_HW_BASE))
|
||||
NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_OVS_BRIDGE)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_setting_ovs_bridge_get_fail_mode:
|
||||
* @self: the #NMSettingOvsBridge
|
||||
*
|
||||
* Returns: the #NMSettingOvsBridge:fail_mode property of the setting
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
const char *
|
||||
nm_setting_ovs_bridge_get_fail_mode (NMSettingOvsBridge *self)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_OVS_BRIDGE (self), NULL);
|
||||
|
||||
return self->fail_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ovs_bridge_get_mcast_snooping_enable:
|
||||
* @self: the #NMSettingOvsBridge
|
||||
*
|
||||
* Returns: the #NMSettingOvsBridge:mcast_snooping_enable property of the setting
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ovs_bridge_get_mcast_snooping_enable (NMSettingOvsBridge *self)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_OVS_BRIDGE (self), FALSE);
|
||||
|
||||
return self->mcast_snooping_enable;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ovs_bridge_get_rstp_enable:
|
||||
* @self: the #NMSettingOvsBridge
|
||||
*
|
||||
* Returns: the #NMSettingOvsBridge:rstp_enable property of the setting
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ovs_bridge_get_rstp_enable (NMSettingOvsBridge *self)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_OVS_BRIDGE (self), FALSE);
|
||||
|
||||
return self->rstp_enable;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ovs_bridge_get_stp_enable:
|
||||
* @self: the #NMSettingOvsBridge
|
||||
*
|
||||
* Returns: the #NMSettingOvsBridge:stp_enable property of the setting
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_ovs_bridge_get_stp_enable (NMSettingOvsBridge *self)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_OVS_BRIDGE (self), FALSE);
|
||||
|
||||
return self->stp_enable;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int
|
||||
verify (NMSetting *setting, NMConnection *connection, GError **error)
|
||||
{
|
||||
NMSettingOvsBridge *self = NM_SETTING_OVS_BRIDGE (setting);
|
||||
|
||||
if (!_nm_connection_verify_required_interface_name (connection, error))
|
||||
return FALSE;
|
||||
|
||||
if (connection) {
|
||||
NMSettingConnection *s_con;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
if (!s_con) {
|
||||
g_set_error (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_MISSING_SETTING,
|
||||
_("missing setting"));
|
||||
g_prefix_error (error, "%s: ", NM_SETTING_CONNECTION_SETTING_NAME);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (nm_setting_connection_get_master (s_con)) {
|
||||
g_set_error (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("A connection with a '%s' setting must not have a master."),
|
||||
NM_SETTING_OVS_BRIDGE_SETTING_NAME);
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_MASTER);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!NM_IN_STRSET (self->fail_mode, "secure", "standalone", NULL)) {
|
||||
g_set_error (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("'%s' is not allowed in fail_mode"),
|
||||
self->fail_mode);
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_OVS_BRIDGE_SETTING_NAME, NM_SETTING_OVS_BRIDGE_FAIL_MODE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMSettingOvsBridge *self = NM_SETTING_OVS_BRIDGE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_FAIL_MODE:
|
||||
g_value_set_string (value, self->fail_mode);
|
||||
break;
|
||||
case PROP_MCAST_SNOOPING_ENABLE:
|
||||
g_value_set_boolean (value, self->mcast_snooping_enable);
|
||||
break;
|
||||
case PROP_RSTP_ENABLE:
|
||||
g_value_set_boolean (value, self->rstp_enable);
|
||||
break;
|
||||
case PROP_STP_ENABLE:
|
||||
g_value_set_boolean (value, self->stp_enable);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMSettingOvsBridge *self = NM_SETTING_OVS_BRIDGE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_FAIL_MODE:
|
||||
g_free (self->fail_mode);
|
||||
self->fail_mode = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_MCAST_SNOOPING_ENABLE:
|
||||
self->mcast_snooping_enable = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_RSTP_ENABLE:
|
||||
self->rstp_enable = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_STP_ENABLE:
|
||||
self->stp_enable = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
nm_setting_ovs_bridge_init (NMSettingOvsBridge *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ovs_bridge_new:
|
||||
*
|
||||
* Creates a new #NMSettingOvsBridge object with default values.
|
||||
*
|
||||
* Returns: (transfer full): the new empty #NMSettingOvsBridge object
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
NMSetting *
|
||||
nm_setting_ovs_bridge_new (void)
|
||||
{
|
||||
return (NMSetting *) g_object_new (NM_TYPE_SETTING_OVS_BRIDGE, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
NMSettingOvsBridge *self = NM_SETTING_OVS_BRIDGE (object);
|
||||
|
||||
g_free (self->fail_mode);
|
||||
|
||||
G_OBJECT_CLASS (nm_setting_ovs_bridge_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
nm_setting_ovs_bridge_class_init (NMSettingOvsBridgeClass *setting_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
|
||||
NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
|
||||
|
||||
object_class->set_property = set_property;
|
||||
object_class->get_property = get_property;
|
||||
object_class->finalize = finalize;
|
||||
parent_class->verify = verify;
|
||||
|
||||
/**
|
||||
* NMSettingOvsBridge:fail-mode:
|
||||
*
|
||||
* The bridge failure mode. One of "secure", "standalone" or empty.
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_FAIL_MODE,
|
||||
g_param_spec_string (NM_SETTING_OVS_BRIDGE_FAIL_MODE, "", "",
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
NM_SETTING_PARAM_INFERRABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingOvsBridge:mcast-snooping-enable:
|
||||
*
|
||||
* Enable or disable multicast snooping.
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_MCAST_SNOOPING_ENABLE,
|
||||
g_param_spec_boolean (NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE, "", "",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingOvsBridge:rstp-enable:
|
||||
*
|
||||
* Enable or disable RSTP.
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_RSTP_ENABLE,
|
||||
g_param_spec_boolean (NM_SETTING_OVS_BRIDGE_RSTP_ENABLE, "", "",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingOvsBridge:stp-enable:
|
||||
*
|
||||
* Enable or disable STP.
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_STP_ENABLE,
|
||||
g_param_spec_boolean (NM_SETTING_OVS_BRIDGE_STP_ENABLE, "", "",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
}
|
63
libnm-core/nm-setting-ovs-bridge.h
Normal file
63
libnm-core/nm-setting-ovs-bridge.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2017 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_SETTING_OVS_BRIDGE_H__
|
||||
#define __NM_SETTING_OVS_BRIDGE_H__
|
||||
|
||||
#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
|
||||
#error "Only <NetworkManager.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "nm-setting.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define NM_TYPE_SETTING_OVS_BRIDGE (nm_setting_ovs_bridge_get_type ())
|
||||
#define NM_SETTING_OVS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_OVS_BRIDGE, NMSettingOvsBridge))
|
||||
#define NM_SETTING_OVS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_OVS_BRIDGECONFIG, NMSettingOvsBridgeClass))
|
||||
#define NM_IS_SETTING_OVS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_OVS_BRIDGE))
|
||||
#define NM_IS_SETTING_OVS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_OVS_BRIDGE))
|
||||
#define NM_SETTING_OVS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_OVS_BRIDGE, NMSettingOvsBridgeClass))
|
||||
|
||||
#define NM_SETTING_OVS_BRIDGE_SETTING_NAME "ovs-bridge"
|
||||
|
||||
#define NM_SETTING_OVS_BRIDGE_FAIL_MODE "fail-mode"
|
||||
#define NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE "mcast-snooping-enable"
|
||||
#define NM_SETTING_OVS_BRIDGE_RSTP_ENABLE "rstp-enable"
|
||||
#define NM_SETTING_OVS_BRIDGE_STP_ENABLE "stp-enable"
|
||||
|
||||
typedef struct _NMSettingOvsBridgeClass NMSettingOvsBridgeClass;
|
||||
|
||||
NM_AVAILABLE_IN_1_10
|
||||
GType nm_setting_ovs_bridge_get_type (void);
|
||||
NM_AVAILABLE_IN_1_10
|
||||
NMSetting *nm_setting_ovs_bridge_new (void);
|
||||
|
||||
NM_AVAILABLE_IN_1_10
|
||||
const char *nm_setting_ovs_bridge_get_fail_mode (NMSettingOvsBridge *self);
|
||||
NM_AVAILABLE_IN_1_10
|
||||
gboolean nm_setting_ovs_bridge_get_mcast_snooping_enable (NMSettingOvsBridge *self);
|
||||
NM_AVAILABLE_IN_1_10
|
||||
gboolean nm_setting_ovs_bridge_get_rstp_enable (NMSettingOvsBridge *self);
|
||||
NM_AVAILABLE_IN_1_10
|
||||
gboolean nm_setting_ovs_bridge_get_stp_enable (NMSettingOvsBridge *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __NM_SETTING_OVS_BRIDGE_H__ */
|
|
@ -179,6 +179,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
|||
|
||||
if (connection) {
|
||||
NMSettingConnection *s_con;
|
||||
const char *slave_type;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
if (!s_con) {
|
||||
|
@ -199,6 +200,20 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
|||
g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_MASTER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
slave_type = nm_setting_connection_get_slave_type (s_con);
|
||||
if ( slave_type
|
||||
&& strcmp (slave_type, NM_SETTING_OVS_BRIDGE_SETTING_NAME)) {
|
||||
g_set_error (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("A connection with a '%s' setting must have the slave-type set to '%s'. Instead it is '%s'"),
|
||||
NM_SETTING_OVS_PORT_SETTING_NAME,
|
||||
NM_SETTING_OVS_BRIDGE_SETTING_NAME,
|
||||
slave_type);
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_SLAVE_TYPE);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!NM_IN_STRSET (self->vlan_mode, "access", "native-tagged", "native-untagged", "trunk", NULL)) {
|
||||
|
|
|
@ -258,6 +258,8 @@ _nm_setting_slave_type_is_valid (const char *slave_type, const char **out_port_t
|
|||
;
|
||||
else if (!strcmp (slave_type, NM_SETTING_BRIDGE_SETTING_NAME))
|
||||
port_type = NM_SETTING_BRIDGE_PORT_SETTING_NAME;
|
||||
else if (!strcmp (slave_type, NM_SETTING_OVS_BRIDGE_SETTING_NAME))
|
||||
port_type = NM_SETTING_OVS_PORT_SETTING_NAME;
|
||||
else if (!strcmp (slave_type, NM_SETTING_OVS_PORT_SETTING_NAME))
|
||||
port_type = NM_SETTING_OVS_INTERFACE_SETTING_NAME;
|
||||
else if (!strcmp (slave_type, NM_SETTING_TEAM_SETTING_NAME))
|
||||
|
|
|
@ -1190,6 +1190,12 @@ global:
|
|||
nm_ip_route_equal_full;
|
||||
nm_setting_bridge_get_group_forward_mask;
|
||||
nm_setting_ip_config_get_route_table;
|
||||
nm_setting_ovs_bridge_get_fail_mode;
|
||||
nm_setting_ovs_bridge_get_mcast_snooping_enable;
|
||||
nm_setting_ovs_bridge_get_rstp_enable;
|
||||
nm_setting_ovs_bridge_get_stp_enable;
|
||||
nm_setting_ovs_bridge_get_type;
|
||||
nm_setting_ovs_bridge_new;
|
||||
nm_setting_ovs_interface_get_interface_type;
|
||||
nm_setting_ovs_interface_get_type;
|
||||
nm_setting_ovs_interface_new;
|
||||
|
|
|
@ -78,6 +78,7 @@ libnm-core/nm-setting-olpc-mesh.c
|
|||
libnm-core/nm-setting-ovs-interface.c
|
||||
libnm-core/nm-setting-ovs-patch.c
|
||||
libnm-core/nm-setting-ovs-port.c
|
||||
libnm-core/nm-setting-ovs-bridge.c
|
||||
libnm-core/nm-setting-ppp.c
|
||||
libnm-core/nm-setting-pppoe.c
|
||||
libnm-core/nm-setting-proxy.c
|
||||
|
|
Loading…
Reference in a new issue