소스 검색

qcacmn: Add security info in scan entry

Add security info in scan entry and print the same.

Change-Id: If8f0c05a526b86cb3ae0020c2e144beb3510cb98
CRs-Fixed: 2603004
Abhishek Singh 5 년 전
부모
커밋
87a5ab62be
3개의 변경된 파일31개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 1
      umac/scan/core/src/wlan_scan_cache_db.c
  2. 8 1
      umac/scan/dispatcher/inc/wlan_scan_public_structs.h
  3. 16 0
      umac/scan/dispatcher/src/wlan_scan_utils_api.c

+ 7 - 1
umac/scan/core/src/wlan_scan_cache_db.c

@@ -850,6 +850,7 @@ static QDF_STATUS scm_add_update_entry(struct wlan_objmgr_psoc *psoc,
 	QDF_STATUS status;
 	struct scan_dbs *scan_db;
 	struct wlan_scan_obj *scan_obj;
+	uint8_t security_type;
 
 	scan_db = wlan_pdev_get_scan_db(psoc, pdev);
 	if (!scan_db) {
@@ -878,7 +879,8 @@ static QDF_STATUS scm_add_update_entry(struct wlan_objmgr_psoc *psoc,
 	is_dup_found = scm_find_duplicate(pdev, scan_obj, scan_db, scan_params,
 					  &dup_node);
 
-	scm_nofl_debug("Received %s: BSSID: %pM tsf_delta %u Seq %d ssid: %.*s rssi: %d snr %d freq %d phy_mode %d hidden %d chan_mismatch %d pdev %d",
+	security_type = scan_params->security_type;
+	scm_nofl_debug("Received %s: BSSID: %pM tsf_delta %u Seq %d ssid: %.*s rssi: %d snr %d freq %d phy_mode %d hidden %d chan_mismatch %d %s%s%s%s pdev %d",
 		       (scan_params->frm_subtype == MGMT_SUBTYPE_PROBE_RESP) ?
 		       "Probe Rsp" : "Beacon", scan_params->bssid.bytes,
 		       scan_params->tsf_delta, scan_params->seq_num,
@@ -887,6 +889,10 @@ static QDF_STATUS scm_add_update_entry(struct wlan_objmgr_psoc *psoc,
 		       scan_params->channel.chan_freq, scan_params->phy_mode,
 		       scan_params->is_hidden_ssid,
 		       scan_params->channel_mismatch,
+		       security_type & SCAN_SECURITY_TYPE_WPA ? "[WPA]" : "",
+		       security_type & SCAN_SECURITY_TYPE_RSN ? "[RSN]" : "",
+		       security_type & SCAN_SECURITY_TYPE_WAPI ? "[WAPI]" : "",
+		       security_type & SCAN_SECURITY_TYPE_WEP ? "[WEP]" : "",
 		       wlan_objmgr_pdev_get_pdev_id(pdev));
 
 	if (scan_obj->cb.inform_beacon)

+ 8 - 1
umac/scan/dispatcher/inc/wlan_scan_public_structs.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -359,6 +359,11 @@ struct reduced_neighbor_report {
 	struct rnr_bss_info bss_info[MAX_RNR_BSS];
 };
 
+#define SCAN_SECURITY_TYPE_WEP 0x01
+#define SCAN_SECURITY_TYPE_WPA 0x02
+#define SCAN_SECURITY_TYPE_WAPI 0x04
+#define SCAN_SECURITY_TYPE_RSN 0x08
+
 /**
  * struct scan_cache_entry: structure containing scan entry
  * @frm_subtype: updated from beacon/probe
@@ -366,6 +371,7 @@ struct reduced_neighbor_report {
  * @mac_addr: mac address
  * @ssid: ssid
  * @is_hidden_ssid: is AP having hidden ssid.
+ * @security_type: security supported
  * @seq_num: sequence number
  * @phy_mode: Phy mode of the AP
  * @avg_rssi: Average RSSI of the AP
@@ -409,6 +415,7 @@ struct scan_cache_entry {
 	struct qdf_mac_addr mac_addr;
 	struct wlan_ssid ssid;
 	bool is_hidden_ssid;
+	uint8_t security_type;
 	uint16_t seq_num;
 	enum wlan_phymode phy_mode;
 	int32_t avg_rssi;

+ 16 - 0
umac/scan/dispatcher/src/wlan_scan_utils_api.c

@@ -1371,6 +1371,21 @@ static void scm_fill_adaptive_11r_cap(struct scan_cache_entry *scan_entry)
 }
 #endif
 
+static void util_scan_set_security(struct scan_cache_entry *scan_params)
+{
+	if (util_scan_entry_wpa(scan_params))
+		scan_params->security_type |= SCAN_SECURITY_TYPE_WPA;
+
+	if (util_scan_entry_rsn(scan_params))
+		scan_params->security_type |= SCAN_SECURITY_TYPE_RSN;
+	if (util_scan_entry_wapi(scan_params))
+		scan_params->security_type |= SCAN_SECURITY_TYPE_WAPI;
+
+	if (!scan_params->security_type &&
+	    scan_params->cap_info.wlan_caps.privacy)
+		scan_params->security_type |= SCAN_SECURITY_TYPE_WEP;
+}
+
 static QDF_STATUS
 util_scan_gen_scan_entry(struct wlan_objmgr_pdev *pdev,
 			 uint8_t *frame, qdf_size_t frame_len,
@@ -1521,6 +1536,7 @@ util_scan_gen_scan_entry(struct wlan_objmgr_pdev *pdev,
 
 	scan_entry->nss = util_scan_scm_calc_nss_supported_by_ap(scan_entry);
 	scm_fill_adaptive_11r_cap(scan_entry);
+	util_scan_set_security(scan_entry);
 
 	util_scan_scm_update_bss_with_esp_data(scan_entry);
 	qbss_load = (struct qbss_load_ie *)