diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-04-20 19:52:44 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-04-20 19:52:44 +0000 |
commit | 472569caed823134f3cdf4b7b1f19c50910c3879 (patch) | |
tree | 47f7fc8ecb225ce29c9fcd2defd292b2af4f2512 /sys/net/bpf.c | |
parent | f89146cba13d07521aafe77f436a3255fb95e64c (diff) |
send raw 802.11 frames with bpf(4) using the IEEE802_11 or
IEEE802_11_RADIO data link types.
ok canacar@ damien@
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r-- | sys/net/bpf.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 8588e507fa8..980066a9490 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.57 2005/04/20 17:03:22 reyk Exp $ */ +/* $OpenBSD: bpf.c,v 1.58 2005/04/20 19:52:42 reyk Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -107,6 +107,7 @@ bpf_movein(struct uio *uio, u_int linktype, struct mbuf **mp, struct sockaddr *sockp, struct bpf_insn *filter) { struct mbuf *m; + struct m_tag *mtag; int error; u_int hlen; u_int len; @@ -150,6 +151,12 @@ bpf_movein(struct uio *uio, u_int linktype, struct mbuf **mp, hlen = 24; break; + case DLT_IEEE802_11: + case DLT_IEEE802_11_RADIO: + sockp->sa_family = AF_UNSPEC; + hlen = 0; + break; + case DLT_RAW: case DLT_NULL: sockp->sa_family = AF_UNSPEC; @@ -211,6 +218,15 @@ bpf_movein(struct uio *uio, u_int linktype, struct mbuf **mp, m->m_data += hlen; /* XXX */ } + /* + * Prepend the data link type as a mbuf tag + */ + mtag = m_tag_get(PACKET_TAG_DLT, sizeof(u_int), M_NOWAIT); + if (mtag == NULL) + return (ENOMEM); + *(u_int *)(mtag + 1) = linktype; + m_tag_prepend(m, mtag); + return (0); bad: m_freem(m); |