nl80211: Add new peer candidate event for mesh

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
This commit is contained in:
Bob Copeland 2014-09-01 00:23:23 -04:00 committed by Jouni Malinen
parent 7e31703e4d
commit a52024c976
3 changed files with 51 additions and 1 deletions

View file

@ -3548,7 +3548,13 @@ enum wpa_event_type {
* to reduce issues due to interference or internal co-existence
* information in the driver.
*/
EVENT_AVOID_FREQUENCIES
EVENT_AVOID_FREQUENCIES,
/**
* EVENT_NEW_PEER_CANDIDATE - new (unknown) mesh peer notification
*/
EVENT_NEW_PEER_CANDIDATE
};
@ -4187,6 +4193,22 @@ union wpa_event_data {
* This is used as the data with EVENT_AVOID_FREQUENCIES.
*/
struct wpa_freq_range_list freq_range;
/**
* struct mesh_peer
*
* @peer: Peer address
* @ies: Beacon IEs
* @ie_len: Length of @ies
*
* Notification of new candidate mesh peer.
*/
struct mesh_peer {
const u8 *peer;
const u8 *ies;
size_t ie_len;
} mesh_peer;
};
/**

View file

@ -79,6 +79,7 @@ const char * event_to_string(enum wpa_event_type event)
E2S(SURVEY);
E2S(SCAN_STARTED);
E2S(AVOID_FREQUENCIES);
E2S(NEW_PEER_CANDIDATE);
}
return "UNKNOWN";

View file

@ -2584,6 +2584,30 @@ static void nl80211_cqm_event(struct wpa_driver_nl80211_data *drv,
}
static void nl80211_new_peer_candidate(struct wpa_driver_nl80211_data *drv,
struct nlattr **tb)
{
const u8 *addr;
union wpa_event_data data;
if (drv->nlmode != NL80211_IFTYPE_MESH_POINT)
return;
if (!tb[NL80211_ATTR_MAC] || !tb[NL80211_ATTR_IE])
return;
addr = nla_data(tb[NL80211_ATTR_MAC]);
wpa_printf(MSG_DEBUG, "nl80211: New peer candidate" MACSTR,
MAC2STR(addr));
os_memset(&data, 0, sizeof(data));
data.mesh_peer.peer = addr;
data.mesh_peer.ies = nla_data(tb[NL80211_ATTR_IE]);
data.mesh_peer.ie_len = nla_len(tb[NL80211_ATTR_IE]);
wpa_supplicant_event(drv->ctx, EVENT_NEW_PEER_CANDIDATE, &data);
}
static void nl80211_new_station_event(struct wpa_driver_nl80211_data *drv,
struct nlattr **tb)
{
@ -3238,6 +3262,9 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
case NL80211_CMD_VENDOR:
nl80211_vendor_event(drv, tb);
break;
case NL80211_CMD_NEW_PEER_CANDIDATE:
nl80211_new_peer_candidate(drv, tb);
break;
default:
wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event "
"(cmd=%d)", cmd);