Fix a panic where if the mbuf was consumed by the filter for requeueing

(dummynet), ipsec_filter() would return the empty error code and the ipsec code
would continue to forward/deference the null mbuf.

Found by:       m0n0wall
Reviewed by:    bz
MFC after:      3 days
This commit is contained in:
Andrew Thompson 2007-12-26 08:41:58 +00:00
parent a76b9b6973
commit e361d7d421
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174913

View File

@ -293,6 +293,13 @@ ipsec_filter(struct mbuf **mp, int dir, int flags)
printf("%s: unknown IP version\n", __func__);
}
/*
* If the mbuf was consumed by the filter for requeueing (dummynet, etc)
* then error will be zero but we still want to return an error to our
* caller so the null mbuf isn't forwarded further.
*/
if (*mp == NULL && error == 0)
return (-1); /* Consumed by the filter */
if (*mp == NULL)
return (error);
if (error != 0)