The mbuf parameter to ip_output_pfil() must be an output parameter since

pfil(9) hooks may modify the chain.

X-MFC-With:	r286028
This commit is contained in:
Mark Johnston 2015-08-03 17:47:02 +00:00
parent 1c9a705223
commit 8f980c016b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286242

View File

@ -107,18 +107,21 @@ extern int in_mcast_loop;
extern struct protosw inetsw[];
static inline int
ip_output_pfil(struct mbuf *m, struct ifnet *ifp, struct inpcb *inp,
struct sockaddr_in *dst, int *fibnum, int *error)
ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, struct inpcb *inp,
struct sockaddr_in *dst, int *fibnum, int *error)
{
struct m_tag *fwd_tag = NULL;
struct mbuf *m;
struct in_addr odst;
struct ip *ip;
m = *mp;
ip = mtod(m, struct ip *);
/* Run through list of hooks for output packets. */
odst.s_addr = ip->ip_dst.s_addr;
*error = pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_OUT, inp);
*error = pfil_run_hooks(&V_inet_pfil_hook, mp, ifp, PFIL_OUT, inp);
m = *mp;
if ((*error) != 0 || m == NULL)
return 1; /* Finished */
@ -552,7 +555,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
/* Jump over all PFIL processing if hooks are not active. */
if (PFIL_HOOKED(&V_inet_pfil_hook)) {
switch (ip_output_pfil(m, ifp, inp, dst, &fibnum, &error)) {
switch (ip_output_pfil(&m, ifp, inp, dst, &fibnum, &error)) {
case 1: /* Finished */
goto done;