From fac1c8b4bd3f6853d8548ad40902fdf25b345f94 Mon Sep 17 00:00:00 2001 From: Jaehyun Kim Date: Mon, 5 Jul 2021 22:46:19 +0900 Subject: [PATCH] Use the last updated MAC address before turning on wifi 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 --- packaging/connman.spec | 2 +- src/device.c | 18 ++---------------- src/inet.c | 11 ++--------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/packaging/connman.spec b/packaging/connman.spec index db8a848..6af8ff9 100644 --- a/packaging/connman.spec +++ b/packaging/connman.spec @@ -6,7 +6,7 @@ Name: connman Version: 1.38 -Release: 8 +Release: 9 License: GPL-2.0+ Summary: Connection Manager Url: http://connman.net diff --git a/src/device.c b/src/device.c index 89258ba..d0825ce 100755 --- a/src/device.c +++ b/src/device.c @@ -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: diff --git a/src/inet.c b/src/inet.c index 4814546..e0ef7db 100644 --- a/src/inet.c +++ b/src/inet.c @@ -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); -- 2.7.4