pflog_packet: use bpf_mtap2().

(our bpf_mtap() is more "strict" about mbufs
than openbsd's one is.  eg. M_PKTHDR should be set properly.)
This commit is contained in:
yamt 2004-09-10 08:48:32 +00:00
parent 725814cc94
commit d37ce14181
1 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_pflog.c,v 1.3 2004/06/29 04:42:55 itojun Exp $ */
/* $NetBSD: if_pflog.c,v 1.4 2004/09/10 08:48:32 yamt Exp $ */
/* $OpenBSD: if_pflog.c,v 1.11 2003/12/31 11:18:25 cedric Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@ -210,7 +210,9 @@ pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir,
#if NBPFILTER > 0
struct ifnet *ifn;
struct pfloghdr hdr;
#ifndef __NetBSD__
struct mbuf m1;
#endif
if (kif == NULL || m == NULL || rm == NULL)
return (-1);
@ -246,14 +248,20 @@ pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir,
}
#endif /* INET */
#ifndef __NetBSD__
m1.m_next = m;
m1.m_len = PFLOG_HDRLEN;
m1.m_data = (char *) &hdr;
#endif
ifn = &(pflogif[0].sc_if);
if (ifn->if_bpf)
#ifndef __NetBSD__
bpf_mtap(ifn->if_bpf, &m1);
#else
bpf_mtap2(ifn->if_bpf, &hdr, PFLOG_HDRLEN, m);
#endif
#endif
return (0);