Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108606327
D32561.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D32561.diff
View Options
diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2
--- a/lib/libc/sys/kqueue.2
+++ b/lib/libc/sys/kqueue.2
@@ -390,8 +390,8 @@
will contain the maximum value that can be added to the counter
without blocking.
.Pp
-For BPF devices, the filter always indicates that it is possible to
-write and
+For BPF devices, when the descriptor is attached to an interface the filter
+always indicates that it is possible to write and
.Va data
will contain the MTU size of the underlying interface.
.It Dv EVFILT_EMPTY
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -763,6 +763,10 @@
CK_LIST_INSERT_HEAD(&bp->bif_dlist, d, bd_next);
reset_d(d);
+
+ /* Trigger EVFILT_WRITE events. */
+ bpf_wakeup(d);
+
BPFD_UNLOCK(d);
bpf_bpfd_cnt++;
@@ -2229,11 +2233,16 @@
filt_bpfwrite(struct knote *kn, long hint)
{
struct bpf_d *d = (struct bpf_d *)kn->kn_hook;
- BPFD_LOCK_ASSERT(d);
- kn->kn_data = d->bd_bif->bif_ifp->if_mtu;
+ BPFD_LOCK_ASSERT(d);
- return (1);
+ if (d->bd_bif == NULL) {
+ kn->kn_data = 0;
+ return (0);
+ } else {
+ kn->kn_data = d->bd_bif->bif_ifp->if_mtu;
+ return (1);
+ }
}
#define BPF_TSTAMP_NONE 0
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 27, 8:16 PM (8 h, 38 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16210479
Default Alt Text
D32561.diff (1 KB)
Attached To
Mode
D32561: bpf: Fix the write filter
Attached
Detach File
Event Timeline
Log In to Comment