]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
NAN: Limit pauseState to be within service lifetime
authorJouni Malinen <quic_jouni@quicinc.com>
Mon, 4 Nov 2024 20:44:27 +0000 (22:44 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 4 Nov 2024 21:19:30 +0000 (23:19 +0200)
If a publish service is configured with an explicit lifetime (ttl), do
not allow pauseState duration to exceed that.

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

index 844fc443472c8e258d3d5dcdcbffe9c783e8b5c9..8855912a2c1e18578064834262a65558f2f3f785 100644 (file)
@@ -160,6 +160,9 @@ static void nan_de_pause_state(struct nan_de_service *srv, const u8 *peer_addr,
        wpa_printf(MSG_DEBUG, "NAN: Start pauseState");
        os_get_reltime(&srv->pause_state_end);
        srv->pause_state_end.sec += 60;
+       if (os_reltime_initialized(&srv->end_time) &&
+           os_reltime_before(&srv->end_time, &srv->pause_state_end))
+               srv->pause_state_end = srv->end_time;
        os_memcpy(srv->sel_peer_addr, peer_addr, ETH_ALEN);
        srv->sel_peer_id = peer_id;
 }