@@ -2198,6 +2198,7 @@ int nan_peer_get_pot_avail(struct nan_data *nan, const u8 *addr,
* @n_chans: Number of channel entries in chans
* @chans: Channel entries
* @buf: Buffer to which the availability attributes will be added
+ * @include_potential: If true, potential availability entries will be included
* Returns: 0 on success; -1 on failure
*
* Convert the given NAN schedule information to availability attributes and add
@@ -2208,11 +2209,12 @@ int nan_convert_sched_to_avail_attrs(struct nan_data *nan, u8 sequence_id,
u32 map_ids_bitmap,
size_t n_chans,
struct nan_chan_schedule *chans,
- struct wpabuf *buf)
+ struct wpabuf *buf,
+ bool include_potential)
{
return nan_add_avail_attrs(nan, sequence_id, map_ids_bitmap,
NAN_AVAIL_ENTRY_CTRL_TYPE_COND,
- n_chans, chans, buf);
+ n_chans, chans, buf, include_potential);
}
@@ -557,7 +557,8 @@ int nan_convert_sched_to_avail_attrs(struct nan_data *nan, u8 sequence_id,
u32 map_ids_bitmap,
size_t n_chans,
struct nan_chan_schedule *chans,
- struct wpabuf *buf);
+ struct wpabuf *buf,
+ bool include_potential);
bool nan_peer_pairing_supported(struct nan_data *nan, const u8 *addr);
bool nan_peer_npk_nik_caching_supported(struct nan_data *nan, const u8 *addr);
int nan_get_peer_ndc_freq(struct nan_data *nan ,
@@ -579,7 +579,7 @@ int nan_get_chan_bm(struct nan_data *nan, const struct nan_sched_chan *chan,
int nan_add_avail_attrs(struct nan_data *nan, u8 sequence_id,
u32 map_ids_bitmap, u8 type_for_conditional,
size_t n_chans, struct nan_chan_schedule *chans,
- struct wpabuf *buf);
+ struct wpabuf *buf, bool include_potential);
void nan_del_avail_entry(struct nan_avail_entry *entry);
void nan_flush_avail_entries(struct dl_list *avail_entries);
int nan_sched_entries_to_avail_entries(struct nan_data *nan,
@@ -1372,7 +1372,7 @@ int nan_ndl_add_avail_attrs(struct nan_data *nan, const struct nan_peer *peer,
return nan_add_avail_attrs(nan, sched->sequence_id,
sched->map_ids_bitmap,
type_for_conditional,
- sched->n_chans, sched->chans, buf);
+ sched->n_chans, sched->chans, buf, true);
}
@@ -706,6 +706,7 @@ static void nan_build_pot_avail_entry(struct nan_data *nan, struct wpabuf *buf,
* @n_chans: Number of channels in chans
* @chans: Channel schedules
* @buf: Frame buffer to which the attribute would be added
+ * @include_potential: If true, potential availability entries would be added
* Returns: 0 on success, negative on failure.
*
* An availability attribute is added for each map (identified by map ID) in the
@@ -716,7 +717,7 @@ static void nan_build_pot_avail_entry(struct nan_data *nan, struct wpabuf *buf,
int nan_add_avail_attrs(struct nan_data *nan, u8 sequence_id,
u32 map_ids_bitmap, u8 type_for_conditional,
size_t n_chans, struct nan_chan_schedule *chans,
- struct wpabuf *buf)
+ struct wpabuf *buf, bool include_potential)
{
u8 last_map_id = NAN_INVALID_MAP_ID;
u32 handled_map_ids = 0;
@@ -770,8 +771,9 @@ int nan_add_avail_attrs(struct nan_data *nan, u8 sequence_id,
"NAN: Add avail attr done: map_id=%u",
last_map_id);
- nan_build_pot_avail_entry(nan, buf,
- last_map_id);
+ if (include_potential)
+ nan_build_pot_avail_entry(nan, buf,
+ last_map_id);
WPA_PUT_LE16(len_ptr,
(u8 *) wpabuf_put(buf, 0) -
len_ptr - 2);
@@ -815,7 +817,8 @@ int nan_add_avail_attrs(struct nan_data *nan, u8 sequence_id,
}
if (last_map_id != NAN_INVALID_MAP_ID) {
- nan_build_pot_avail_entry(nan, buf, last_map_id);
+ if (include_potential)
+ nan_build_pot_avail_entry(nan, buf, last_map_id);
WPA_PUT_LE16(len_ptr, (u8 *) wpabuf_put(buf, 0) - len_ptr - 2);
wpa_printf(MSG_DEBUG, "NAN: Add avail attr done: map_id=%u",
@@ -825,6 +828,9 @@ int nan_add_avail_attrs(struct nan_data *nan, u8 sequence_id,
"NAN: No committed/conditional entries were added");
}
+ if (!include_potential)
+ return 0;
+
/*
* Add NAN availability attributes with a single potential availability
* entry for map IDs that are not included in the schedule.
@@ -2044,8 +2044,10 @@ static void wpas_nan_de_add_extra_attrs(void *ctx, struct wpabuf *buf)
wpas_nan_fill_ndp_schedule(wpa_s, &sched);
nan_add_dev_capa_attr(wpa_s->nan, buf);
- nan_convert_sched_to_avail_attrs(wpa_s->nan, wpa_s->schedule_sequence_id,
- map_ids, sched.n_chans,sched.chans, buf);
+ nan_convert_sched_to_avail_attrs(wpa_s->nan,
+ wpa_s->schedule_sequence_id,
+ map_ids, sched.n_chans,
+ sched.chans, buf, true);
}