From nobody Thu Feb 09 21:19:58 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 4PCVBQ4Pv3z3nl5s; Thu, 9 Feb 2023 21:19:58 +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 4PCVBQ3Rmzz46P1; Thu, 9 Feb 2023 21:19:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675977598; 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=BSpiYi2DGfF9kNR51ypRVmc+brFM8ORwOwYNJFCMJ0k=; b=o0rpzg4vsJMwB/yKPk0ubxDryzdsLJBXXoza0pQwfHqPTfXZYqfoQd/nbqfDFgxAnKhtAK 7K4t24WjIQvg5FB6lHSEQ3I+DzcRoNmjL4HjjvJoykpvqeRcxH9T1ezNcMNhl9KLCCiPEi yfvbz7qmj1VJWSxOVrP81i/pHRjKc3dL7sPPfEVdCWgcVZ92gcwDD/uUl6TK9moQlJXzDD mfEFoJ+8oKhST30M75dHo6QAoPNVdgew5DjloXO+XnUFLk8YK2/ctoZ8iqSXLO4eb6F97n l+kAbDaGisghC/IPl6VDPm5JISaIgOFxBTyObsjtXWV/ZTLH/RH+VoHgJGgfbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675977598; 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=BSpiYi2DGfF9kNR51ypRVmc+brFM8ORwOwYNJFCMJ0k=; b=C0u3VtVxm4MPOeAJQ3Yy++kPwvwnfL0KQ2Uo9LsjkvdkICDXd0lADcSRjiZFTYH9YBr0Tb ZWIrLH4Q292LJj6N9A5U9zOezLEKlUCR+GzQG1ltPBW+it6FrPRqUdvNZMHxJRImJEUOOp KTTVztMsckThyconverlqqKB3XNLu++VQfBJhIfLQJxFe5sVlHz1ry16pX6podfb0rJSx7 4bulkCVoF3jsS3pzwnsk47XUacLrFyZJP1oQ8WPndgLXu9zGI2061wq+WhabktFuWNRPun 9ePdfvWahQij7NbcjB0fC0N5C4P4FXahCUeGlB1JM8WG/SvI+JtC2DwFma9xsg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675977598; a=rsa-sha256; cv=none; b=qxF96MkFJ2WxVw3iQ03asZapNhlBAhdrqMGC4zeOrqaZZEZVaeAr08yTuDgk8kXmrrmPOw nkMMg1TswZHO8QfeYBQ2YP5DxoYtO3rDPDd+3V1Bhy8qBQtd3Wgpa/FraKM0O+3jtY/Tmq EJomtOyn4r294rTvf8Juh3D4nTPssasDMFECO/F6FthFHW9Qm0XEisHwMhP35PEMtln/XD M4Q40gtZdcOUxusSDiH7ATaD+hUd27Ch7sYJ8HXJOUYhDiKQp3O8Wd9pdECu9aB2AUem65 wQutuVjUOvhwtVlt5R0EJ1C6yqwGF/tklOfJdqJU02hanISQALl/tsc3Px9h8A== 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 4PCVBQ1tGzzsfJ; Thu, 9 Feb 2023 21:19:58 +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 319LJwGd043763; Thu, 9 Feb 2023 21:19:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 319LJwp3043762; Thu, 9 Feb 2023 21:19:58 GMT (envelope-from git) Date: Thu, 9 Feb 2023 21:19:58 GMT Message-Id: <202302092119.319LJwp3043762@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: 0dbe2e4e8f85 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 0dbe2e4e8f85ce1869a87f112a4a1e8c5f8f1145 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=0dbe2e4e8f85ce1869a87f112a4a1e8c5f8f1145 commit 0dbe2e4e8f85ce1869a87f112a4a1e8c5f8f1145 Author: Cy Schubert AuthorDate: 2023-01-31 19:09:00 +0000 Commit: Cy Schubert CommitDate: 2023-02-09 21:19:41 +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 57a006ed5393..fa0cdbab0ab3 100644 --- a/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c @@ -1178,17 +1178,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); @@ -1233,6 +1233,7 @@ ipf_pullup(mb_t *xmin, fr_info_t *fin, int len) #endif } else { + m = m_pullup(m, len); } if (n != NULL) @@ -1259,9 +1260,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)