Submit #2849 ยป bpf.patch
sys/net/bpf.c | ||
---|---|---|
#include <sys/kernel.h>
|
||
#include <sys/sysctl.h>
|
||
#include <netproto/802_11/ieee80211_dragonfly.h>
|
||
#include <sys/devfs.h>
|
||
struct netmsg_bpf_output {
|
||
... | ... | |
bpf_movein(struct uio *uio, int linktype, struct mbuf **mp,
|
||
struct sockaddr *sockp, int *datlen, struct bpf_insn *wfilter)
|
||
{
|
||
const struct ieee80211_bpf_params *p;
|
||
struct mbuf *m;
|
||
int error;
|
||
int len;
|
||
... | ... | |
sockp->sa_family = AF_UNSPEC;
|
||
hlen = 4; /* This should match PPP_HDRLEN */
|
||
break;
|
||
case DLT_IEEE802_11:
|
||
sockp->sa_family = AF_IEEE80211;
|
||
hlen = 0;
|
||
break;
|
||
case DLT_IEEE802_11_RADIO:
|
||
sockp->sa_family = AF_IEEE80211;
|
||
sockp->sa_len = 12;
|
||
hlen = sizeof(struct ieee80211_bpf_params);
|
||
break;
|
||
default:
|
||
return(EIO);
|
||
... | ... | |
* Make room for link header, and copy it to sockaddr.
|
||
*/
|
||
if (hlen != 0) {
|
||
if (sockp->sa_family == AF_IEEE80211) {
|
||
p = mtod(m, const struct ieee80211_bpf_params *);
|
||
hlen = p->ibp_len;
|
||
if (hlen > sizeof(sockp->sa_data)) {
|
||
error = EINVAL;
|
||
goto bad;
|
||
}
|
||
}
|
||
bcopy(m->m_data, sockp->sa_data, hlen);
|
||
m->m_pkthdr.len -= hlen;
|
||
m->m_len -= hlen;
|