Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Jan 1999 16:39:41 -0800 (PST)
From:      dwhite@pond.net
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   kern/9355: can't select() for writes on a bpf
Message-ID:  <199901070039.QAA01134@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         9355
>Category:       kern
>Synopsis:       can't select() for writes on a bpf
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan  6 16:40:02 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Doug White
>Release:        2.2.7-RELEASE
>Organization:
Pacific Crest Networks, Inc.
>Environment:
FreeBSD sturbei.pond.net 2.2.7-RELEASE FreeBSD 2.2.7-RELEASE #0: Mon Dec 21 14:44:26 PST 1998     dwhite@sturbei.pond.net:/usr/src/sys/compile/STURBEI  i386

>Description:
The Berkeley Packet Filter (bpf) does not appear to support select()ing
or poll()ing for writability.  Needless to say this is stupid and keeps
it from being used for something actually useful.
>How-To-Repeat:
Write a program that selects() a bpf file descriptor for writes, and 
be prepared to wait.
>Fix:
Add these two lines in just before the check for the read flag:

For 2.2.X:

if(rw & FWRITE)
	return(1);

for 3.X:

if(events & POLLOUT)
   return (1);

This makes bpf always accept writes.  I don't think the bpf needs to
throttle writes anyway.  If such logic actually
exists it should be trivially easy to add a check.  I just don't know
enough about the kernel side of bpf to make a good patch.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901070039.QAA01134>