aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-11-06 15:57:21 (GMT)
committerJouni Malinen <j@w1.fi>2010-11-07 21:29:00 (GMT)
commitb50111fbb25558ed49c9246bad204ab8ae4e6986 (patch)
tree827117c199f974d8d7f2afdc023cedf54b0167a1 /wlantest
parentd30edf54b8541f6450f7b83b68af6b8895dafafa (diff)
downloadhostap-b50111fbb25558ed49c9246bad204ab8ae4e6986.zip
hostap-b50111fbb25558ed49c9246bad204ab8ae4e6986.tar.gz
hostap-b50111fbb25558ed49c9246bad204ab8ae4e6986.tar.bz2
wlantest: Move bss_update() into bss.c
Diffstat (limited to 'wlantest')
-rw-r--r--wlantest/bss.c53
-rw-r--r--wlantest/process.c53
-rw-r--r--wlantest/wlantest.h3
3 files changed, 56 insertions, 53 deletions
diff --git a/wlantest/bss.c b/wlantest/bss.c
index 70eb888..ec26b82 100644
--- a/wlantest/bss.c
+++ b/wlantest/bss.c
@@ -15,6 +15,7 @@
#include "utils/includes.h"
#include "utils/common.h"
+#include "common/ieee802_11_common.h"
#include "wlantest.h"
@@ -50,3 +51,55 @@ void bss_deinit(struct wlantest_bss *bss)
dl_list_del(&bss->list);
os_free(bss);
}
+
+
+void bss_update(struct wlantest_bss *bss, struct ieee802_11_elems *elems)
+{
+ if (elems->ssid == NULL || elems->ssid_len > 32) {
+ wpa_printf(MSG_INFO, "Invalid or missing SSID in a Beacon "
+ "frame for " MACSTR, MAC2STR(bss->bssid));
+ bss->parse_error_reported = 1;
+ return;
+ }
+
+ os_memcpy(bss->ssid, elems->ssid, elems->ssid_len);
+ bss->ssid_len = elems->ssid_len;
+
+ if (elems->rsn_ie == NULL) {
+ if (bss->rsnie[0]) {
+ wpa_printf(MSG_INFO, "BSS " MACSTR " - RSN IE removed",
+ MAC2STR(bss->bssid));
+ bss->rsnie[0] = 0;
+ }
+ } else {
+ if (bss->rsnie[0] == 0 ||
+ os_memcmp(bss->rsnie, elems->rsn_ie - 2,
+ elems->rsn_ie_len + 2) != 0) {
+ wpa_printf(MSG_INFO, "BSS " MACSTR " - RSN IE "
+ "stored", MAC2STR(bss->bssid));
+ wpa_hexdump(MSG_DEBUG, "RSN IE", elems->rsn_ie - 2,
+ elems->rsn_ie_len + 2);
+ }
+ os_memcpy(bss->rsnie, elems->rsn_ie - 2,
+ elems->rsn_ie_len + 2);
+ }
+
+ if (elems->wpa_ie == NULL) {
+ if (bss->wpaie[0]) {
+ wpa_printf(MSG_INFO, "BSS " MACSTR " - WPA IE removed",
+ MAC2STR(bss->bssid));
+ bss->wpaie[0] = 0;
+ }
+ } else {
+ if (bss->wpaie[0] == 0 ||
+ os_memcmp(bss->wpaie, elems->wpa_ie - 2,
+ elems->wpa_ie_len + 2) != 0) {
+ wpa_printf(MSG_INFO, "BSS " MACSTR " - WPA IE "
+ "stored", MAC2STR(bss->bssid));
+ wpa_hexdump(MSG_DEBUG, "WPA IE", elems->wpa_ie - 2,
+ elems->wpa_ie_len + 2);
+ }
+ os_memcpy(bss->wpaie, elems->wpa_ie - 2,
+ elems->wpa_ie_len + 2);
+ }
+}
diff --git a/wlantest/process.c b/wlantest/process.c
index 8a7c5fc..5282537 100644
--- a/wlantest/process.c
+++ b/wlantest/process.c
@@ -54,59 +54,6 @@ static const char * mgmt_stype(u16 stype)
}
-static void bss_update(struct wlantest_bss *bss,
- struct ieee802_11_elems *elems)
-{
- if (elems->ssid == NULL || elems->ssid_len > 32) {
- wpa_printf(MSG_INFO, "Invalid or missing SSID in a Beacon "
- "frame for " MACSTR, MAC2STR(bss->bssid));
- bss->parse_error_reported = 1;
- return;
- }
-
- os_memcpy(bss->ssid, elems->ssid, elems->ssid_len);
- bss->ssid_len = elems->ssid_len;
-
- if (elems->rsn_ie == NULL) {
- if (bss->rsnie[0]) {
- wpa_printf(MSG_INFO, "BSS " MACSTR " - RSN IE removed",
- MAC2STR(bss->bssid));
- bss->rsnie[0] = 0;
- }
- } else {
- if (bss->rsnie[0] == 0 ||
- os_memcmp(bss->rsnie, elems->rsn_ie - 2,
- elems->rsn_ie_len + 2) != 0) {
- wpa_printf(MSG_INFO, "BSS " MACSTR " - RSN IE "
- "stored", MAC2STR(bss->bssid));
- wpa_hexdump(MSG_DEBUG, "RSN IE", elems->rsn_ie - 2,
- elems->rsn_ie_len + 2);
- }
- os_memcpy(bss->rsnie, elems->rsn_ie - 2,
- elems->rsn_ie_len + 2);
- }
-
- if (elems->wpa_ie == NULL) {
- if (bss->wpaie[0]) {
- wpa_printf(MSG_INFO, "BSS " MACSTR " - WPA IE removed",
- MAC2STR(bss->bssid));
- bss->wpaie[0] = 0;
- }
- } else {
- if (bss->wpaie[0] == 0 ||
- os_memcmp(bss->wpaie, elems->wpa_ie - 2,
- elems->wpa_ie_len + 2) != 0) {
- wpa_printf(MSG_INFO, "BSS " MACSTR " - WPA IE "
- "stored", MAC2STR(bss->bssid));
- wpa_hexdump(MSG_DEBUG, "WPA IE", elems->wpa_ie - 2,
- elems->wpa_ie_len + 2);
- }
- os_memcpy(bss->wpaie, elems->wpa_ie - 2,
- elems->wpa_ie_len + 2);
- }
-}
-
-
static void rx_mgmt_beacon(struct wlantest *wt, const u8 *data, size_t len)
{
const struct ieee80211_mgmt *mgmt;
diff --git a/wlantest/wlantest.h b/wlantest/wlantest.h
index 9b9beee..b453856 100644
--- a/wlantest/wlantest.h
+++ b/wlantest/wlantest.h
@@ -17,6 +17,8 @@
#include "utils/list.h"
+struct ieee802_11_elems;
+
struct wlantest_sta {
struct dl_list list;
@@ -61,6 +63,7 @@ void monitor_deinit(struct wlantest *wt);
struct wlantest_bss * bss_get(struct wlantest *wt, const u8 *bssid);
void bss_deinit(struct wlantest_bss *bss);
+void bss_update(struct wlantest_bss *bss, struct ieee802_11_elems *elems);
struct wlantest_sta * sta_get(struct wlantest_bss *bss, const u8 *addr);
void sta_deinit(struct wlantest_sta *sta);