All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.01.org
Subject: [PATCH 4/8] scan: Add scan_bss_new_from_probe_req
Date: Thu, 24 Oct 2019 06:29:56 +0200	[thread overview]
Message-ID: <20191024043000.13687-4-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20191024043000.13687-1-andrew.zaborowski@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2078 bytes --]

---
 src/scan.c | 27 +++++++++++++++++++++++++++
 src/scan.h |  6 ++++++
 2 files changed, 33 insertions(+)

diff --git a/src/scan.c b/src/scan.c
index 2c676890..62f78130 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -46,6 +46,7 @@
 #include "src/nl80211util.h"
 #include "src/util.h"
 #include "src/p2putil.h"
+#include "src/mpdu.h"
 #include "src/scan.h"
 
 #define SCAN_MAX_INTERVAL 320
@@ -1227,6 +1228,32 @@ static void scan_bss_compute_rank(struct scan_bss *bss)
 		bss->rank = irank;
 }
 
+struct scan_bss *scan_bss_new_from_probe_req(const struct mmpdu_header *mpdu,
+						const uint8_t *body,
+						size_t body_len,
+						uint32_t frequency, int rssi)
+
+{
+	struct scan_bss *bss;
+
+	bss = l_new(struct scan_bss, 1);
+	memcpy(bss->addr, mpdu->address_2, 6);
+	bss->utilization = 127;
+	bss->source_frame = SCAN_BSS_PROBE_REQ;
+	bss->frequency = frequency;
+	bss->signal_strength = rssi;
+
+	if (!scan_parse_bss_information_elements(bss, body, body_len))
+		goto fail;
+
+	scan_bss_compute_rank(bss);
+	return bss;
+
+fail:
+	scan_bss_free(bss);
+	return NULL;
+}
+
 void scan_bss_free(struct scan_bss *bss)
 {
 	l_free(bss->ext_supp_rates_ie);
diff --git a/src/scan.h b/src/scan.h
index a3129dea..b602f731 100644
--- a/src/scan.h
+++ b/src/scan.h
@@ -43,6 +43,7 @@ struct ie_rsn_info;
 struct p2p_probe_resp;
 struct p2p_probe_req;
 struct p2p_beacon;
+struct mmpdu_header;
 
 enum scan_bss_frame_type {
 	SCAN_BSS_PROBE_RESP,
@@ -134,6 +135,11 @@ int scan_bss_rank_compare(const void *a, const void *b, void *user);
 
 int scan_bss_get_rsn_info(const struct scan_bss *bss, struct ie_rsn_info *info);
 
+struct scan_bss *scan_bss_new_from_probe_req(const struct mmpdu_header *mpdu,
+						const uint8_t *body,
+						size_t body_len,
+						uint32_t frequency, int rssi);
+
 uint8_t scan_freq_to_channel(uint32_t freq, enum scan_band *out_band);
 uint32_t scan_channel_to_freq(uint8_t channel, enum scan_band band);
 enum scan_band scan_oper_class_to_band(const uint8_t *country,
-- 
2.20.1

  parent reply	other threads:[~2019-10-24  4:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24  4:29 [PATCH 1/8] wiphy: Add wiphy_get_supported_rates Andrew Zaborowski
2019-10-24  4:29 ` [PATCH 2/8] scan: Hide CCK rates if no_cck_rates set Andrew Zaborowski
2019-10-24  4:29 ` [PATCH 3/8] scan: Parse P2P IEs according to frame type Andrew Zaborowski
2019-10-24  4:29 ` Andrew Zaborowski [this message]
2019-10-24  4:29 ` [PATCH 5/8] nl80211util: Fail in nl80211_parse_attrs if attribute missing Andrew Zaborowski
2019-10-25 18:53   ` Denis Kenzior
2019-10-24  4:29 ` [PATCH 6/8] monitor: Fix the OUI check for P2P action frames Andrew Zaborowski
2019-10-24  4:29 ` [PATCH 7/8] p2putil: Replace constants with wifi_alliance_oui Andrew Zaborowski
2019-10-25 18:34   ` Denis Kenzior
2019-10-24  4:30 ` [PATCH 8/8] p2putils: Fix length in Channel List parsing Andrew Zaborowski
2019-10-25 18:34   ` Denis Kenzior
2019-10-25 19:11 ` [PATCH 1/8] wiphy: Add wiphy_get_supported_rates Denis Kenzior
2019-10-26  2:33   ` Andrew Zaborowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191024043000.13687-4-andrew.zaborowski@intel.com \
    --to=andrew.zaborowski@intel.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.