Changeset View
Changeset View
Standalone View
Standalone View
sys/net/bpf.c
Show First 20 Lines • Show All 757 Lines • ▼ Show 20 Lines | if (op_w != 0) { | ||||
* snap length. After that appliation usually sets its own | * snap length. After that appliation usually sets its own | ||||
* filter. | * filter. | ||||
*/ | */ | ||||
d->bd_writer = 2; | d->bd_writer = 2; | ||||
} else | } else | ||||
CK_LIST_INSERT_HEAD(&bp->bif_dlist, d, bd_next); | CK_LIST_INSERT_HEAD(&bp->bif_dlist, d, bd_next); | ||||
reset_d(d); | reset_d(d); | ||||
/* Trigger EVFILT_WRITE events. */ | |||||
bpf_wakeup(d); | |||||
BPFD_UNLOCK(d); | BPFD_UNLOCK(d); | ||||
bpf_bpfd_cnt++; | bpf_bpfd_cnt++; | ||||
CTR3(KTR_NET, "%s: bpf_attach called by pid %d, adding to %s list", | CTR3(KTR_NET, "%s: bpf_attach called by pid %d, adding to %s list", | ||||
__func__, d->bd_pid, d->bd_writer ? "writer" : "active"); | __func__, d->bd_pid, d->bd_writer ? "writer" : "active"); | ||||
if (op_w == 0) | if (op_w == 0) | ||||
EVENTHANDLER_INVOKE(bpf_track, bp->bif_ifp, bp->bif_dlt, 1); | EVENTHANDLER_INVOKE(bpf_track, bp->bif_ifp, bp->bif_dlt, 1); | ||||
▲ Show 20 Lines • Show All 1,450 Lines • ▼ Show 20 Lines | filt_bpfread(struct knote *kn, long hint) | ||||
return (ready); | return (ready); | ||||
} | } | ||||
static int | static int | ||||
filt_bpfwrite(struct knote *kn, long hint) | filt_bpfwrite(struct knote *kn, long hint) | ||||
{ | { | ||||
struct bpf_d *d = (struct bpf_d *)kn->kn_hook; | struct bpf_d *d = (struct bpf_d *)kn->kn_hook; | ||||
BPFD_LOCK_ASSERT(d); | BPFD_LOCK_ASSERT(d); | ||||
if (d->bd_bif == NULL) { | |||||
kn->kn_data = 0; | |||||
return (0); | |||||
} else { | |||||
kn->kn_data = d->bd_bif->bif_ifp->if_mtu; | kn->kn_data = d->bd_bif->bif_ifp->if_mtu; | ||||
return (1); | return (1); | ||||
} | |||||
} | } | ||||
#define BPF_TSTAMP_NONE 0 | #define BPF_TSTAMP_NONE 0 | ||||
#define BPF_TSTAMP_FAST 1 | #define BPF_TSTAMP_FAST 1 | ||||
#define BPF_TSTAMP_NORMAL 2 | #define BPF_TSTAMP_NORMAL 2 | ||||
#define BPF_TSTAMP_EXTERN 3 | #define BPF_TSTAMP_EXTERN 3 | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 897 Lines • Show Last 20 Lines |