The branch main has been updated by tuexen:

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

commit ce64352a702db1fef8c0e33f3a6f13a3e5d92736
Author:     Michael Tuexen <tue...@freebsd.org>
AuthorDate: 2021-07-09 12:15:22 +0000
Commit:     Michael Tuexen <tue...@freebsd.org>
CommitDate: 2021-07-09 12:16:59 +0000

    sctp: provide consistent stream information in case of early errors
    
    While there, make sure the function is called correctly.
    
    MFC after:      3 days
---
 sys/netinet/sctputil.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index 1f909fa1d8d4..21e49bdfcb23 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -3163,6 +3163,8 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb 
*stcb,
        uint16_t abort_len;
        unsigned int i;
 
+       KASSERT((abort == NULL) || (from_peer != 0),
+           ("sctp_notify_assoc_change: ABORT chunk provided for local 
termination"));
        if (stcb == NULL) {
                return;
        }
@@ -3202,9 +3204,13 @@ sctp_notify_assoc_change(uint16_t state, struct sctp_tcb 
*stcb,
                sac->sac_length = sizeof(struct sctp_assoc_change);
                sac->sac_state = state;
                sac->sac_error = error;
-               /* XXX verify these stream counts */
-               sac->sac_outbound_streams = stcb->asoc.streamoutcnt;
-               sac->sac_inbound_streams = stcb->asoc.streamincnt;
+               if (state == SCTP_CANT_STR_ASSOC) {
+                       sac->sac_outbound_streams = 0;
+                       sac->sac_inbound_streams = 0;
+               } else {
+                       sac->sac_outbound_streams = stcb->asoc.streamoutcnt;
+                       sac->sac_inbound_streams = stcb->asoc.streamincnt;
+               }
                sac->sac_assoc_id = sctp_get_associd(stcb);
                if (notif_len > sizeof(struct sctp_assoc_change)) {
                        if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) 
{
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to