summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2017-08-01 18:36:34 +0200
committerLubomir Rintel <lkundrak@v3.sk>2017-09-11 23:56:47 +0200
commit543dc05c6eb3f668da9a46f8aba25d21163018a9 (patch)
tree96ff1ea3fc5ece49c2eeda4da68595179ebd4415
parent9c942c8183aee6096d72b24f13b53b5a187357e1 (diff)
downloadNetworkManager-543dc05c6eb3f668da9a46f8aba25d21163018a9.tar.gz
libnm-core: add ovs-bridge setting
No properties there yet.
-rw-r--r--Makefile.am2
-rw-r--r--clients/common/settings-docs.c.in1
-rw-r--r--libnm-core/nm-connection.c17
-rw-r--r--libnm-core/nm-connection.h2
-rw-r--r--libnm-core/nm-core-internal.h1
-rw-r--r--libnm-core/nm-core-types.h1
-rw-r--r--libnm-core/nm-setting-ovs-bridge.c76
-rw-r--r--libnm-core/nm-setting-ovs-bridge.h63
-rw-r--r--libnm-core/nm-setting.c2
-rw-r--r--libnm/libnm.ver1
10 files changed, 166 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index d42e1cd074..eb05e4b54e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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-port.h \
libnm-core/nm-setting-ppp.h \
libnm-core/nm-setting-pppoe.h \
@@ -469,6 +470,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-port.c \
libnm-core/nm-setting-ppp.c \
libnm-core/nm-setting-pppoe.c \
diff --git a/clients/common/settings-docs.c.in b/clients/common/settings-docs.c.in
index f490f23c30..92ccac2396 100644
--- a/clients/common/settings-docs.c.in
+++ b/clients/common/settings-docs.c.in
@@ -260,6 +260,7 @@
#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_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_PORT_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_PPP_BAUD N_("If non-zero, instruct pppd to set the serial port to the specified baudrate. This value should normally be left as 0 to automatically choose the speed.")
#define DESCRIBE_DOC_NM_SETTING_PPP_CRTSCTS N_("If TRUE, specify that pppd should set the serial port to use hardware flow control with RTS and CTS signals. This value should normally be set to FALSE.")
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index 1aaa8ee1a2..4a00ba7b61 100644
--- a/libnm-core/nm-connection.c
+++ b/libnm-core/nm-connection.c
@@ -1974,6 +1974,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_PORT_SETTING_NAME)
|| !strcmp (type, NM_SETTING_VXLAN_SETTING_NAME))
return TRUE;
@@ -2328,6 +2329,22 @@ nm_connection_get_setting_olpc_mesh (NMConnection *connection)
}
/**
+ * 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_port:
* @connection: the #NMConnection
*
diff --git a/libnm-core/nm-connection.h b/libnm-core/nm-connection.h
index 7c4e4859fd..ee6035a98d 100644
--- a/libnm-core/nm-connection.h
+++ b/libnm-core/nm-connection.h
@@ -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
NMSettingOvsPort * nm_connection_get_setting_ovs_port (NMConnection *connection);
NMSettingPpp * nm_connection_get_setting_ppp (NMConnection *connection);
NMSettingPppoe * nm_connection_get_setting_pppoe (NMConnection *connection);
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h
index d912e0625f..ab9967150f 100644
--- a/libnm-core/nm-core-internal.h
+++ b/libnm-core/nm-core-internal.h
@@ -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-port.h"
#include "nm-setting-ppp.h"
#include "nm-setting-pppoe.h"
diff --git a/libnm-core/nm-core-types.h b/libnm-core/nm-core-types.h
index 8a5d519b72..8c9bb852b2 100644
--- a/libnm-core/nm-core-types.h
+++ b/libnm-core/nm-core-types.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 _NMSettingOvsPort NMSettingOvsPort;
typedef struct _NMSettingPpp NMSettingPpp;
typedef struct _NMSettingPppoe NMSettingPppoe;
diff --git a/libnm-core/nm-setting-ovs-bridge.c b/libnm-core/nm-setting-ovs-bridge.c
new file mode 100644
index 0000000000..ec80870ea9
--- /dev/null
+++ b/libnm-core/nm-setting-ovs-bridge.c
@@ -0,0 +1,76 @@
+/* -*- 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.
+ **/
+
+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_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 gboolean
+verify (NMSetting *setting, NMConnection *connection, GError **error)
+{
+ if (!_nm_connection_verify_required_interface_name (connection, error))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+nm_setting_ovs_bridge_init (NMSettingOvsBridge *setting)
+{
+}
+
+static void
+nm_setting_ovs_bridge_class_init (NMSettingOvsBridgeClass *setting_class)
+{
+ NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
+
+ parent_class->verify = verify;
+}
diff --git a/libnm-core/nm-setting-ovs-bridge.h b/libnm-core/nm-setting-ovs-bridge.h
new file mode 100644
index 0000000000..68829819e3
--- /dev/null
+++ b/libnm-core/nm-setting-ovs-bridge.h
@@ -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"
+
+/**
+ * NMSettingOvsBridge:
+ *
+ * OvsBridge Link Settings
+ */
+struct _NMSettingOvsBridge {
+ NMSetting parent;
+};
+
+typedef struct {
+ NMSettingClass parent;
+
+ /*< private >*/
+ gpointer padding[4];
+} 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);
+
+G_END_DECLS
+
+#endif /* __NM_SETTING_OVS_BRIDGE_H__ */
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c
index e44248ac81..4992eac69f 100644
--- a/libnm-core/nm-setting.c
+++ b/libnm-core/nm-setting.c
@@ -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))
+ ;
else if (!strcmp (slave_type, NM_SETTING_OVS_PORT_SETTING_NAME))
;
else if (!strcmp (slave_type, NM_SETTING_TEAM_SETTING_NAME))
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index 534851735d..adeb349df2 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -1186,6 +1186,7 @@ global:
nm_device_dummy_get_hw_address;
nm_device_ppp_get_type;
nm_setting_bridge_get_group_forward_mask;
+ nm_setting_ovs_bridge_get_type;
nm_setting_ovs_port_get_type;
nm_setting_pppoe_get_parent;
nm_setting_wireless_security_get_pmf;