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
This commit is contained in:
Cy Schubert 2023-01-31 11:09:00 -08:00
parent e7ab133648
commit c941e8c65d
2 changed files with 7 additions and 6 deletions

View File

@ -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 *);

View File

@ -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)