From nobody Thu Feb 9 21:21:06 2023 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 4PCVCk70YHz3nlLg; Thu, 9 Feb 2023 21:21:06 +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 4PCVCk6V2gz485f; Thu, 9 Feb 2023 21:21:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675977666; 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=1wYcOVjVA/3FHUH0DDf0xgOewvdFWkxmwco6sTYMHB4=; b=IEmPmZMv1glh9xpdEgBesee7WqLXZh5dSjxpZ6T+VNoAL1PMbA0Gao0EJrJ/K71oc7PsYU HngsYO+zD1psnUJNl+gXYw9O2LS77zBQGIkKJqLhqNjt6fYKHIONQVLyaob8GoFi7LhmJ8 J9CexsxIbIY68Zk8Z9e0P+tWQQDDGv1qt3VQHWVgQuCmhUoJ3mILWSMD9C4V3vchAZF80W Kdt9wIeRfdE3f/RRs1w8RoptMFoInwSsWLl/C6F1rkz/fYtBTiIoa9wEJ8ohWqHB84e2J4 PEytHVSD2znd7jSfynaCojzDEzKaxmesb4UY5eWqWUf9DsgnoMeiNRy4AG/E0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675977666; 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=1wYcOVjVA/3FHUH0DDf0xgOewvdFWkxmwco6sTYMHB4=; b=tLXXvVhXaQqYMelG3VZKPAgfikXVZcJO4ePU99IqbPZJDdaCnZ6I5mv0zMnsq/XJBhwRwN BQaUr96cSl/CdDGohPGvPECyHPW+8E020f/w2OJtGP6GmyS7i6m75zI5nQafnoC9T1wXgB fkvu4SbMv9Fn8r66uV0NLyc1M8PlEOevXO2e/o8/dnpLh6WFdA3BTzpauWSQajcMOX0cLv /wJu4sRmiKfX8dmemLvilanQJSzyDvJ647HBL8hudgA2ns9eVzNPOW3DqKIQJ8YkXc0CPD AvlV0Zg+MRiggIKr/cgWxd/+OrgoDllnpp2ekZvcslSG9UWmD2HIDVwI+7OcTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675977666; a=rsa-sha256; cv=none; b=e2Ua0LuMo4cf1yo+x+D1Pd4YhMBB7wkHBWSCo6Hhi8LRJ3mPsDXL7H0SzENIcKQ+Re0FmW 50FdSJd6STzPearne/JOO0v3NxqSZeN3KmteTzI2+7gJhYscnjIp28DrVtj8NBZLAXbqw+ zPe9k51aVWmd/ZgThucnfW4/5amp3Mu5GJSxjiTb4sX/EY+kNSbURFwQxxHnAOlx85bI+M u6NmOcFkxMU0rhAr9Yjk4laaU5oyth+LITfOovwSevX/LHitjDsOkgcEXv1vHk255T+all HBXmqDgQI0jjDmF8hmyD6gFhxzRDRbX779J1lPMCF8sLA2/vozlBeZH+iXGbPQ== 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 4PCVCk4yX7zscT; Thu, 9 Feb 2023 21:21:06 +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 319LL6VA056792; Thu, 9 Feb 2023 21:21:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 319LL6Cp056791; Thu, 9 Feb 2023 21:21:06 GMT (envelope-from git) Date: Thu, 9 Feb 2023 21:21:06 GMT Message-Id: <202302092121.319LL6Cp056791@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: 272b2e191ead - stable/12 - ipfilter: Correctly type ipf_pullup() 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/12 X-Git-Reftype: branch X-Git-Commit: 272b2e191eadbd267e173e0ed4d9e19e48c97674 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=272b2e191eadbd267e173e0ed4d9e19e48c97674 commit 272b2e191eadbd267e173e0ed4d9e19e48c97674 Author: Cy Schubert AuthorDate: 2023-01-31 19:09:00 +0000 Commit: Cy Schubert CommitDate: 2023-02-09 21:20:50 +0000 ipfilter: Correctly type ipf_pullup() ipf_pullup() outputs a pointer to ip_t. Though returning a pointer to void does work, it is imprecise and not completely correct. (cherry picked from commit c941e8c65d9df878136dc5d51d70256d33f7769f) --- sys/netpfil/ipfilter/netinet/ip_fil.h | 2 +- sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/netpfil/ipfilter/netinet/ip_fil.h b/sys/netpfil/ipfilter/netinet/ip_fil.h index 85a79eda1172..002ddfdc8348 100644 --- a/sys/netpfil/ipfilter/netinet/ip_fil.h +++ b/sys/netpfil/ipfilter/netinet/ip_fil.h @@ -1700,7 +1700,7 @@ extern int ipf_outobj(ipf_main_softc_t *, void *, void *, int); extern int ipf_outobjk(ipf_main_softc_t *, ipfobj_t *, void *); extern int ipf_outobjsz(ipf_main_softc_t *, void *, void *, int, int); -extern void *ipf_pullup(mb_t *, fr_info_t *, int); +extern ip_t *ipf_pullup(mb_t *, fr_info_t *, int); extern int ipf_resolvedest(ipf_main_softc_t *, char *, struct frdest *, int); extern int ipf_resolvefunc(ipf_main_softc_t *, void *); diff --git a/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c b/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c index fe2b5946fab9..3e4fefa7066e 100644 --- a/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c @@ -1183,17 +1183,17 @@ mbufchainlen(struct mbuf *m0) /* We assume that 'xmin' is a pointer to a buffer that is part of the chain */ /* of buffers that starts at *fin->fin_mp. */ /* ------------------------------------------------------------------------ */ -void * +ip_t * ipf_pullup(mb_t *xmin, fr_info_t *fin, int len) { int dpoff, ipoff; mb_t *m = xmin; - char *ip; + ip_t *ip; if (m == NULL) return (NULL); - ip = (char *)fin->fin_ip; + ip = fin->fin_ip; if ((fin->fin_flx & FI_COALESCE) != 0) return (ip); @@ -1238,6 +1238,7 @@ ipf_pullup(mb_t *xmin, fr_info_t *fin, int len) #endif } else { + m = m_pullup(m, len); } if (n != NULL) @@ -1264,9 +1265,9 @@ ipf_pullup(mb_t *xmin, fr_info_t *fin, int len) m = m->m_next; } fin->fin_m = m; - ip = MTOD(m, char *) + ipoff; + ip = MTOD(m, ip_t *) + ipoff; - fin->fin_ip = (ip_t *)ip; + fin->fin_ip = ip; if (fin->fin_dp != NULL) fin->fin_dp = (char *)fin->fin_ip + dpoff; if (fin->fin_fraghdr != NULL)