git: 5d4ef780ea9f - stable/14 - sctp: compute address flags only for IPv6 addresses
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 May 2025 17:12:02 UTC
The branch stable/14 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=5d4ef780ea9f81b6b5bdd23b9f442eae8c481edb
commit 5d4ef780ea9f81b6b5bdd23b9f442eae8c481edb
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-05-05 20:43:50 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-05-21 17:11:43 +0000
sctp: compute address flags only for IPv6 addresses
Only call sctp_gather_internal_ifa_flags() for IPv6 addresses and
also compile this code only, when IPv6 is supported.
This fixes the compilation of IPv4 only kernels.
Reported by: bz@
Fixes: 6ab4b0c0df57 ("sctp: initilize local address flags correctly")
(cherry picked from commit 99c58ad021b2f7dc0496e16d313c5e28a552f0d0)
---
sys/netinet/sctp_pcb.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index 44807733b9e9..b5190bdf34d8 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -453,7 +453,11 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
SCTPDBG(SCTP_DEBUG_PCB4,
"Clearing deleted ifa flag\n");
sctp_ifap->localifa_flags = SCTP_ADDR_VALID;
- sctp_gather_internal_ifa_flags(sctp_ifap);
+#ifdef INET6
+ if (sctp_ifap->address.sa.sa_family == AF_INET6) {
+ sctp_gather_internal_ifa_flags(sctp_ifap);
+ }
+#endif
sctp_ifap->ifn_p = sctp_ifnp;
atomic_add_int(&sctp_ifap->ifn_p->refcount, 1);
}
@@ -476,7 +480,11 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
} else {
/* Repair ifn_p, which was NULL... */
sctp_ifap->localifa_flags = SCTP_ADDR_VALID;
- sctp_gather_internal_ifa_flags(sctp_ifap);
+#ifdef INET6
+ if (sctp_ifap->address.sa.sa_family == AF_INET6) {
+ sctp_gather_internal_ifa_flags(sctp_ifap);
+ }
+#endif
SCTPDBG(SCTP_DEBUG_PCB4,
"Repairing ifn %p for ifa %p\n",
(void *)sctp_ifnp, (void *)sctp_ifap);
@@ -501,7 +509,12 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
sctp_ifap->ifa = ifa;
memcpy(&sctp_ifap->address, addr, addr->sa_len);
sctp_ifap->localifa_flags = SCTP_ADDR_VALID | SCTP_ADDR_DEFER_USE;
- sctp_gather_internal_ifa_flags(sctp_ifap);
+ sctp_ifap->flags = ifa_flags;
+#ifdef INET6
+ if (addr->sa_family == AF_INET6) {
+ sctp_gather_internal_ifa_flags(sctp_ifap);
+ }
+#endif
/* Set scope */
switch (sctp_ifap->address.sa.sa_family) {
#ifdef INET