From nobody Thu Feb 02 17:41:33 2023 X-Original-To: dev-commits-src-main@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 4P75gf12trz3kPCr; Thu, 2 Feb 2023 17:41:34 +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 4P75gf06jcz40n0; Thu, 2 Feb 2023 17:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675359694; 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=xmys3Njz4jqVOir1v7eNRATtc08vvvyQo56vhCEE4ug=; b=XtQC9ps3ZRIZ5moPdFCl0+0BusRof9ee+F33kQ55GrVYwdCdwPUIZFb3RQBhvIWNaUZ7dY jMZ+TcVtSF+h1j/UIIijWVRfh1CGba705A3Czzr0C6M2f4nJbUYbMD+LejIXmF36zdNu+n UyfGxJvIHHfO9UtMelXiwjkUEPbnX17MUebhNRkab3WQJyy0Y+HrPnONXS9BivV0jfEaEq /TkqSp1HigGlzF0S/WCf/NIPJmT4GC1h6n7HY4wgRUD5ogNd7oTKtLsUP8KC5ikQO81wtw 92or4JBayeAJ2q6b+sLazwRWkjX97dzWOULJqZPCQXjghSYmR0POj7o0UHwz2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675359694; 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=xmys3Njz4jqVOir1v7eNRATtc08vvvyQo56vhCEE4ug=; b=NqfDEzIPXWSZq1XV6X38x26FfZUf4pDCBQyiwayxFKDqhdsCNc8rbZpFU87MoW9lK+yRNr Rfg/VLdNkDKeiQNH6eNP82SvwXb+Q1JmhKDZBfAQ6kilDpgvWpGjKfzrZ+xXRtR/lQH+MT eko5HYS/Ogym4niUwXwaHzoWiR6gDls5ie6IZ6PQqWT0AkC/06/rSGkZEOZKAxvy3JHzGv vUXv0lx9PGE6vC83kFag2pCuQNQQ9B36vLSr5lz7jOu0c9nO9bZXvq0IEucwm2RjTrH1Ls K+T/6gTbXaxzPY7Q8HhiGswuAgmrMF/5SZsFiJRbbQ51adtECIlrXhbgxVh5nw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675359694; a=rsa-sha256; cv=none; b=sZVYt4J26/Q+8WlYvXUwc5C1ZAgaYCvKZoEwlwE+TFz6ExFfPdhLfgbseAhi0ho6x2io/n EoQrUwqPbo+ysf9VZ3hi2aTwRV0c/SJOdPrfl54fPLkI4zTPryb6s/5mLO92itJDA61qky W44jN5wf9R38YSbvhpJnK2xkCP23wZd9ty//zgtz0RWzbfeUPqbXh7H5pPcmzBGR0/wyWv Hbk15gkb9SZfR4lzdgZEGrNTbEzEtHfn4ys1b579K+bAjtRfge/STNDKQjwWz4Lks2Jh0F We+PWkyT5E7eK9jeKT4UOiP/dNN4nlhFAus8lqy/BN+tXp2K099Id8TOb3kZxQ== 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 4P75gd5zYwz131k; Thu, 2 Feb 2023 17:41:33 +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 312HfXAe033291; Thu, 2 Feb 2023 17:41:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 312HfXf9033290; Thu, 2 Feb 2023 17:41:33 GMT (envelope-from git) Date: Thu, 2 Feb 2023 17:41:33 GMT Message-Id: <202302021741.312HfXf9033290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: c941e8c65d9d - main - ipfilter: Correctly type ipf_pullup() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: c941e8c65d9df878136dc5d51d70256d33f7769f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=c941e8c65d9df878136dc5d51d70256d33f7769f commit c941e8c65d9df878136dc5d51d70256d33f7769f Author: Cy Schubert AuthorDate: 2023-01-31 19:09:00 +0000 Commit: Cy Schubert CommitDate: 2023-02-02 17:41:22 +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. MFC after: 1 week --- 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 b2ee855c3854..0dfc23d3dd1f 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)