P2P: Add new_device flag to dev_found callback

The DBus code will want to have perfect matching of dev_found and the
dev_lost it adds so it doesn't need to keep track internally. Enable
that with a new flag in the core that tracks whether we have already
notified about this -- the existing users can ignore it.

The part where this is always set to 1 if the new device is discovered
by a driver that has P2P in the driver is buggy -- the driver should
feed the P2P peer database and then that should feed the notification
here instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2011-02-24 21:59:58 +02:00 committed by Jouni Malinen
parent c5db8e5170
commit 8fd7dc1b1c
7 changed files with 24 additions and 9 deletions

View file

@ -2014,7 +2014,12 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
peer_info.dev_capab = data->p2p_dev_found.dev_capab;
peer_info.group_capab = data->p2p_dev_found.group_capab;
wpas_dev_found(wpa_s, data->p2p_dev_found.addr, &peer_info);
/*
* FIX: new_device=1 is not necessarily correct. We should
* maintain a P2P peer database in wpa_supplicant and update
* this information based on whether the peer is truly new.
*/
wpas_dev_found(wpa_s, data->p2p_dev_found.addr, &peer_info, 1);
break;
}
case EVENT_P2P_GO_NEG_REQ_RX:

View file

@ -1131,7 +1131,8 @@ void wpas_go_neg_req_rx(void *ctx, const u8 *src, u16 dev_passwd_id)
void wpas_dev_found(void *ctx, const u8 *addr,
const struct p2p_peer_info *info)
const struct p2p_peer_info *info,
int new_device)
{
struct wpa_supplicant *wpa_s = ctx;
char devtype[WPS_DEV_TYPE_BUFSIZE];

View file

@ -64,7 +64,8 @@ void wpas_p2p_rx_action(struct wpa_supplicant *wpa_s, const u8 *da,
void wpas_p2p_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ies);
void wpas_p2p_group_deinit(struct wpa_supplicant *wpa_s);
void wpas_dev_found(void *ctx, const u8 *addr,
const struct p2p_peer_info *info);
const struct p2p_peer_info *info,
int new_device);
void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res);
void wpas_go_neg_req_rx(void *ctx, const u8 *src, u16 dev_passwd_id);
void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,