Hi Marcel:
I have worked out a patch to fix bug 3559. please review. 
The root cause of the issue is:
Currently, ethernet service is created on registering ethernet device, and the 
service will not be removed untill device removing. I think the right way is to 
creat service once detecting carrier, and remove the service on carrier off. 
Becuase the ethernet service should depend on the ethernet carrier.

diff --git a/src/device.c b/src/device.c
index cd9105d..a673af4 100644
--- a/src/device.c
+++ b/src/device.c
@@ -166,7 +166,8 @@ static int set_carrier(struct connman_device *device, 
connman_bool_t carrier)
        struct connman_service *service;
 
        service = __connman_service_lookup_from_device(device);
-       __connman_service_set_carrier(service, carrier);
+       if (service != NULL)
+               __connman_service_set_carrier(service, carrier);
 
        if (carrier == TRUE) {
                enum connman_element_type type = CONNMAN_ELEMENT_TYPE_UNKNOWN;
@@ -789,17 +790,6 @@ static int setup_device(struct connman_device *device)
                return err;
        }
 
-       switch (device->mode) {
-       case CONNMAN_DEVICE_MODE_UNKNOWN:
-       case CONNMAN_DEVICE_MODE_NETWORK_SINGLE:
-       case CONNMAN_DEVICE_MODE_NETWORK_MULTIPLE:
-               break;
-       case CONNMAN_DEVICE_MODE_TRANSPORT_IP:
-               if (device->secondary == FALSE)
-                       __connman_profile_add_device(device);
-               break;
-       }
-
        device_enable(device);
 
        return 0;
@@ -1322,6 +1312,12 @@ int connman_device_set_carrier(struct connman_device 
*device,
 
        device->carrier = carrier;
 
+       if (carrier == FALSE)
+               __connman_profile_remove_device(device);
+       else if (device->mode == CONNMAN_DEVICE_MODE_TRANSPORT_IP
+                               && device->secondary == FALSE)
+               __connman_profile_add_device(device);
+
        return set_carrier(device, device->carrier);
 }

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to