aboutsummaryrefslogtreecommitdiffstats
path: root/src/ap
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-04-01 18:48:12 +0300
committerJouni Malinen <j@w1.fi>2012-04-01 18:48:12 +0300
commitbaf513d6952c67b94925c5e82291be19f858ad1e (patch)
tree72d718d3dfde76cdbe45a78e93fa414105507b56 /src/ap
parent370b076197bccc4b6d6862b94861571dadc5c128 (diff)
downloadexternal_wpa_supplicant_8_ti-baf513d6952c67b94925c5e82291be19f858ad1e.zip
external_wpa_supplicant_8_ti-baf513d6952c67b94925c5e82291be19f858ad1e.tar.gz
external_wpa_supplicant_8_ti-baf513d6952c67b94925c5e82291be19f858ad1e.tar.bz2
Pass signal strength through, fix units
The signal strength is currently never used as the only driver reporting it is nl80211 which uses IEEE80211_RADIOTAP_DB_ANTSIGNAL which is never populated by the kernel. The kernel will (soon) populate IEEE80211_RADIOTAP_DBM_ANTSIGNAL instead though, so use that. Also, since it was never really populated, we can redefine the signal field to be in dBm units only. My next patch will also require knowing the signal strength of probe requests throughout the code (where available), so add it to the necessary APIs. Signed-hostap: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'src/ap')
-rw-r--r--src/ap/beacon.c5
-rw-r--r--src/ap/beacon.h3
-rw-r--r--src/ap/drv_callbacks.c9
-rw-r--r--src/ap/hostapd.h10
-rw-r--r--src/ap/ieee802_11.c2
-rw-r--r--src/ap/utils.c3
-rw-r--r--src/ap/wps_hostapd.c6
7 files changed, 24 insertions, 14 deletions
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 0253663..b711063 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -293,7 +293,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
void handle_probe_req(struct hostapd_data *hapd,
- const struct ieee80211_mgmt *mgmt, size_t len)
+ const struct ieee80211_mgmt *mgmt, size_t len,
+ int ssi_signal)
{
u8 *resp;
struct ieee802_11_elems elems;
@@ -311,7 +312,7 @@ void handle_probe_req(struct hostapd_data *hapd,
for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++)
if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
mgmt->sa, mgmt->da, mgmt->bssid,
- ie, ie_len) > 0)
+ ie, ie_len, ssi_signal) > 0)
return;
if (!hapd->iconf->send_probe_response)
diff --git a/src/ap/beacon.h b/src/ap/beacon.h
index 0dd6021..37f10d2 100644
--- a/src/ap/beacon.h
+++ b/src/ap/beacon.h
@@ -19,7 +19,8 @@
struct ieee80211_mgmt;
void handle_probe_req(struct hostapd_data *hapd,
- const struct ieee80211_mgmt *mgmt, size_t len);
+ const struct ieee80211_mgmt *mgmt, size_t len,
+ int ssi_signal);
void ieee802_11_set_beacon(struct hostapd_data *hapd);
void ieee802_11_set_beacons(struct hostapd_iface *iface);
void ieee802_11_update_beacons(struct hostapd_iface *iface);
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 820a903..bd5b908 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -265,7 +265,8 @@ void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr)
int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
- const u8 *bssid, const u8 *ie, size_t ie_len)
+ const u8 *bssid, const u8 *ie, size_t ie_len,
+ int ssi_signal)
{
size_t i;
int ret = 0;
@@ -276,7 +277,8 @@ int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
random_add_randomness(sa, ETH_ALEN);
for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++) {
if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
- sa, da, bssid, ie, ie_len) > 0) {
+ sa, da, bssid, ie, ie_len,
+ ssi_signal) > 0) {
ret = 1;
break;
}
@@ -541,7 +543,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
data->rx_probe_req.da,
data->rx_probe_req.bssid,
data->rx_probe_req.ie,
- data->rx_probe_req.ie_len);
+ data->rx_probe_req.ie_len,
+ data->rx_probe_req.ssi_signal);
break;
case EVENT_NEW_STA:
hostapd_event_new_sta(hapd, data->new_sta.addr);
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 2cb4a65..63cf494 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -31,7 +31,7 @@ struct hapd_interfaces {
struct hostapd_probereq_cb {
int (*cb)(void *ctx, const u8 *sa, const u8 *da, const u8 *bssid,
- const u8 *ie, size_t ie_len);
+ const u8 *ie, size_t ie_len, int ssi_signal);
void *ctx;
};
@@ -45,7 +45,7 @@ struct hostapd_rate_data {
struct hostapd_frame_info {
u32 channel;
u32 datarate;
- u32 ssi_signal;
+ int ssi_signal; /* dBm */
};
@@ -269,7 +269,8 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
int hostapd_register_probereq_cb(struct hostapd_data *hapd,
int (*cb)(void *ctx, const u8 *sa,
const u8 *da, const u8 *bssid,
- const u8 *ie, size_t ie_len),
+ const u8 *ie, size_t ie_len,
+ int ssi_signal),
void *ctx);
void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
@@ -279,6 +280,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr);
int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
- const u8 *bssid, const u8 *ie, size_t ie_len);
+ const u8 *bssid, const u8 *ie, size_t ie_len,
+ int ssi_signal);
#endif /* HOSTAPD_H */
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 9c931ca..f305b07 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -1392,7 +1392,7 @@ void ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
if (stype == WLAN_FC_STYPE_PROBE_REQ) {
- handle_probe_req(hapd, mgmt, len);
+ handle_probe_req(hapd, mgmt, len, fi->ssi_signal);
return;
}
diff --git a/src/ap/utils.c b/src/ap/utils.c
index 36c1182..3e9fc08 100644
--- a/src/ap/utils.c
+++ b/src/ap/utils.c
@@ -17,7 +17,8 @@
int hostapd_register_probereq_cb(struct hostapd_data *hapd,
int (*cb)(void *ctx, const u8 *sa,
const u8 *da, const u8 *bssid,
- const u8 *ie, size_t ie_len),
+ const u8 *ie, size_t ie_len,
+ int ssi_signal),
void *ctx)
{
struct hostapd_probereq_cb *n;
diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
index 01038e9..e47e7e7 100644
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -37,7 +37,8 @@ static void hostapd_wps_upnp_deinit(struct hostapd_data *hapd);
static int hostapd_wps_probe_req_rx(void *ctx, const u8 *addr, const u8 *da,
const u8 *bssid,
- const u8 *ie, size_t ie_len);
+ const u8 *ie, size_t ie_len,
+ int ssi_signal);
static void hostapd_wps_ap_pin_timeout(void *eloop_data, void *user_ctx);
@@ -1178,7 +1179,8 @@ error:
static int hostapd_wps_probe_req_rx(void *ctx, const u8 *addr, const u8 *da,
const u8 *bssid,
- const u8 *ie, size_t ie_len)
+ const u8 *ie, size_t ie_len,
+ int ssi_signal)
{
struct hostapd_data *hapd = ctx;
struct wpabuf *wps_ie;