Use the last updated MAC address before turning on wifi 52/260852/2 accepted/tizen/unified/20210708.131505 submit/tizen/20210706.115004
authorJaehyun Kim <jeik01.kim@samsung.com>
Mon, 5 Jul 2021 13:46:19 +0000 (22:46 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Mon, 5 Jul 2021 13:47:16 +0000 (22:47 +0900)
MAC randomization does not work properly when there are multiple wifi interfaces
or in some devices that do not create a .mac.info file.
So, to solve this problem, a permanent MAC address that is set before wifi up is used.

If a permanent MAC address is in built-in physical device,
it's hardly get it at an initial creation.
So, if there is a MAC address updated from netlink before wifi is on, it is used.
* MAC randomization works only when wifi is turned on.

Change-Id: Ia7a9ad0affaa6deca974199100a56e7378b6c195
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
packaging/connman.spec
src/device.c
src/inet.c

index db8a848..6af8ff9 100644 (file)
@@ -6,7 +6,7 @@
 
 Name:           connman
 Version:        1.38
-Release:        8
+Release:        9
 License:        GPL-2.0+
 Summary:        Connection Manager
 Url:            http://connman.net
index 89258ba..d0825ce 100755 (executable)
@@ -665,7 +665,7 @@ void connman_device_set_ident(struct connman_device *device,
                                                        const char *ident)
 {
 #ifdef TIZEN_EXT
-       if (device->ident)
+       if (device->ident && device->powered)
                return;
        else
 #endif
@@ -1112,7 +1112,7 @@ int connman_device_set_string(struct connman_device *device,
 
        if (g_str_equal(key, "Address")) {
 #ifdef TIZEN_EXT
-               if (device->address)
+               if (device->address && device->powered)
                        return 0;
                else
 #endif
@@ -1985,17 +1985,7 @@ struct connman_device *connman_device_create_from_index(int index)
        case CONNMAN_DEVICE_TYPE_ETHERNET:
        case CONNMAN_DEVICE_TYPE_GADGET:
        case CONNMAN_DEVICE_TYPE_WIFI:
-#if defined TIZEN_EXT
-               if (type == CONNMAN_DEVICE_TYPE_WIFI)
-                       name = _get_wifi_ident();
-               if (!name)
-#endif
                name = index2ident(index, "");
-#if defined TIZEN_EXT
-               if (type == CONNMAN_DEVICE_TYPE_WIFI)
-                       addr = _get_wifi_addr();
-               if (!addr)
-#endif
                addr = index2addr(index);
                break;
        case CONNMAN_DEVICE_TYPE_BLUETOOTH:
@@ -2020,10 +2010,6 @@ struct connman_device *connman_device_create_from_index(int index)
                ident = index2ident(index, NULL);
                break;
        case CONNMAN_DEVICE_TYPE_WIFI:
-#if defined TIZEN_EXT
-               ident = _get_wifi_ident();
-               if (!ident)
-#endif
                ident = index2ident(index, NULL);
                break;
        case CONNMAN_DEVICE_TYPE_BLUETOOTH:
index 4814546..e0ef7db 100644 (file)
@@ -451,15 +451,8 @@ void connman_inet_update_device_ident(struct connman_device *device)
        case CONNMAN_DEVICE_TYPE_ETHERNET:
        case CONNMAN_DEVICE_TYPE_GADGET:
        case CONNMAN_DEVICE_TYPE_WIFI:
-               if (type == CONNMAN_DEVICE_TYPE_WIFI)
-                       addr = _get_wifi_addr();
-               if (!addr)
-                       addr = index2addr(index);
-
-               if (type == CONNMAN_DEVICE_TYPE_WIFI)
-                       ident = _get_wifi_ident();
-               if (!ident)
-                       ident = index2ident(index, NULL);
+               addr = index2addr(index);
+               ident = index2ident(index, NULL);
                break;
        case CONNMAN_DEVICE_TYPE_CELLULAR:
                ident = index2ident(index, NULL);