Fix WPS-PIN connection when device is already connected. 68/257868/1
authorNiraj Kumar Goit <niraj.g@samsung.com>
Tue, 4 May 2021 14:16:20 +0000 (19:46 +0530)
committerNiraj Kumar Goit <niraj.g@samsung.com>
Tue, 4 May 2021 14:16:20 +0000 (19:46 +0530)
When device is already connected to an AP and WPS-PIN connection is initiated,
first device disconnect network and on receiving disconnected callback start
WPS-PIN connection. But in this scenario wps-pin was missing and not passed to
lower layer.

Change-Id: I5de2d9af254b70506c753f94ac93f0320a569e80
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
include/wifi_internal.h
packaging/capi-network-wifi-manager.spec
src/wifi_internal.c

index f3649b3ec09d7fda344f4bdc70c03c5477029d23..3666d5147e0c1637e64e27882295974e894ca1f6 100755 (executable)
@@ -264,6 +264,7 @@ typedef struct {
        char interface_name[NET_WLAN_IF_NAME_LEN];
        bool is_disconnect_wps_pbc;
        bool is_disconnect_wps_pin;
+       char wps_pin[NET_WLAN_MAX_WPSPIN_LEN + 1];
 
        pthread_mutex_t mutex_ap_handle_list;
        GSList *ap_handle_list;
index f1c272957d859f3d3138a87a74217b05ae968036..54166be6cd876541dbe95e012c7dcaa02084b743 100755 (executable)
@@ -1,7 +1,7 @@
 Name:          capi-network-wifi-manager
 Summary:       Network Wi-Fi library in TIZEN C API
 Version:       1.3.8
-Release:       1
+Release:       2
 Group:         System/Network
 License:       Apache-2.0
 Source0:       %{name}-%{version}.tar.gz
index 0d7559c6028997c3e5fd9c932abcd2e99c118a6b..30cd2d564d37038a8bab8416094eb45c64033d7c 100755 (executable)
@@ -1328,13 +1328,15 @@ static void _wifi_evt_cb(net_event_info_s *event_cb, void *user_data)
                                wifi_handle->is_disconnect_wps_pbc = false;
                        }
                        /* Checking if disconnection request was sent when WPS PIN connection
-                        * was requested, if true then start WPS PBC connection request */
+                        * was requested, if true then start WPS PIN connection request */
                        else if (wifi_handle->is_disconnect_wps_pin) {
                                net_wifi_wps_info_s wps_info;
                                memset(&wps_info, 0, sizeof(net_wifi_wps_info_s));
                                wps_info.type = WIFI_WPS_PIN;
+                               g_strlcpy(wps_info.pin, wifi_handle->wps_pin, NET_WLAN_MAX_WPSPIN_LEN + 1);
                                if (net_wifi_enroll_wps_without_ssid(wifi_handle->network_info, &wps_info) != NET_ERR_NONE)
                                        __connected_cb(wifi_handle, WIFI_MANAGER_ERROR_OPERATION_FAILED);
+                               memset(wifi_handle->wps_pin, 0, sizeof(wifi_handle->wps_pin));
                                wifi_handle->is_disconnect_wps_pin = false;
                        }
 
@@ -2976,6 +2978,7 @@ int _wifi_connect_with_wps_pin_without_ssid(wifi_manager_h wifi, const char *pin
                        rv = net_close_connection(wifi_handle->network_info, profile->ProfileName);
                        if (rv != NET_ERR_NONE)
                                return __convert_to_ap_error_type(rv);
+                       g_strlcpy(wifi_handle->wps_pin, pin, NET_WLAN_MAX_WPSPIN_LEN + 1);
                        wifi_handle->is_disconnect_wps_pin = true;
                }
        }