@@ -37,7 +37,7 @@ static int hostapd_nan_de_tx(void *ctx, unsigned int freq,
static int hostapd_nan_de_listen(void *ctx, unsigned int freq,
- unsigned int duration)
+ unsigned int duration, const u8 *forced_addr)
{
return 0;
}
@@ -958,8 +958,9 @@ static void nan_de_timer(void *eloop_ctx, void *timeout_ctx)
}
if ((unsigned int) duration > de->max_listen)
duration = de->max_listen;
- if (de->cb.listen(de->cb.ctx, srv->freq, duration) ==
- 0) {
+ if (de->cb.listen(de->cb.ctx, srv->freq, duration,
+ srv->forced_addr_set ?
+ srv->forced_addr : NULL) == 0) {
wpa_printf(MSG_DEBUG,
"NAN: Publisher in pauseState - started listen on %u MHz",
srv->freq);
@@ -994,7 +995,9 @@ static void nan_de_timer(void *eloop_ctx, void *timeout_ctx)
duration = nan_de_listen_duration(de, srv);
started = true;
- if (de->cb.listen(de->cb.ctx, srv->freq, duration) == 0)
+ if (de->cb.listen(de->cb.ctx, srv->freq, duration,
+ srv->forced_addr_set ?
+ srv->forced_addr : NULL) == 0)
de->listen_freq = srv->freq;
}
@@ -49,7 +49,8 @@ struct nan_callbacks {
int (*tx)(void *ctx, unsigned int freq, unsigned int wait_time,
const u8 *dst, const u8 *src, const u8 *bssid,
const struct wpabuf *buf);
- int (*listen)(void *ctx, unsigned int freq, unsigned int duration);
+ int (*listen)(void *ctx, unsigned int freq, unsigned int duration,
+ const u8 *forced_addr);
/* NAN DE Events */
void (*discovery_result)(void *ctx, struct nan_discovery_result *res);
@@ -4174,6 +4174,8 @@ static int wpas_nan_de_tx(void *ctx, unsigned int freq, unsigned int wait_time,
struct wpas_nan_usd_listen_work {
unsigned int freq;
unsigned int duration;
+ u8 forced_addr[ETH_ALEN];
+ bool forced_addr_set;
};
@@ -4224,7 +4226,11 @@ static void wpas_nan_usd_start_listen_cb(struct wpa_radio_work *work,
duration = wpa_s->max_remain_on_chan;
wpa_printf(MSG_DEBUG, "NAN: Start listen on %u MHz for %u ms",
lwork->freq, duration);
- if (wpa_drv_remain_on_channel(wpa_s, lwork->freq, duration, NULL) < 0) {
+ if (wpa_drv_remain_on_channel(wpa_s, lwork->freq, duration,
+ (lwork->forced_addr_set &&
+ (wpa_s->drv_flags2 &
+ WPA_DRIVER_FLAGS2_ROC_ADDR_FILTER)) ?
+ lwork->forced_addr : NULL) < 0) {
wpa_printf(MSG_DEBUG,
"NAN: Failed to request the driver to remain on channel (%u MHz) for listen",
lwork->freq);
@@ -4241,7 +4247,7 @@ static void wpas_nan_usd_start_listen_cb(struct wpa_radio_work *work,
static int wpas_nan_de_listen(void *ctx, unsigned int freq,
- unsigned int duration)
+ unsigned int duration, const u8 *forced_addr)
{
struct wpa_supplicant *wpa_s = ctx;
struct wpas_nan_usd_listen_work *lwork;
@@ -4251,6 +4257,10 @@ static int wpas_nan_de_listen(void *ctx, unsigned int freq,
return -1;
lwork->freq = freq;
lwork->duration = duration;
+ if (forced_addr) {
+ os_memcpy(lwork->forced_addr, forced_addr, ETH_ALEN);
+ lwork->forced_addr_set = true;
+ }
if (!radio_add_work(wpa_s, freq, "nan-usd-listen", 0,
wpas_nan_usd_start_listen_cb, lwork)) {