From nobody Wed Feb 1 22:39:30 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P6cKv1hK9z3cDWv; Wed, 1 Feb 2023 22:39:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P6cKv11gDz4KHS; Wed, 1 Feb 2023 22:39:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675291171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NUH9rgeLatwyVia5IvSWL2vnwSJemxXI/Ci1NGI0nkU=; b=W9Pt3AVrA+P6EKkbo3O+9t6zxdHxzeSCNqM74/mnVe7G72vjWGNWje/9xeXxip/DByoUKs 4eti8ODI40CSQHQZWmnOVH34L0EEJ7v3m8Qiral5dkJIIWwMQ1t2oI28aZvzrwhFVLyWUl DmqUypYl/yVWGiUddPTjXfjL4MJxqSVr2WwDVJEKjlrv4EvbP2xhQw6LZjwK70At3av7gZ dN+s3XjboDR62vK8dTgmBydxd7gNdVp71NIfM8bZlggqFsuVXxohw1Txzvq0lohLZ6Jb9t hrUVKXP6wyQcJir4cy4T6tgc2eozR1U5uzbxhZC/1Ud8S19Q/l7bSs/3Vo7wnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675291171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NUH9rgeLatwyVia5IvSWL2vnwSJemxXI/Ci1NGI0nkU=; b=pDzScJDzRDQwvM68nXMD/WmdZxeH1epmM8Kk3PQSk+uzcaCvjyfiREVFCBHjWYYOLHS1qY 5FcWPbCl92kWTsnRaOsMHjYdUMYQGW5jZpb5RMMLdnZ7oOO5r2YAThFGl2hSrOuhoUmkc9 v8zeghTvXAEpB+Oq4wxSLPv4NvaQuyZUHTZzukWWxTW8zbNG74jahxjKoS2bdEW5GswUux 81BV+5ALcTZCmVfPodFwecF2ZU+845M5y1m4lyh9a1cWz+dDLgXIr8ikMAAyUHeZhy3HmU weDQfUuWM48WfH2kQ9drzXCTd+WC1xmFQZIkXCJ3+NFhlsWVigHa2a4n4820zg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675291171; a=rsa-sha256; cv=none; b=q1DM8qOeg0srF2K3BiKfsxYBaZI4ad1nWxA0Bc923veuHNmf15JQKOJv0uqBJQZ94QJDRn 0VFeUdiHptM0t9VHf161rkgNYZY5Mk0VDrbXSjWvTeAW7q2vu5J+U4ROcpqEQ+XwT7DqrU cJB2NJ+3MDnVkMgjaOGpWsN8FzoUqmlcxvPY2Bq63M0uadOdkVm8VUoVSvYq3nRUe6+pJ/ iOoeecP+VkVVrx1hdIr03sAjBiEqi1i14igen70/Lo39iEyXYnnCX9aSg65c1DH6bveQmG 75STpCap43+XCAUYqoOTnu0ZUwG5CtpSHI3+5h1pmRVPClQVy4DZlg4G45cRmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P6cKt6pKyzWwx; Wed, 1 Feb 2023 22:39:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 311MdUZr087966; Wed, 1 Feb 2023 22:39:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 311MdUvn087965; Wed, 1 Feb 2023 22:39:30 GMT (envelope-from git) Date: Wed, 1 Feb 2023 22:39:30 GMT Message-Id: <202302012239.311MdUvn087965@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 6e756956ced5 - stable/13 - sctp: #ifdef INET-only and INET6-only variables. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6e756956ced50d30ec5ca433373de4d7a7c58d3c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6e756956ced50d30ec5ca433373de4d7a7c58d3c commit 6e756956ced50d30ec5ca433373de4d7a7c58d3c Author: John Baldwin AuthorDate: 2022-04-13 23:08:21 +0000 Commit: Michael Tuexen CommitDate: 2023-02-01 22:38:50 +0000 sctp: #ifdef INET-only and INET6-only variables. Duplicating the SCTP_PCB_FLAGS_BOUND_V6 check made the #ifdef's simpler than applying #ifdef's directly to the original code. Modern compilers should cache the result rather than testing the flag twice. (cherry picked from commit 29a843177e108c688d7daaccac6ada4d16f01dca) --- sys/netinet/sctp_sysctl.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/sys/netinet/sctp_sysctl.c b/sys/netinet/sctp_sysctl.c index 1314b700b467..0d435a36d940 100644 --- a/sys/netinet/sctp_sysctl.c +++ b/sys/netinet/sctp_sysctl.c @@ -188,8 +188,15 @@ sctp_sysctl_copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *st { struct sctp_ifn *sctp_ifn; struct sctp_ifa *sctp_ifa; - int loopback_scope, ipv4_local_scope, local_scope, site_scope; - int ipv4_addr_legal, ipv6_addr_legal; + int loopback_scope; +#ifdef INET + int ipv4_local_scope; + int ipv4_addr_legal; +#endif +#ifdef INET6 + int local_scope, site_scope; + int ipv6_addr_legal; +#endif struct sctp_vrf *vrf; struct xsctp_laddr xladdr; struct sctp_laddr *laddr; @@ -199,28 +206,34 @@ sctp_sysctl_copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *st if (stcb) { /* use association specific values */ loopback_scope = stcb->asoc.scope.loopback_scope; +#ifdef INET ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; + ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; +#endif +#ifdef INET6 local_scope = stcb->asoc.scope.local_scope; site_scope = stcb->asoc.scope.site_scope; - ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; +#endif } else { /* Use generic values for endpoints. */ loopback_scope = 1; +#ifdef INET ipv4_local_scope = 1; + if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6 && + SCTP_IPV6_V6ONLY(inp)) + ipv4_addr_legal = 0; + else + ipv4_addr_legal = 1; +#endif +#ifdef INET6 local_scope = 1; site_scope = 1; - if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { + if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) ipv6_addr_legal = 1; - if (SCTP_IPV6_V6ONLY(inp)) { - ipv4_addr_legal = 0; - } else { - ipv4_addr_legal = 1; - } - } else { + else ipv6_addr_legal = 0; - ipv4_addr_legal = 1; - } +#endif } /* neither Mac OS X nor FreeBSD support multiple routing functions */