git: 2b457fb62ca1 - stable/14 - sctp: don't report unusable addresses via sysctl interface

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Wed, 21 May 2025 17:09:40 UTC
The branch stable/14 has been updated by tuexen:

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

commit 2b457fb62ca15f3ae46043c21a54a6d27da7d8e7
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-05-04 22:28:52 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-05-21 17:09:22 +0000

    sctp: don't report unusable addresses via sysctl interface
    
    When reporting the local addresses of an endpoint (inp without
    stcb), ignore unusable addresses.
    
    (cherry picked from commit 8f5f6680efa28135bf37f3def2aa71f35bd30333)
---
 sys/netinet/sctp_sysctl.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/netinet/sctp_sysctl.c b/sys/netinet/sctp_sysctl.c
index a39429ec046e..bd2f23f40727 100644
--- a/sys/netinet/sctp_sysctl.c
+++ b/sys/netinet/sctp_sysctl.c
@@ -265,6 +265,10 @@ sctp_sysctl_copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *st
 					if (sctp_is_addr_restricted(stcb, sctp_ifa)) {
 						continue;
 					}
+				} else {
+					if (sctp_ifa->localifa_flags & SCTP_ADDR_IFA_UNUSEABLE) {
+						continue;
+					}
 				}
 				switch (sctp_ifa->address.sa.sa_family) {
 #ifdef INET