Attached patch from upstream git repo fixes the bridge assert and
brctl commands no longer crash NetworkManager.

As a side note, how about disabling all asserts?

They are a debug and test feature and should not be used as error handling
in production builds?

-Mikko
commit c9b9229c2e7de2bbb12e493a868921b7a788ee92
Author: Jiří Klimeš <jkli...@redhat.com>
Date:   Wed Sep 24 16:02:37 2014 +0200

    core: do not assert when a device is enslaved externally
    
    Test case:
     # ip link add name BR type bridge
     # brctl addif BR eth0
    
    Monitoring external master/slave changes was intruduced by
    08e0cfb484dfc6aa6342871158ffe752c7c50f03.

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 28fd128..4a5eb18 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -2950,8 +2950,6 @@ act_stage3_ip4_config_start (NMDevice *self,
        g_assert (connection);
 
        method = nm_utils_get_ip_config_method (connection, 
NM_TYPE_SETTING_IP4_CONFIG);
-       if (priv->master)
-               g_assert_cmpstr (method, ==, 
NM_SETTING_IP4_CONFIG_METHOD_DISABLED);
 
        if (   strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) != 0
            && priv->is_master
@@ -3956,8 +3954,6 @@ act_stage3_ip6_config_start (NMDevice *self,
        g_assert (connection);
 
        method = nm_utils_get_ip_config_method (connection, 
NM_TYPE_SETTING_IP6_CONFIG);
-       if (priv->master)
-               g_assert_cmpstr (method, ==, 
NM_SETTING_IP6_CONFIG_METHOD_IGNORE);
 
        if (   strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) != 0
            && priv->is_master
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index 30e319b..130b522 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -365,11 +365,11 @@ device_master_changed (GObject *object,
                return;
        if (!nm_device_get_master (device))
                return;
+       if (!nm_active_connection_get_master (self))
+               return;
        g_signal_handlers_disconnect_by_func (device, G_CALLBACK 
(device_master_changed), self);
 
        master = nm_active_connection_get_master (self);
-       g_assert (master);
-
        master_state = nm_active_connection_get_state (master);
        if (master_state >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) {
                /* Master failed before attaching the slave */

Reply via email to