]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
NAN: Wait on the channel with publisher is in pauseState
authorJouni Malinen <quic_jouni@quicinc.com>
Mon, 4 Nov 2024 20:45:26 +0000 (22:45 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 4 Nov 2024 21:19:30 +0000 (23:19 +0200)
Remain waiting for additional Follow-up messages on a publisher that is
in pauseState for a service that requires further service discovery.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/common/nan_de.c

index 8855912a2c1e18578064834262a65558f2f3f785..2783d9e1116264e96ae0278841f21f822b9d2d48 100644 (file)
@@ -483,6 +483,16 @@ static int nan_de_srv_time_to_next(struct nan_de *de,
                        next = tmp;
        }
 
+       if (srv->type == NAN_DE_PUBLISH &&
+           srv->publish.fsd &&
+           os_reltime_initialized(&srv->pause_state_end)) {
+               os_reltime_sub(&srv->pause_state_end, now, &diff);
+               tmp = os_reltime_in_ms(&diff);
+               if (next == -1 || tmp < next)
+                       next = tmp;
+               return next;
+       }
+
        tmp = nan_de_next_multicast(de, srv, now);
        if (tmp >= 0 && (next == -1 || tmp < next))
                next = tmp;
@@ -592,6 +602,30 @@ static void nan_de_timer(void *eloop_ctx, void *timeout_ctx)
                if (srv_next >= 0 && (next == -1 || srv_next < next))
                        next = srv_next;
 
+               if (srv->type == NAN_DE_PUBLISH &&
+                   srv->publish.fsd &&
+                   os_reltime_initialized(&srv->pause_state_end) &&
+                   de->tx_wait_end_freq == 0 &&
+                   de->listen_freq == 0 && de->ext_listen_freq == 0) {
+                       struct os_reltime diff;
+                       int duration;
+
+                       os_reltime_sub(&srv->pause_state_end, &now, &diff);
+                       duration = os_reltime_in_ms(&diff);
+                       if (duration < 0)
+                               continue;
+                       if ((unsigned int) duration > de->max_listen)
+                               duration = de->max_listen;
+                       if (de->cb.listen(de->cb.ctx, srv->freq, duration) ==
+                           0) {
+                               wpa_printf(MSG_DEBUG,
+                                          "NAN: Publisher in pauseState - started listen on %u MHz",
+                                          srv->freq);
+                               de->listen_freq = srv->freq;
+                               return;
+                       }
+               }
+
                if (srv_next == 0 && !started && !de->offload &&
                    de->listen_freq == 0 && de->ext_listen_freq == 0 &&
                    de->tx_wait_end_freq == 0 &&