Fix update of Ethernet address and MTU values
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 20 Dec 2009 18:08:43 +0000 (10:08 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 20 Dec 2009 18:08:43 +0000 (10:08 -0800)
src/ipconfig.c
src/service.c

index 1298a7846ae774e78e79351dafb924b1cfe867f9..45764f589ffa226aa4dfd0217397c95bc825f588 100644 (file)
@@ -331,6 +331,12 @@ void __connman_ipconfig_newlink(int index, unsigned short type,
                                                index, type, type2str(type));
 
 update:
+       if (ipdevice->config != NULL) {
+               g_free(ipdevice->config->eth);
+               ipdevice->config->eth = g_strdup(address);
+               ipdevice->config->mtu = mtu;
+       }
+
        if (flags == ipdevice->flags)
                return;
 
@@ -379,10 +385,6 @@ update:
                if (index != ipconfig->index)
                        continue;
 
-               g_free(ipconfig->eth);
-               ipconfig->eth = g_strdup(address);
-               ipconfig->mtu = mtu;
-
                if (up == TRUE && ipconfig->ops->up)
                        ipconfig->ops->up(ipconfig);
                if (lower_up == TRUE && ipconfig->ops->lower_up)
index 7e513950d6ff5ecfe7fd726d5707ca7ddcdedf4c..21aaba44a8c6da108322eb67191f9070c70cfc40 100644 (file)
@@ -387,6 +387,18 @@ static void append_ethernet(DBusMessageIter *iter, void *user_data)
 {
        struct connman_service *service = user_data;
 
+       switch (service->state) {
+       case CONNMAN_SERVICE_STATE_UNKNOWN:
+       case CONNMAN_SERVICE_STATE_IDLE:
+       case CONNMAN_SERVICE_STATE_FAILURE:
+       case CONNMAN_SERVICE_STATE_DISCONNECT:
+               return;
+       case CONNMAN_SERVICE_STATE_ASSOCIATION:
+       case CONNMAN_SERVICE_STATE_CONFIGURATION:
+       case CONNMAN_SERVICE_STATE_READY:
+               break;
+       }
+
        if (service->ipconfig != NULL)
                __connman_ipconfig_append_ethernet(service->ipconfig, iter);
 }