From nobody Tue May 21 03:27:36 2024
X-Original-To: dev-commits-src-all@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 4Vk0HX4pjKz5L2BR;
	Tue, 21 May 2024 03:27:36 +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 4Vk0HX3x9Dz430Z;
	Tue, 21 May 2024 03:27:36 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1716262056;
	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=RmQDWnFE8u8xCqCvzM3U3a32T56mQHzF/Xa1HwnavUc=;
	b=Z6MIlFj0blr1SHS6MxAv5IjKE8306SkDE1wrU6MO61JfDTJY41elnRz/fiDnuO+1sP0BoJ
	WbBOw/6fWc4W2vXHa+6tr+7aPHe28QFWqrb2aMm54uTmHoljUb7aBWPeSboJiJewUpENtw
	kKlmUMOBEo22fHBaO8pZjBjVNHv3XDONS48Y/1Ju8lwqWFaLD6eKKmVPzQTC69He5UPE6I
	bCqrv68zcsjcGjWxTJwVxuCyfwZRLoQMhM/NWLQa0XTdLkTilJ7wYnoX5629Kj9aX8uMac
	c/y08toQJFhxbiTCxAlwwu37bBoa9R7De4QZ6v+vyryE+BaoyGH8OiDP4UYOEg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716262056; a=rsa-sha256; cv=none;
	b=EONCID2pfAGJIok7f4XZvmM7ycmbDHnqDACb8Mwl4xx4TnySOaLHAUWe1d4VCP85VmepaB
	SLj4dZFqM8YK5w78M38vOk8C/LTUJfcULYKPb+2RDu6jPfNKcI5rRW+z0Xxbn0m0dMprqv
	NOHiTh4Gpo8j5gCD7wpwFYguEymMG0f89Ch8q10ZlMO9AjA+QpWak2m3eaW3IibVLnon4J
	tLhur6iTwxTe24bOY0/m0EF/oRTReKJeTedCHr13TxpN0lFxCgRLA21KdfHhfjUVjYmjlP
	e7GmyXwWzJAEfp8D6TB8uZobVaZ97CH4pnwD0no2zO5VopxuUL9T8Dmd2mrNFQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1716262056;
	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=RmQDWnFE8u8xCqCvzM3U3a32T56mQHzF/Xa1HwnavUc=;
	b=Pu9okyIToCGrZgcVpCRJEDmzLdI3WYb90xytAVqSytfFtmIA0zzuYPHbmyQFQfT4OEGNaW
	zeXsaKpzD4HV+xrdK+gglE4YJTqWLhjKJO4IMnjnpqR40OXbV9GBOpa96HOold1hpfTWm6
	91I0HzvDAl960/2FbzjPz1/R2YEJsbeEjRnDHXY1JmrbhgAamfcytoZhHRSGn/LMvpOQ0h
	MYFBnyYBre5iuLqNDPtCcAPnkR8Uulk4QNESdB36ml/ghZbfJU/iT3CFzmdfibeAiu/sLr
	T9NxI5cTlbjr9ghZXu3WQI78J0uXjXytjBuVynOITSqVg1mDjt9x4MqOXmmneQ==
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 4Vk0HX37Zlz15Bq;
	Tue, 21 May 2024 03:27:36 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44L3Raru052657;
	Tue, 21 May 2024 03:27:36 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44L3Ra7r052654;
	Tue, 21 May 2024 03:27:36 GMT
	(envelope-from git)
Date: Tue, 21 May 2024 03:27:36 GMT
Message-Id: <202405210327.44L3Ra7r052654@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-branches@FreeBSD.org
From: Warner Losh <imp@FreeBSD.org>
Subject: git: f30c2d86c39f - stable/14 - sys/netinet6/in6_pcb.c:
  fix compile without INET
List-Id: Commit messages for all branches of the src repository <dev-commits-src-all.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all
List-Help: <mailto:dev-commits-src-all+help@freebsd.org>
List-Post: <mailto:dev-commits-src-all@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-all+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-all+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-all@freebsd.org
Sender: owner-dev-commits-src-all@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: imp
X-Git-Repository: src
X-Git-Refname: refs/heads/stable/14
X-Git-Reftype: branch
X-Git-Commit: f30c2d86c39f8c3090e1f8967c13f2dd0d5d664b
Auto-Submitted: auto-generated

The branch stable/14 has been updated by imp:

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

commit f30c2d86c39f8c3090e1f8967c13f2dd0d5d664b
Author:     Lexi Winter <lexi@le-Fay.ORG>
AuthorDate: 2024-04-12 16:54:24 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-05-21 03:12:04 +0000

    sys/netinet6/in6_pcb.c: fix compile without INET
    
    in6_mapped_sockaddr() and in6_mapped_peeraddr() both define a local
    variable named 'inp', but in the non-INET case, this variable is set
    and never used, causing a compiler error:
    
    /src/freebsd/src/lf/sys/netinet6/in6_pcb.c:547:16: error:
            variable 'inp' set but not used [-Werror,-Wunused-but-set-variable]
      547 |         struct  inpcb *inp;
          |                        ^
    /src/freebsd/src/lf/sys/netinet6/in6_pcb.c:573:16: error:
            variable 'inp' set but not used [-Werror,-Wunused-but-set-variable]
      573 |         struct  inpcb *inp;
    
    Fix this by guarding all the INET-specific logic, including the variable
    definition, behind #ifdef INET.
    
    While here, tweak formatting in in6_mapped_peeraddr() so both functions
    are the same.
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1155
    
    (cherry picked from commit 042fb58d009e7efc5b334b68fffbef9b1f620ec8)
---
 sys/netinet6/in6_pcb.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 5c4ef7570ddc..90f91eef1daa 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -579,13 +579,13 @@ in6_getpeeraddr(struct socket *so, struct sockaddr **nam)
 int
 in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam)
 {
-	struct	inpcb *inp;
 	int	error;
+#ifdef INET
+	struct	inpcb *inp;
 
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("in6_mapped_sockaddr: inp == NULL"));
 
-#ifdef INET
 	if ((inp->inp_vflag & (INP_IPV4 | INP_IPV6)) == INP_IPV4) {
 		error = in_getsockaddr(so, nam);
 		if (error == 0)
@@ -603,21 +603,23 @@ in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam)
 int
 in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam)
 {
-	struct	inpcb *inp;
 	int	error;
+#ifdef INET
+	struct	inpcb *inp;
 
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("in6_mapped_peeraddr: inp == NULL"));
 
-#ifdef INET
 	if ((inp->inp_vflag & (INP_IPV4 | INP_IPV6)) == INP_IPV4) {
 		error = in_getpeeraddr(so, nam);
 		if (error == 0)
 			in6_sin_2_v4mapsin6_in_sock(nam);
 	} else
 #endif
-	/* scope issues will be handled in in6_getpeeraddr(). */
-	error = in6_getpeeraddr(so, nam);
+	{
+		/* scope issues will be handled in in6_getpeeraddr(). */
+		error = in6_getpeeraddr(so, nam);
+	}
 
 	return error;
 }