Extends the ifcfg-rh reader plugin to parse BRIDGE= directives and
assign such interfaces to the respective briding master using the
NM_SETTING_CONNECTION_MASTER property.

If the connection is already assigned to a different master, the
connection is aborted.

Signed-off-by: Thomas Graf <[email protected]>
---
 src/settings/plugins/ifcfg-rh/reader.c |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/settings/plugins/ifcfg-rh/reader.c 
b/src/settings/plugins/ifcfg-rh/reader.c
index e649be3..d75fbbd 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -150,6 +150,25 @@ make_connection_setting (const char *file,
                g_free (value);
        }
 
+       value = svGetValue (ifcfg, "BRIDGE", FALSE);
+       if (value) {
+               const char *master;
+
+               /* Can't be a bridge slave if it's already enslaved to another 
master */
+               if ((master = nm_setting_connection_get_master (s_con))) {
+                       PLUGIN_WARN (IFCFG_PLUGIN_NAME,
+                                    "     warning: Already configured as slave 
of %s. "
+                                    "Ignoring BRIDGE=\"%s\"", master, value);
+                       g_free (value);
+                       goto error;
+               }
+
+               g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL);
+               g_object_set (s_con, NM_SETTING_CONNECTION_SLAVE_TYPE,
+                             NM_SETTING_BRIDGE_SETTING_NAME, NULL);
+               g_free (value);
+       }
+
        value = svGetValue (ifcfg, "USERS", FALSE);
        if (value) {
                char **items, **iter;
@@ -175,6 +194,10 @@ make_connection_setting (const char *file,
        g_free (zone);
 
        return NM_SETTING (s_con);
+
+error:
+       g_object_unref (s_con);
+       return NULL;
 }
 
 static gboolean
@@ -3974,14 +3997,6 @@ connection_from_file (const char *filename,
                goto done;
        }
 
-       /* Ignore BRIDGE= and VLAN= connections for now too (rh #619863) */
-       tmp = svGetValue (parsed, "BRIDGE", FALSE);
-       if (tmp) {
-               g_free (tmp);
-               nm_controlled = FALSE;
-               ignore_reason = IGNORE_REASON_BRIDGE;
-       }
-
        if (nm_controlled) {
                tmp = svGetValue (parsed, "VLAN", FALSE);
                if (tmp) {
-- 
1.7.7.6

_______________________________________________
networkmanager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to