[patch NetworkManager 1/4] nm-setting: adjust virtual interface name according to connection interface name
- From: Jiri Pirko <jiri resnulli us>
- To: networkmanager-list gnome org
- Subject: [patch NetworkManager 1/4] nm-setting: adjust virtual interface name according to connection interface name
- Date: Wed, 25 Sep 2013 15:37:06 +0200
Signed-off-by: Jiri Pirko <jiri resnulli us>
---
libnm-util/nm-setting-connection.c | 3 ++-
libnm-util/nm-setting.c | 21 +++++++++++++++++++++
libnm-util/nm-setting.h | 2 ++
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/libnm-util/nm-setting-connection.c b/libnm-util/nm-setting-connection.c
index 630356c..3c90d89 100644
--- a/libnm-util/nm-setting-connection.c
+++ b/libnm-util/nm-setting-connection.c
@@ -735,7 +735,8 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
virtual_iface = nm_setting_get_virtual_iface_name (iter->data);
if (virtual_iface) {
if (priv->interface_name) {
- if (strcmp (priv->interface_name, virtual_iface) != 0) {
+ if (strcmp (priv->interface_name, virtual_iface) != 0 &&
+ !nm_setting_set_virtual_iface_name (iter->data, priv->interface_name)) {
g_set_error (error,
NM_SETTING_CONNECTION_ERROR,
NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY,
diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c
index a36da29..1fb7cce 100644
--- a/libnm-util/nm-setting.c
+++ b/libnm-util/nm-setting.c
@@ -1136,6 +1136,27 @@ nm_setting_get_virtual_iface_name (NMSetting *setting)
return NULL;
}
+/**
+ * nm_setting_set_virtual_iface_name:
+ * @setting: the #NMSetting
+ * @iface_name: interface name to be set
+ *
+ * Sets the name of the virtual kernel interface which the connection
+ * will use.
+ *
+ * Returns: TRUE in case interface name was successfuly set, FALSE otherwise
+ **/
+gboolean
+nm_setting_set_virtual_iface_name (NMSetting *setting, const char *iface_name)
+{
+ g_return_val_if_fail (NM_IS_SETTING (setting), NULL);
+
+ if (NM_SETTING_GET_CLASS (setting)->set_virtual_iface_name)
+ return NM_SETTING_GET_CLASS (setting)->set_virtual_iface_name (setting, iface_name);
+
+ return FALSE;
+}
+
/*****************************************************************************/
static void
diff --git a/libnm-util/nm-setting.h b/libnm-util/nm-setting.h
index b4ea987..dcda6e1 100644
--- a/libnm-util/nm-setting.h
+++ b/libnm-util/nm-setting.h
@@ -203,6 +203,7 @@ typedef struct {
gpointer user_data);
const char *(*get_virtual_iface_name) (NMSetting *setting);
+ gboolean (*set_virtual_iface_name) (NMSetting *setting, const char *iface_name);
/* Padding for future expansion */
void (*_reserved1) (void);
@@ -309,6 +310,7 @@ gboolean nm_setting_set_secret_flags (NMSetting *setting,
GError **error);
const char *nm_setting_get_virtual_iface_name (NMSetting *setting);
+gboolean nm_setting_set_virtual_iface_name (NMSetting *setting, const char *iface_name);
G_END_DECLS
--
1.8.3.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]