static void test_dev_found(void *ctx, const u8 *addr,
- const struct p2p_peer_info *info)
+ const struct p2p_peer_info *info, int new_device)
{
struct wpa_driver_test_data *drv = ctx;
union wpa_event_data event;
dev->oper_freq = freq;
p2p->cfg->dev_found(p2p->cfg->cb_ctx,
dev->info.p2p_device_addr,
- &dev->info);
+ &dev->info, 1);
+ dev->flags |= P2P_DEV_REPORTED | P2P_DEV_REPORTED_ONCE;
}
os_memcpy(dev->interface_addr, cli->p2p_interface_addr,
"P2P: Do not report rejected device");
return 0;
}
- p2p->cfg->dev_found(p2p->cfg->cb_ctx, addr, &dev->info);
- dev->flags |= P2P_DEV_REPORTED;
+
+ p2p->cfg->dev_found(p2p->cfg->cb_ctx, addr, &dev->info,
+ !(dev->flags & P2P_DEV_REPORTED_ONCE));
+ dev->flags |= P2P_DEV_REPORTED | P2P_DEV_REPORTED_ONCE;
return 0;
}
return;
}
- p2p->cfg->dev_found(p2p->cfg->cb_ctx, addr, &dev->info);
+ p2p->cfg->dev_found(p2p->cfg->cb_ctx, addr, &dev->info,
+ !(dev->flags & P2P_DEV_REPORTED_ONCE));
+ dev->flags |= P2P_DEV_REPORTED | P2P_DEV_REPORTED_ONCE;
}
* @ctx: Callback context from cb_ctx
* @addr: Source address of the message triggering this notification
* @info: P2P peer information
+ * @new_device: Inform if the peer is newly found
*
* This callback is used to notify that a new P2P Device has been
* found. This may happen, e.g., during Search state based on scan
* Group Owner Negotiation Request.
*/
void (*dev_found)(void *ctx, const u8 *addr,
- const struct p2p_peer_info *info);
+ const struct p2p_peer_info *info,
+ int new_device);
/**
* go_neg_req_rx - Notification of a receive GO Negotiation Request
#define P2P_DEV_GROUP_CLIENT_ONLY BIT(12)
#define P2P_DEV_FORCE_FREQ BIT(13)
#define P2P_DEV_PD_FOR_JOIN BIT(14)
+#define P2P_DEV_REPORTED_ONCE BIT(15)
unsigned int flags;
int status; /* enum p2p_status_code */
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:
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];
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,