From nobody Sun Aug 10 05:55:36 2025 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 4c06SS74XRz63sd7; Sun, 10 Aug 2025 05:55: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4c06SS3xz4z3PZk; Sun, 10 Aug 2025 05:55:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754805336; 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=NxgeEsqKUvCAXB4CPPPWMFNvij9/PWAXmY0BAXS1sZQ=; b=PQcy8U/PUHnQQfOmLtwH6SHxoYa154hm4602BhX7Q97W0YZWEaRL1MYpCij5bJTUZ2UDCS PziHRbrEtefriMKAvR2bbV2NHX+mUd36qrxjwul+YDqYhYoUdpwwO0Qfde2v0EuuuNWLmZ KyULxcdMbZvZig0aN2uePDfW5qg6rf/861u4LeED2RitVIbYKnh0hJtj7S48nsJIwYgMCx 3kp1tO1HnvqvwlHtrQyKLIVLsXK6izClUBrz/ZgG5I4QrAqplDQsottJJKGbMNOMuVRDOk /64DhIgWMuCeM7KI/JeCtQnl7qbrQ/oyzr4wE0vedCX3jQDqNPzN6ar1Ubz7Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754805336; 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=NxgeEsqKUvCAXB4CPPPWMFNvij9/PWAXmY0BAXS1sZQ=; b=MSdcYtle42d3soRKl++bOSFOwcYIhhb3nBdvMUBIQfSlkVRSvjZ10ofvCMz6BWrX3vcYoV rll69bBC6yE0PzxtC2lP8CdP3xtlgjAO8WWP3Anvu95dApoRTFf569CMxZlQ24rEQiuaFg d/4SeUvxZBv06j8s1htg+yfoRPC1lLXtYGAbbA+mwJqo35uzny2+SskH3RVG/15INTDMN9 rvB7vFXV67+tE5XGfF9W3c5DK93O0+tfZAHgcp0I7JndnvRER6VtZaM+VlJ37ArrN4BbQX iRhoL1Cq7ByieTRdVDdkiiDEoopVZcvEV6QtMREo9BlSoM7SraSMCQv288vj8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754805336; a=rsa-sha256; cv=none; b=XLTB3TvjqOSyIu1zzi7q8jMCSiT+/5b8AKdjgG1xD/+nwIXOsenJEG9vpvduM4Nw+x3j4A rUsd5eqzivtMDrI2L1TZDNzG0PKWkT7bpZ+zVTtdWn9s8rolFuzwjbjC+PW7c6AcvLkhKR x5xblyDMEjLGyLCz8SVRayd6KiHdMRgfJjC91yOxQ4w23/ekdkt5reNQjZdowP6nmVEb5X S4LW+sekb6SjBRfVILT/rLLaX4spx6T2VI5aioTGhTYhrC3CIw/T/rZOjtv/oMgDRnCUVF hv8Bvk6dVKoxYfrZfDypV9LS0IbU9iB0Wo3Pq0wFr2qJsGBbHmFxCcf5qr0kEQ== 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 4c06SS3X08ztrx; Sun, 10 Aug 2025 05:55:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 57A5taFa077654; Sun, 10 Aug 2025 05:55:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57A5taVr077651; Sun, 10 Aug 2025 05:55:36 GMT (envelope-from git) Date: Sun, 10 Aug 2025 05:55:36 GMT Message-Id: <202508100555.57A5taVr077651@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 5a248f1b90d3 - stable/13 - ip_nat6.c: fix non-trivial unused variable warnings List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5a248f1b90d30442c635fd55c6584fb6d9d5a86e Auto-Submitted: auto-generated The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=5a248f1b90d30442c635fd55c6584fb6d9d5a86e commit 5a248f1b90d30442c635fd55c6584fb6d9d5a86e Author: Siva Mahadevan AuthorDate: 2025-04-24 12:08:47 +0000 Commit: Cy Schubert CommitDate: 2025-08-10 05:55:14 +0000 ip_nat6.c: fix non-trivial unused variable warnings Pull Request: https://github.com/freebsd/freebsd-src/pull/1677 MFC after: 1 month (cherry picked from commit 2bbaeb717b690f796e751be63a656fb097ef786d) --- sys/netpfil/ipfilter/netinet/ip_nat6.c | 52 +++++++++------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/sys/netpfil/ipfilter/netinet/ip_nat6.c b/sys/netpfil/ipfilter/netinet/ip_nat6.c index c8b61afa25bc..b284dfaf65f2 100644 --- a/sys/netpfil/ipfilter/netinet/ip_nat6.c +++ b/sys/netpfil/ipfilter/netinet/ip_nat6.c @@ -1133,9 +1133,6 @@ ipf_nat6_finalise(fr_info_t *fin, nat_t *nat) ipf_nat_softc_t *softn = softc->ipf_nat_soft; u_32_t sum1, sum2, sumd; frentry_t *fr; - u_32_t flags; - - flags = nat->nat_flags; switch (fin->fin_p) { @@ -1358,8 +1355,8 @@ ipf_nat6_icmperrorlookup(fr_info_t *fin, int dir) { ipf_main_softc_t *softc = fin->fin_main_soft; ipf_nat_softc_t *softn = softc->ipf_nat_soft; - struct icmp6_hdr *icmp6, *orgicmp; - int flags = 0, type, minlen; + struct icmp6_hdr *orgicmp; + int flags = 0, minlen; nat_stat_side_t *nside; tcphdr_t *tcp = NULL; u_short data[2]; @@ -1368,8 +1365,6 @@ ipf_nat6_icmperrorlookup(fr_info_t *fin, int dir) u_int p; minlen = 40; - icmp6 = fin->fin_dp; - type = icmp6->icmp6_type; nside = &softn->ipf_nat_stats.ns_side6[fin->fin_out]; /* * Does it at least have the return (basic) IP header ? @@ -1503,9 +1498,8 @@ ipf_nat6_ip6subtract(i6addr_t *ip1, i6addr_t *ip2) i6addr_t l1, l2, d; u_short *s1, *s2, *ds; u_32_t r; - int i, neg; + int i; - neg = 0; l1 = *ip1; l2 = *ip2; s1 = (u_short *)&l1; @@ -1522,7 +1516,6 @@ ipf_nat6_ip6subtract(i6addr_t *ip1, i6addr_t *ip2) } if (s2[0] > s1[0]) { ds[0] = s2[0] + 0x10000 - s1[0]; - neg = 1; } else { ds[0] = s2[0] - s1[0]; } @@ -1872,9 +1865,9 @@ ipf_nat6_inlookup(fr_info_t *fin, u_int flags, u_int p, ipf_main_softc_t *softc = fin->fin_main_soft; ipf_nat_softc_t *softn = softc->ipf_nat_soft; u_short sport, dport; - grehdr_t *gre; +#ifdef IPF_V6_PROXIES ipnat_t *ipn; - u_int sflags; +#endif nat_t *nat; int nflags; i6addr_t dst; @@ -1884,10 +1877,7 @@ ipf_nat6_inlookup(fr_info_t *fin, u_int flags, u_int p, ifp = fin->fin_ifp; sport = 0; dport = 0; - gre = NULL; dst.in6 = *mapdst; - sflags = flags & NAT_TCPUDPICMP; - switch (p) { case IPPROTO_TCP : @@ -1965,8 +1955,8 @@ ipf_nat6_inlookup(fr_info_t *fin, u_int flags, u_int p, if ((nat->nat_flags & IPN_TCPUDP) != 0) { - ipn = nat->nat_ptr; #ifdef IPF_V6_PROXIES + ipn = nat->nat_ptr; if ((ipn != NULL) && (nat->nat_aps != NULL)) if (appr_match(fin, nat) != 0) continue; @@ -2190,14 +2180,14 @@ ipf_nat6_outlookup(fr_info_t *fin, u_int flags, u_int p, ipf_main_softc_t *softc = fin->fin_main_soft; ipf_nat_softc_t *softn = softc->ipf_nat_soft; u_short sport, dport; - u_int sflags; +#ifdef IPF_V6_PROXIES ipnat_t *ipn; +#endif nat_t *nat; void *ifp; u_int hv; ifp = fin->fin_ifp; - sflags = flags & IPN_TCPUDPICMP; sport = 0; dport = 0; @@ -2278,8 +2268,8 @@ ipf_nat6_outlookup(fr_info_t *fin, u_int flags, u_int p, break; } - ipn = nat->nat_ptr; #ifdef IPF_V6_PROXIES + ipn = nat->nat_ptr; if ((ipn != NULL) && (nat->nat_aps != NULL)) if (appr_match(fin, nat) != 0) continue; @@ -2566,7 +2556,6 @@ ipf_nat6_checkout(fr_info_t *fin, u_32_t *passp) ipf_nat_softc_t *softn = softc->ipf_nat_soft; struct icmp6_hdr *icmp6 = NULL; struct ifnet *ifp, *sifp; - tcphdr_t *tcp = NULL; int rval, natfailed; ipnat_t *np = NULL; u_int nflags = 0; @@ -2619,9 +2608,6 @@ ipf_nat6_checkout(fr_info_t *fin, u_32_t *passp) default : break; } - - if ((nflags & IPN_TCPUDP)) - tcp = fin->fin_dp; } ipa = fin->fin_src6; @@ -2963,7 +2949,9 @@ ipf_nat6_checkin(fr_info_t *fin, u_32_t *passp) int rval, natfailed; struct ifnet *ifp; i6addr_t ipa, iph; - tcphdr_t *tcp; +#ifdef IPF_V6_PROXIES + tcphdr_t *tcp = NULL; +#endif u_short dport; ipnat_t *np; nat_t *nat; @@ -2971,7 +2959,6 @@ ipf_nat6_checkin(fr_info_t *fin, u_32_t *passp) if (softn->ipf_nat_stats.ns_rules == 0 || softn->ipf_nat_lock != 0) return (0); - tcp = NULL; icmp6 = NULL; dport = 0; natadd = 1; @@ -3012,7 +2999,9 @@ ipf_nat6_checkin(fr_info_t *fin, u_32_t *passp) } if ((nflags & IPN_TCPUDP)) { +#ifdef IPF_V6_PROXIES tcp = fin->fin_dp; +#endif dport = fin->fin_data[1]; } } @@ -3800,32 +3789,19 @@ ipf_nat6_nextaddr(fr_info_t *fin, nat_addr_t *na, i6addr_t *old, i6addr_t *dst) ipf_main_softc_t *softc = fin->fin_main_soft; ipf_nat_softc_t *softn = softc->ipf_nat_soft; i6addr_t newip, new; - u_32_t amin, amax; int error; new.i6[0] = 0; new.i6[1] = 0; new.i6[2] = 0; new.i6[3] = 0; - amin = na->na_addr[0].in4.s_addr; switch (na->na_atype) { case FRI_RANGE : - amax = na->na_addr[1].in4.s_addr; - break; - case FRI_NETMASKED : case FRI_DYNAMIC : case FRI_NORMAL : - /* - * Compute the maximum address by adding the inverse of the - * netmask to the minimum address. - */ - amax = ~na->na_addr[1].in4.s_addr; - amax |= amin; - break; - case FRI_LOOKUP : break;