Move the mtod calls *after* we've made sure that the packet has passed the

filter successfully. Otherwise it can be NULL if the filter blocked it,
and we die. How did this ever work?
This commit is contained in:
christos 1997-04-15 00:41:52 +00:00
parent 2357b53997
commit 0659cacda6
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_input.c,v 1.48 1997/02/26 04:09:32 mrg Exp $ */
/* $NetBSD: ip_input.c,v 1.49 1997/04/15 00:41:52 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
@ -258,9 +258,9 @@ next:
for (pfh = pfil_hook_get(PFIL_IN); pfh; pfh = pfh->pfil_link.le_next)
if (pfh->pfil_func) {
rv = pfh->pfil_func(ip, hlen, m->m_pkthdr.rcvif, 0, &m0);
ip = mtod(m = m0, struct ip *);
if (rv)
goto next;
ip = mtod(m = m0, struct ip *);
}
#endif /* PFIL_HOOKS */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_output.c,v 1.38 1997/02/18 20:49:36 mrg Exp $ */
/* $NetBSD: ip_output.c,v 1.39 1997/04/15 00:41:53 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -305,11 +305,11 @@ ip_output(m0, va_alist)
for (pfh = pfil_hook_get(PFIL_OUT); pfh; pfh = pfh->pfil_link.le_next)
if (pfh->pfil_func) {
rv = pfh->pfil_func(ip, hlen, ifp, 1, &m1);
ip = mtod(m = m1, struct ip *);
if (rv) {
error = EHOSTUNREACH;
goto done;
}
ip = mtod(m = m1, struct ip *);
}
#endif /* PFIL_HOOKS */
sendit: