3 * Copyright (c) 2010, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #include "utils/includes.h"
17 #include "utils/common.h"
18 #include "common/ieee802_11_common.h"
22 struct wlantest_sta * sta_get(struct wlantest_bss *bss, const u8 *addr)
24 struct wlantest_sta *sta;
27 return NULL; /* Skip group addressed frames */
29 dl_list_for_each(sta, &bss->sta, struct wlantest_sta, list) {
30 if (os_memcmp(sta->addr, addr, ETH_ALEN) == 0)
34 sta = os_zalloc(sizeof(*sta));
37 os_memcpy(sta->addr, addr, ETH_ALEN);
38 dl_list_add(&bss->sta, &sta->list);
39 wpa_printf(MSG_DEBUG, "Discovered new STA " MACSTR " in BSS " MACSTR,
40 MAC2STR(sta->addr), MAC2STR(bss->bssid));
45 void sta_deinit(struct wlantest_sta *sta)
47 dl_list_del(&sta->list);
52 void sta_update_assoc(struct wlantest_sta *sta, struct ieee802_11_elems *elems)
54 if (elems->wpa_ie && elems->rsn_ie) {
55 wpa_printf(MSG_INFO, "Both WPA IE and RSN IE included in "
56 "Association Request frame from " MACSTR,
61 wpa_hexdump(MSG_DEBUG, "RSN IE", elems->rsn_ie - 2,
62 elems->rsn_ie_len + 2);
63 os_memcpy(sta->rsnie, elems->rsn_ie - 2,
64 elems->rsn_ie_len + 2);
65 } else if (elems->wpa_ie) {
66 wpa_hexdump(MSG_DEBUG, "WPA IE", elems->wpa_ie - 2,
67 elems->wpa_ie_len + 2);
68 os_memcpy(sta->rsnie, elems->wpa_ie - 2,
69 elems->wpa_ie_len + 2);