Attach another DLTs for bpf: DLT_IEEE802_11 to capture raw 802.11 frame.

This commit is contained in:
onoe 2002-08-28 09:38:08 +00:00
parent 44fbd073c4
commit fd9daca7ea
3 changed files with 19 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: awi.c,v 1.43 2002/08/05 06:55:07 onoe Exp $ */
/* $NetBSD: awi.c,v 1.44 2002/08/28 09:38:10 onoe Exp $ */
/*-
* Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
@ -85,7 +85,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.43 2002/08/05 06:55:07 onoe Exp $");
__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.44 2002/08/28 09:38:10 onoe Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -653,6 +653,10 @@ awi_start(struct ifnet *ifp)
continue;
}
}
#if NBPFILTER > 0
if (ic->ic_rawbpf)
bpf_mtap(ic->ic_rawbpf, m0);
#endif
if (dowep) {
if ((m0 = ieee80211_wep_crypt(ifp, m0, 1)) == NULL) {
ifp->if_oerrors++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ieee80211.h,v 1.14 2002/08/11 03:39:21 thorpej Exp $ */
/* $NetBSD: if_ieee80211.h,v 1.15 2002/08/28 09:38:08 onoe Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -412,6 +412,7 @@ struct ieee80211com {
struct ifqueue ic_mgtq;
int ic_flags;
enum ieee80211_state ic_state;
caddr_t ic_rawbpf; /* packet filter structure */
struct ieee80211_bss ic_bss; /* information for this node */
int ic_bss_privlen; /* size for bs_private */
u_int8_t ic_ibss_chan;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ieee80211subr.c,v 1.9 2002/08/11 12:08:55 drochner Exp $ */
/* $NetBSD: if_ieee80211subr.c,v 1.10 2002/08/28 09:38:08 onoe Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ieee80211subr.c,v 1.9 2002/08/11 12:08:55 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ieee80211subr.c,v 1.10 2002/08/28 09:38:08 onoe Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -129,6 +129,10 @@ ieee80211_ifattach(struct ifnet *ifp)
int i, rate;
ether_ifattach(ifp, ic->ic_myaddr);
#if NBPFILTER > 0
bpfattach2(ifp, DLT_IEEE802_11,
sizeof(struct ieee80211_frame_addr4), &ic->ic_rawbpf);
#endif
ieee80211_crc_init();
memcpy(ic->ic_chan_active, ic->ic_chan_avail,
sizeof(ic->ic_chan_active));
@ -236,6 +240,11 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, int rssi, u_int32_t rstamp)
goto err;
wh = mtod(m, struct ieee80211_frame *);
}
#if NBPFILTER > 0
/* copy to listener after decrypt */
if (ic->ic_rawbpf)
bpf_mtap(ic->ic_rawbpf, m);
#endif
dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK;