From nobody Sun Aug 10 05:24:51 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 4c05n05VxFz63ngQ; Sun, 10 Aug 2025 05:24:52 +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 4c05mz6yMRz3Jpw; Sun, 10 Aug 2025 05:24:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754803492; 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=Po1R+Zm/N/Q+STokt0oxZz3vgCnn5qeNLKRobkfDJe0=; b=qljbBHS4BjgIviiKBbOUo0qs4Bi4gFcEjywivx+2qtZX5/iHfOYcxNTu9Pna9Dqt1fSLYC Wn0YIsIsEjn1tMjpTPc8XIQoZpYzNMkXbRJ2MwytrynCsFuNNHI1nk6evCUrP+gH2NveOv hMeQNXLokJKarvBeCUpJSCGQ6odY3DAbHB6qvLvu4Vu9vyxy1fiOpTm9Tphnp8Tck+d4IG YCcn8OrggNdASS38l8tkFvIaRIihJYj366kJdS5zIrJvkq9ohBDbFDZbi1iN3mLLhVRu7D td2v2KNNxlFv23e9EKWEH7b/SI1Ycr5V2rTnSIlXackIEltJQGnKNBeTcbRgIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754803492; 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=Po1R+Zm/N/Q+STokt0oxZz3vgCnn5qeNLKRobkfDJe0=; b=DmJKeXq12dDhKByAX1vpPfSSpIYzistFRz6OFUte1KuNswyK/cvt+2qBsa29gpHJHDrUr0 GiHrRF0aDh5Fw4kvK1WBxstEcSS4LNwBGugIcNGQvkM+KH44mAwE95vp7t4Ey6F9euPte5 FeqIe5i++5mkzmIeZD1pfpcnaxoYyQ81ryDIE7FHXXl6D97KqCVPq9BgPCKeyJgSq0RXwP kDp0nqV8LXyaB+nR5f9jKOPB8xjVNGDDHTGz6ZeDyWBKJK0J0XdP1PFA5eJcr8gqLhH47M iECdLAS01/4LeOMYed3QhL45EnYLKfPeEIpeZ6uuxDHwulT/Tz70NS2f0RuqnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754803492; a=rsa-sha256; cv=none; b=pMEpnR6l+DoxViRkTg6NMlWz+sq9cgqg9r2GpDdsEHphet/A4n6eMK/CF6AZTGeSGYbIX2 r2Um7GOTat1b2G9n6VhuuD7N6MdBUfswLy+XowS2wpCr5ORZOXvcwZ4z095M+WE5lRVxDb K6lq6wVJ4aQc73oqUd0odC5bxBlE/UTY7C9jtZKOuEsx7CIcsOJdrautOI6LxFID4GuJ3T BTS7iSvcZpSvlSDX54LYv1GZYnbnbkZ5jRK6Wkq/iN47WDh+eK+viDTP2RUl8Sv6NhKubn lX6DVcD+HDCHB2tUOmvahj9vFm/bPuPUi2p2L300i4+rGXz1fQDntkTgfHRsXg== 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 4c05mz6TVrzt0c; Sun, 10 Aug 2025 05:24:51 +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 57A5Opx1020731; Sun, 10 Aug 2025 05:24:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57A5Op5L020728; Sun, 10 Aug 2025 05:24:51 GMT (envelope-from git) Date: Sun, 10 Aug 2025 05:24:51 GMT Message-Id: <202508100524.57A5Op5L020728@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: 18a405b1ac7f - stable/14 - ip_nat.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/14 X-Git-Reftype: branch X-Git-Commit: 18a405b1ac7fd681377bc9db27bb199b0b2a9133 Auto-Submitted: auto-generated The branch stable/14 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=18a405b1ac7fd681377bc9db27bb199b0b2a9133 commit 18a405b1ac7fd681377bc9db27bb199b0b2a9133 Author: Siva Mahadevan AuthorDate: 2025-04-24 12:08:47 +0000 Commit: Cy Schubert CommitDate: 2025-08-10 05:23:59 +0000 ip_nat.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 2bae5cad793bd67c071ade7c7a8ae9d4b34e6b6c) --- sys/netpfil/ipfilter/netinet/ip_nat.c | 43 +++++++++++------------------------ 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/sys/netpfil/ipfilter/netinet/ip_nat.c b/sys/netpfil/ipfilter/netinet/ip_nat.c index 136bc31ba0f4..290af20e4765 100644 --- a/sys/netpfil/ipfilter/netinet/ip_nat.c +++ b/sys/netpfil/ipfilter/netinet/ip_nat.c @@ -3228,13 +3228,10 @@ ipf_nat_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; #if SOLARIS && defined(_KERNEL) && defined(ICK_M_CTL_MAGIC) qpktinfo_t *qpi = fin->fin_qpi; #endif - flags = nat->nat_flags; - switch (nat->nat_pr[0]) { case IPPROTO_ICMP : @@ -3542,8 +3539,8 @@ ipf_nat_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; - int flags = 0, type, minlen; - icmphdr_t *icmp, *orgicmp; + int flags = 0, minlen; + icmphdr_t *orgicmp; nat_stat_side_t *nside; tcphdr_t *tcp = NULL; u_short data[2]; @@ -3551,8 +3548,6 @@ ipf_nat_icmperrorlookup(fr_info_t *fin, int dir) ip_t *oip; u_int p; - icmp = fin->fin_dp; - type = icmp->icmp_type; nside = &softn->ipf_nat_stats.ns_side[fin->fin_out]; /* * Does it at least have the return (basic) IP header ? @@ -4003,9 +3998,7 @@ ipf_nat_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; ipnat_t *ipn; - u_int sflags; nat_t *nat; int nflags; u_32_t dst; @@ -4013,9 +4006,7 @@ ipf_nat_inlookup(fr_info_t *fin, u_int flags, u_int p, u_int hv, rhv; ifp = fin->fin_ifp; - gre = NULL; dst = mapdst.s_addr; - sflags = flags & NAT_TCPUDPICMP; switch (p) { @@ -4334,14 +4325,12 @@ ipf_nat_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; ipnat_t *ipn; nat_t *nat; void *ifp; u_int hv; ifp = fin->fin_ifp; - sflags = flags & IPN_TCPUDPICMP; switch (p) { @@ -4760,7 +4749,6 @@ ipf_nat_checkout(fr_info_t *fin, u_32_t *passp) struct ifnet *ifp, *sifp; ipf_main_softc_t *softc; ipf_nat_softc_t *softn; - icmphdr_t *icmp = NULL; tcphdr_t *tcp = NULL; int rval, natfailed; u_int nflags = 0; @@ -4806,8 +4794,6 @@ ipf_nat_checkout(fr_info_t *fin, u_32_t *passp) nflags = IPN_UDP; break; case IPPROTO_ICMP : - icmp = fin->fin_dp; - /* * This is an incoming packet, so the destination is * the icmp_id and the source port equals 0 @@ -5467,7 +5453,10 @@ ipf_nat_in(fr_info_t *fin, nat_t *nat, int natadd, u_32_t nflags) { ipf_main_softc_t *softc = fin->fin_main_soft; ipf_nat_softc_t *softn = softc->ipf_nat_soft; - u_32_t sumd, ipsumd, sum1, sum2; + u_32_t sumd, sum1, sum2; +#if !defined(_KERNEL) || SOLARIS + u_32_t ipsumd; +#endif icmphdr_t *icmp; tcphdr_t *tcp; ipnat_t *np; @@ -5503,7 +5492,9 @@ ipf_nat_in(fr_info_t *fin, nat_t *nat, int natadd, u_32_t nflags) ipf_sync_update(softc, SMC_NAT, fin, nat->nat_sync); +#if !defined(_KERNEL) || SOLARIS ipsumd = nat->nat_ipsumd; +#endif /* * Fix up checksums, not by recalculating them, but * simply computing adjustments. @@ -5525,7 +5516,9 @@ ipf_nat_in(fr_info_t *fin, nat_t *nat, int natadd, u_32_t nflags) sum1 = nat->nat_osrcaddr; sum2 = nat->nat_nsrcaddr; CALC_SUMD(sum1, sum2, sumd); +#if !defined(_KERNEL) || SOLARIS ipsumd -= sumd; +#endif } fin->fin_ip->ip_dst = nat->nat_ndstip; fin->fin_daddr = nat->nat_ndstaddr; @@ -5542,7 +5535,9 @@ ipf_nat_in(fr_info_t *fin, nat_t *nat, int natadd, u_32_t nflags) sum1 = nat->nat_odstaddr; sum2 = nat->nat_ndstaddr; CALC_SUMD(sum1, sum2, sumd); +#if !defined(_KERNEL) || SOLARIS ipsumd -= sumd; +#endif } fin->fin_ip->ip_dst = nat->nat_osrcip; fin->fin_daddr = nat->nat_osrcaddr; @@ -7356,30 +7351,18 @@ ipf_nat_nextaddr(fr_info_t *fin, nat_addr_t *na, u_32_t *old, u_32_t *dst) { ipf_main_softc_t *softc = fin->fin_main_soft; ipf_nat_softc_t *softn = softc->ipf_nat_soft; - u_32_t amin, amax, new; + u_32_t new; i6addr_t newip; int error; new = 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;