Date: Mon, 5 May 2025 20:50:27 GMT From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 99c58ad021b2 - main - sctp: compute address flags only for IPv6 addresses Message-ID: <202505052050.545KoR9R089133@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=99c58ad021b2f7dc0496e16d313c5e28a552f0d0 commit 99c58ad021b2f7dc0496e16d313c5e28a552f0d0 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2025-05-05 20:43:50 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2025-05-05 20:43:50 +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") MFC after: 3 days --- 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 224f9c72d9ae..2092f20e3c22 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505052050.545KoR9R089133>