git: aab6e5bd1e2b - main - sctp: improve path verification

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Sun, 15 May 2022 09:49:04 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=aab6e5bd1e2b2919604eed68f76d4a7bb73ccb0c

commit aab6e5bd1e2b2919604eed68f76d4a7bb73ccb0c
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2022-05-14 06:07:28 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-05-14 06:07:28 +0000

    sctp: improve path verification
    
    Ensure that a HB can be sent faster than a HB.Interval when performing
    path verification of a reachable peer address.
    
    Thanks to Alexander Funke for finding the issue and proposing a fix.
    
    MFC after:      3 days
---
 sys/netinet/sctp_timer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c
index 04c750b990f1..9eff569e0f53 100644
--- a/sys/netinet/sctp_timer.c
+++ b/sys/netinet/sctp_timer.c
@@ -1439,7 +1439,8 @@ sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
 	    (TAILQ_EMPTY(&stcb->asoc.sent_queue))) {
 		sctp_audit_stream_queues_for_size(inp, stcb);
 	}
-	if (((net->dest_state & SCTP_ADDR_NOHB) == 0) &&
+	if ((((net->dest_state & SCTP_ADDR_NOHB) == 0) ||
+	    (net->dest_state & SCTP_ADDR_UNCONFIRMED)) &&
 	    (net_was_pf || ((net->dest_state & SCTP_ADDR_PF) == 0))) {
 		/*
 		 * When moving to PF during threshold management, a HB has
@@ -1459,6 +1460,7 @@ sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
 			ms_gone_by = 0xffffffff;
 		}
 		if ((ms_gone_by >= net->heart_beat_delay) ||
+		    (net->dest_state & SCTP_ADDR_UNCONFIRMED) ||
 		    (net->dest_state & SCTP_ADDR_PF)) {
 			sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED);
 		}