Lines Matching +full:channel +full:- +full:0
2 * wpa_supplicant - Off-channel Action frame TX/RX
3 * Copyright (c) 2009-2010, Atheros Communications
26 if (ether_addr_equal(src, wpa_s->own_addr)) { in wpas_get_tx_interface()
28 if (wpa_s->p2p_mgmt && wpa_s != wpa_s->parent && in wpas_get_tx_interface()
29 wpa_s->parent->ap_iface && in wpas_get_tx_interface()
30 ether_addr_equal(wpa_s->parent->own_addr, in wpas_get_tx_interface()
31 wpa_s->own_addr) && in wpas_get_tx_interface()
32 wpabuf_len(wpa_s->pending_action_tx) >= 2 && in wpas_get_tx_interface()
33 *wpabuf_head_u8(wpa_s->pending_action_tx) != in wpas_get_tx_interface()
37 * the GO interface, make sure non-Public Action frames in wpas_get_tx_interface()
43 wpa_s->parent->ifname, wpa_s->ifname); in wpas_get_tx_interface()
44 return wpa_s->parent; in wpas_get_tx_interface()
53 iface = wpa_s->global->ifaces; in wpas_get_tx_interface()
55 if (ether_addr_equal(src, iface->own_addr)) in wpas_get_tx_interface()
57 iface = iface->next; in wpas_get_tx_interface()
62 iface->ifname, wpa_s->ifname); in wpas_get_tx_interface()
77 without_roc = wpa_s->pending_action_without_roc; in wpas_send_action_cb()
78 wpa_s->pending_action_without_roc = 0; in wpas_send_action_cb()
80 …"Off-channel: Send Action callback (without_roc=%d pending_action_tx=%p pending_action_tx_done=%d)… in wpas_send_action_cb()
81 without_roc, wpa_s->pending_action_tx, in wpas_send_action_cb()
82 !!wpa_s->pending_action_tx_done); in wpas_send_action_cb()
84 if (wpa_s->pending_action_tx == NULL || wpa_s->pending_action_tx_done) in wpas_send_action_cb()
96 iface = wpas_get_tx_interface(wpa_s, wpa_s->pending_action_src); in wpas_send_action_cb()
98 if (wpa_s->off_channel_freq != wpa_s->pending_action_freq && in wpas_send_action_cb()
99 wpa_s->pending_action_freq != 0 && in wpas_send_action_cb()
100 wpa_s->pending_action_freq != iface->assoc_freq) { in wpas_send_action_cb()
101 wpa_printf(MSG_DEBUG, "Off-channel: Pending Action frame TX " in wpas_send_action_cb()
104 wpa_s->pending_action_freq, in wpas_send_action_cb()
105 wpa_s->off_channel_freq, in wpas_send_action_cb()
106 iface->assoc_freq); in wpas_send_action_cb()
107 if (without_roc && wpa_s->off_channel_freq == 0) { in wpas_send_action_cb()
111 * on the correct channel, but remain-on-channel cancel in wpas_send_action_cb()
114 wpa_printf(MSG_DEBUG, "Off-channel: Schedule " in wpas_send_action_cb()
115 "remain-on-channel to send Action frame"); in wpas_send_action_cb()
117 if (wpa_s->extra_roc_dur) { in wpas_send_action_cb()
119 "TESTING: Increase ROC duration %u -> %u", in wpas_send_action_cb()
121 duration + wpa_s->extra_roc_dur); in wpas_send_action_cb()
122 duration += wpa_s->extra_roc_dur; in wpas_send_action_cb()
126 wpa_s, wpa_s->pending_action_freq, in wpas_send_action_cb()
127 duration) < 0) { in wpas_send_action_cb()
128 wpa_printf(MSG_DEBUG, "Off-channel: Failed to " in wpas_send_action_cb()
130 "channel (%u MHz) for Action Frame " in wpas_send_action_cb()
131 "TX", wpa_s->pending_action_freq); in wpas_send_action_cb()
133 wpa_s->off_channel_freq = 0; in wpas_send_action_cb()
134 wpa_s->roc_waiting_drv_freq = in wpas_send_action_cb()
135 wpa_s->pending_action_freq; in wpas_send_action_cb()
141 wpa_printf(MSG_DEBUG, "Off-channel: Sending pending Action frame to " in wpas_send_action_cb()
143 MAC2STR(wpa_s->pending_action_dst), iface->ifname, in wpas_send_action_cb()
144 wpa_s->pending_action_tx); in wpas_send_action_cb()
145 res = wpa_drv_send_action(iface, wpa_s->pending_action_freq, 0, in wpas_send_action_cb()
146 wpa_s->pending_action_dst, in wpas_send_action_cb()
147 wpa_s->pending_action_src, in wpas_send_action_cb()
148 wpa_s->pending_action_bssid, in wpas_send_action_cb()
149 wpabuf_head(wpa_s->pending_action_tx), in wpas_send_action_cb()
150 wpabuf_len(wpa_s->pending_action_tx), in wpas_send_action_cb()
151 wpa_s->pending_action_no_cck); in wpas_send_action_cb()
153 wpa_printf(MSG_DEBUG, "Off-channel: Failed to send the " in wpas_send_action_cb()
160 wpa_s, wpa_s->pending_action_dst, in wpas_send_action_cb()
161 wpabuf_head(wpa_s->pending_action_tx), in wpas_send_action_cb()
162 wpabuf_len(wpa_s->pending_action_tx), in wpas_send_action_cb()
169 * offchannel_send_action_tx_status - TX status callback
183 if (wpa_s->pending_action_tx == NULL) { in offchannel_send_action_tx_status()
184 wpa_printf(MSG_DEBUG, "Off-channel: Ignore Action TX status - " in offchannel_send_action_tx_status()
189 if (!ether_addr_equal(dst, wpa_s->pending_action_dst)) { in offchannel_send_action_tx_status()
190 wpa_printf(MSG_DEBUG, "Off-channel: Ignore Action TX status - " in offchannel_send_action_tx_status()
196 if (data_len - wpabuf_len(wpa_s->pending_action_tx) != 24 || in offchannel_send_action_tx_status()
197 os_memcmp(data + 24, wpabuf_head(wpa_s->pending_action_tx), in offchannel_send_action_tx_status()
198 wpabuf_len(wpa_s->pending_action_tx)) != 0) { in offchannel_send_action_tx_status()
199 wpa_printf(MSG_DEBUG, "Off-channel: Ignore Action TX status - " in offchannel_send_action_tx_status()
204 wpa_s->pending_action_tx); in offchannel_send_action_tx_status()
209 "Off-channel: Delete matching pending action frame (dst=" in offchannel_send_action_tx_status()
211 wpa_s->pending_action_tx); in offchannel_send_action_tx_status()
213 wpa_s->pending_action_tx); in offchannel_send_action_tx_status()
214 wpabuf_free(wpa_s->pending_action_tx); in offchannel_send_action_tx_status()
215 wpa_s->pending_action_tx = NULL; in offchannel_send_action_tx_status()
217 wpa_printf(MSG_DEBUG, "Off-channel: TX status result=%d cb=%p", in offchannel_send_action_tx_status()
218 result, wpa_s->pending_action_tx_status_cb); in offchannel_send_action_tx_status()
220 if (wpa_s->pending_action_tx_status_cb) { in offchannel_send_action_tx_status()
221 wpa_s->pending_action_tx_status_cb( in offchannel_send_action_tx_status()
222 wpa_s, wpa_s->pending_action_freq, in offchannel_send_action_tx_status()
223 wpa_s->pending_action_dst, wpa_s->pending_action_src, in offchannel_send_action_tx_status()
224 wpa_s->pending_action_bssid, in offchannel_send_action_tx_status()
229 if (wpa_s->global->p2p_long_listen > 0) { in offchannel_send_action_tx_status()
232 wpas_p2p_listen_start(wpa_s, wpa_s->global->p2p_long_listen); in offchannel_send_action_tx_status()
239 * offchannel_send_action - Request off-channel Action frame TX
241 * @freq: The frequency in MHz indicating the channel on which the frame is to
242 * transmitted or 0 for the current channel (only if associated)
251 * Returns: 0 on success or -1 on failure
254 * current operating channel or on another channel (off-channel). The actual
256 * channel. The @wait_time parameter can be used to request the driver to remain
257 * awake on the channel to wait for a response.
270 wpa_printf(MSG_DEBUG, "Off-channel: Send action frame: freq=%d dst=" in offchannel_send_action()
275 wpa_s->pending_action_tx_status_cb = tx_cb; in offchannel_send_action()
277 if (wpa_s->pending_action_tx) { in offchannel_send_action()
278 wpa_printf(MSG_DEBUG, "Off-channel: Dropped pending Action " in offchannel_send_action()
280 MAC2STR(wpa_s->pending_action_dst), in offchannel_send_action()
281 wpa_s->pending_action_tx); in offchannel_send_action()
283 wpa_s->pending_action_tx); in offchannel_send_action()
284 wpabuf_free(wpa_s->pending_action_tx); in offchannel_send_action()
286 wpa_s->pending_action_tx_done = 0; in offchannel_send_action()
287 wpa_s->pending_action_tx = wpabuf_alloc(len); in offchannel_send_action()
288 if (wpa_s->pending_action_tx == NULL) { in offchannel_send_action()
289 wpa_printf(MSG_DEBUG, "Off-channel: Failed to allocate Action " in offchannel_send_action()
292 return -1; in offchannel_send_action()
294 wpabuf_put_data(wpa_s->pending_action_tx, buf, len); in offchannel_send_action()
295 os_memcpy(wpa_s->pending_action_src, src, ETH_ALEN); in offchannel_send_action()
296 os_memcpy(wpa_s->pending_action_dst, dst, ETH_ALEN); in offchannel_send_action()
297 os_memcpy(wpa_s->pending_action_bssid, bssid, ETH_ALEN); in offchannel_send_action()
298 wpa_s->pending_action_freq = freq; in offchannel_send_action()
299 wpa_s->pending_action_no_cck = no_cck; in offchannel_send_action()
301 "Off-channel: Stored pending action frame (dst=" MACSTR in offchannel_send_action()
303 MAC2STR(dst), wpa_s->pending_action_tx); in offchannel_send_action()
305 wpa_s->pending_action_tx); in offchannel_send_action()
307 if (freq != 0 && wpa_s->drv_flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) { in offchannel_send_action()
312 wpa_s->action_tx_wait_time = wait_time; in offchannel_send_action()
314 wpa_s->action_tx_wait_time_used = 1; in offchannel_send_action()
317 iface, wpa_s->pending_action_freq, in offchannel_send_action()
318 wait_time, wpa_s->pending_action_dst, in offchannel_send_action()
319 wpa_s->pending_action_src, wpa_s->pending_action_bssid, in offchannel_send_action()
320 wpabuf_head(wpa_s->pending_action_tx), in offchannel_send_action()
321 wpabuf_len(wpa_s->pending_action_tx), in offchannel_send_action()
322 wpa_s->pending_action_no_cck); in offchannel_send_action()
323 if (ret == 0) in offchannel_send_action()
324 wpa_s->pending_action_tx_done = 1; in offchannel_send_action()
331 if (tx_iface->assoc_freq == freq) { in offchannel_send_action()
332 wpa_printf(MSG_DEBUG, "Off-channel: Already on " in offchannel_send_action()
333 "requested channel (TX interface operating " in offchannel_send_action()
334 "channel)"); in offchannel_send_action()
335 freq = 0; in offchannel_send_action()
339 if (wpa_s->off_channel_freq == freq || freq == 0) { in offchannel_send_action()
340 wpa_printf(MSG_DEBUG, "Off-channel: Already on requested " in offchannel_send_action()
341 "channel; send Action frame immediately"); in offchannel_send_action()
343 * duration on the channel? */ in offchannel_send_action()
344 wpa_s->pending_action_without_roc = 1; in offchannel_send_action()
346 eloop_register_timeout(0, 0, wpas_send_action_cb, wpa_s, NULL); in offchannel_send_action()
347 return 0; in offchannel_send_action()
349 wpa_s->pending_action_without_roc = 0; in offchannel_send_action()
351 if (wpa_s->roc_waiting_drv_freq == freq) { in offchannel_send_action()
352 wpa_printf(MSG_DEBUG, "Off-channel: Already waiting for " in offchannel_send_action()
355 return 0; in offchannel_send_action()
358 wpa_printf(MSG_DEBUG, "Off-channel: Schedule Action frame to be " in offchannel_send_action()
360 "channel"); in offchannel_send_action()
361 if (wait_time > wpa_s->max_remain_on_chan) in offchannel_send_action()
362 wait_time = wpa_s->max_remain_on_chan; in offchannel_send_action()
363 else if (wait_time == 0) in offchannel_send_action()
366 if (wpa_s->extra_roc_dur) { in offchannel_send_action()
367 wpa_printf(MSG_DEBUG, "TESTING: Increase ROC duration %u -> %u", in offchannel_send_action()
368 wait_time, wait_time + wpa_s->extra_roc_dur); in offchannel_send_action()
369 wait_time += wpa_s->extra_roc_dur; in offchannel_send_action()
372 if (wpa_drv_remain_on_channel(wpa_s, freq, wait_time) < 0) { in offchannel_send_action()
373 wpa_printf(MSG_DEBUG, "Off-channel: Failed to request driver " in offchannel_send_action()
374 "to remain on channel (%u MHz) for Action " in offchannel_send_action()
376 return -1; in offchannel_send_action()
378 wpa_s->off_channel_freq = 0; in offchannel_send_action()
379 wpa_s->roc_waiting_drv_freq = freq; in offchannel_send_action()
381 return 0; in offchannel_send_action()
386 * offchannel_send_send_action_done - Notify completion of Action frame sequence
390 * the channel that was used with offchannel_send_action().
395 …"Off-channel: Action frame sequence done notification: pending_action_tx=%p drv_offchan_tx=%d acti… in offchannel_send_action_done()
396 wpa_s->pending_action_tx, in offchannel_send_action_done()
397 !!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX), in offchannel_send_action_done()
398 wpa_s->action_tx_wait_time, wpa_s->off_channel_freq, in offchannel_send_action_done()
399 wpa_s->roc_waiting_drv_freq); in offchannel_send_action_done()
400 wpabuf_free(wpa_s->pending_action_tx); in offchannel_send_action_done()
401 wpa_s->pending_action_tx = NULL; in offchannel_send_action_done()
402 if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX && in offchannel_send_action_done()
403 (wpa_s->action_tx_wait_time || wpa_s->action_tx_wait_time_used)) in offchannel_send_action_done()
405 else if (wpa_s->off_channel_freq || wpa_s->roc_waiting_drv_freq) { in offchannel_send_action_done()
407 wpa_s->off_channel_freq = 0; in offchannel_send_action_done()
408 wpa_s->roc_waiting_drv_freq = 0; in offchannel_send_action_done()
410 wpa_s->action_tx_wait_time_used = 0; in offchannel_send_action_done()
415 * offchannel_remain_on_channel_cb - Remain-on-channel callback function
417 * @freq: Frequency (in MHz) of the selected channel
418 * @duration: Duration of the remain-on-channel operation in milliseconds
421 * remain-on-channel operation.
426 wpa_s->roc_waiting_drv_freq = 0; in offchannel_remain_on_channel_cb()
427 wpa_s->off_channel_freq = freq; in offchannel_remain_on_channel_cb()
433 * offchannel_cancel_remain_on_channel_cb - Remain-on-channel stopped callback
435 * @freq: Frequency (in MHz) of the selected channel
438 * remain-on-channel operation.
443 wpa_s->off_channel_freq = 0; in offchannel_cancel_remain_on_channel_cb()
448 * offchannel_pending_action_tx - Check whether there is a pending Action TX
459 return wpa_s->pending_action_tx; in offchannel_pending_action_tx()
464 * offchannel_clear_pending_action_tx - Clear pending Action frame TX
470 "Off-channel: Clear pending Action frame TX (pending_action_tx=%p", in offchannel_clear_pending_action_tx()
471 wpa_s->pending_action_tx); in offchannel_clear_pending_action_tx()
472 wpabuf_free(wpa_s->pending_action_tx); in offchannel_clear_pending_action_tx()
473 wpa_s->pending_action_tx = NULL; in offchannel_clear_pending_action_tx()
478 * offchannel_deinit - Deinit off-channel operations
481 * This function is used to free up any allocated resources for off-channel