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:04 +0200
commit9c942c8183aee6096d72b24f13b53b5a187357e1 (patch)
treea685f82293e33bd5c933de1ac735e6ffb37f8394
parent526ddacfce5c1713f7c92e789562b7a582c04871 (diff)
libnm-core: add ovs-port 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-port.c76
-rw-r--r--libnm-core/nm-setting-ovs-port.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 2d6e21b92..d42e1cd07 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-port.h \
libnm-core/nm-setting-ppp.h \
libnm-core/nm-setting-pppoe.h \
libnm-core/nm-setting-proxy.h \
@@ -468,6 +469,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-port.c \
libnm-core/nm-setting-ppp.c \
libnm-core/nm-setting-pppoe.c \
libnm-core/nm-setting-proxy.c \
diff --git a/clients/common/settings-docs.c.in b/clients/common/settings-docs.c.in
index ea7578106..f490f23c3 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_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.")
#define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_FAILURE N_("If non-zero, instruct pppd to presume the connection to the peer has failed if the specified number of LCP echo-requests go unanswered by the peer. The \"lcp-echo-interval\" property must also be set to a non-zero value if this property is used.")
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index a3fae442b..1aaa8ee1a 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_PORT_SETTING_NAME)
|| !strcmp (type, NM_SETTING_VXLAN_SETTING_NAME))
return TRUE;
@@ -2327,6 +2328,22 @@ nm_connection_get_setting_olpc_mesh (NMConnection *connection)
}
/**
+ * nm_connection_get_setting_ovs_port:
+ * @connection: the #NMConnection
+ *
+ * A shortcut to return any #NMSettingOvsPort the connection might contain.
+ *
+ * Returns: (transfer none): an #NMSettingOvsPort if the connection contains one, otherwise %NULL
+ *
+ * Since: 1.10
+ **/
+NMSettingOvsPort *
+nm_connection_get_setting_ovs_port (NMConnection *connection)
+{
+ return _connection_get_setting_check (connection, NM_TYPE_SETTING_OVS_PORT);
+}
+
+/**
* nm_connection_get_setting_ppp:
* @connection: the #NMConnection
*
diff --git a/libnm-core/nm-connection.h b/libnm-core/nm-connection.h
index fae9862a4..7c4e4859f 100644
--- a/libnm-core/nm-connection.h
+++ b/libnm-core/nm-connection.h
@@ -213,6 +213,8 @@ NMSettingMacsec * nm_connection_get_setting_macsec (NMConnec
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
+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);
NM_AVAILABLE_IN_1_6
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h
index e4211c42d..d912e0625 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-port.h"
#include "nm-setting-ppp.h"
#include "nm-setting-pppoe.h"
#include "nm-setting-serial.h"
diff --git a/libnm-core/nm-core-types.h b/libnm-core/nm-core-types.h
index 3b9ec37b8..8a5d519b7 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 _NMSettingOvsPort NMSettingOvsPort;
typedef struct _NMSettingPpp NMSettingPpp;
typedef struct _NMSettingPppoe NMSettingPppoe;
typedef struct _NMSettingSerial NMSettingSerial;
diff --git a/libnm-core/nm-setting-ovs-port.c b/libnm-core/nm-setting-ovs-port.c
new file mode 100644
index 000000000..a141adfa1
--- /dev/null
+++ b/libnm-core/nm-setting-ovs-port.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-port.h"
+
+#include "nm-connection-private.h"
+#include "nm-setting-connection.h"
+#include "nm-setting-private.h"
+
+/**
+ * SECTION:nm-setting-ovs-port
+ * @short_description: Describes connection properties for OpenVSwitch ports.
+ *
+ * The #NMSettingOvsPort object is a #NMSetting subclass that describes properties
+ * necessary for OpenVSwitch ports.
+ **/
+
+G_DEFINE_TYPE_WITH_CODE (NMSettingOvsPort, nm_setting_ovs_port, NM_TYPE_SETTING,
+ _nm_register_setting (OVS_PORT, NM_SETTING_PRIORITY_HW_BASE))
+NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_OVS_PORT)
+
+/**
+ * nm_setting_ovs_port_new:
+ *
+ * Creates a new #NMSettingOvsPort object with default values.
+ *
+ * Returns: (transfer full): the new empty #NMSettingOvsPort object
+ *
+ * Since: 1.10
+ **/
+NMSetting *
+nm_setting_ovs_port_new (void)
+{
+ return (NMSetting *) g_object_new (NM_TYPE_SETTING_OVS_PORT, 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_port_init (NMSettingOvsPort *setting)
+{
+}
+
+static void
+nm_setting_ovs_port_class_init (NMSettingOvsPortClass *setting_class)
+{
+ NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
+
+ parent_class->verify = verify;
+}
diff --git a/libnm-core/nm-setting-ovs-port.h b/libnm-core/nm-setting-ovs-port.h
new file mode 100644
index 000000000..66ec21f12
--- /dev/null
+++ b/libnm-core/nm-setting-ovs-port.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_PORT_H__
+#define __NM_SETTING_OVS_PORT_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_PORT (nm_setting_ovs_port_get_type ())
+#define NM_SETTING_OVS_PORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_OVS_PORT, NMSettingOvsPort))
+#define NM_SETTING_OVS_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_OVS_PORTCONFIG, NMSettingOvsPortClass))
+#define NM_IS_SETTING_OVS_PORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_OVS_PORT))
+#define NM_IS_SETTING_OVS_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_OVS_PORT))
+#define NM_SETTING_OVS_PORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_OVS_PORT, NMSettingOvsPortClass))
+
+#define NM_SETTING_OVS_PORT_SETTING_NAME "ovs-port"
+
+/**
+ * NMSettingOvsPort:
+ *
+ * OvsPort Link Settings
+ */
+struct _NMSettingOvsPort {
+ NMSetting parent;
+};
+
+typedef struct {
+ NMSettingClass parent;
+
+ /*< private >*/
+ gpointer padding[4];
+} NMSettingOvsPortClass;
+
+NM_AVAILABLE_IN_1_10
+GType nm_setting_ovs_port_get_type (void);
+NM_AVAILABLE_IN_1_10
+NMSetting *nm_setting_ovs_port_new (void);
+
+G_END_DECLS
+
+#endif /* __NM_SETTING_OVS_PORT_H__ */
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c
index 3e2ee3deb..e44248ac8 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_PORT_SETTING_NAME))
+ ;
else if (!strcmp (slave_type, NM_SETTING_TEAM_SETTING_NAME))
port_type = NM_SETTING_TEAM_PORT_SETTING_NAME;
else
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index f212f0f47..534851735 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_port_get_type;
nm_setting_pppoe_get_parent;
nm_setting_wireless_security_get_pmf;
nm_setting_wireless_security_get_wps_method;