git: 272b2e191ead - stable/12 - ipfilter: Correctly type ipf_pullup()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 09 Feb 2023 21:21:06 UTC
The branch stable/12 has been updated by cy:
URL: https://cgit.FreeBSD.org/src/commit/?id=272b2e191eadbd267e173e0ed4d9e19e48c97674
commit 272b2e191eadbd267e173e0ed4d9e19e48c97674
Author: Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-01-31 19:09:00 +0000
Commit: Cy Schubert <cy@FreeBSD.org>
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)