From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 29 17:07:25 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C62E116A4CE for ; Tue, 29 Jun 2004 17:07:25 +0000 (GMT) Received: from smtp.netli.com (ip2-pal-focal.netli.com [66.243.52.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A1ED43D31 for ; Tue, 29 Jun 2004 17:07:25 +0000 (GMT) (envelope-from vlm@netli.com) Received: (qmail 9113 invoked by uid 84); 29 Jun 2004 17:07:07 -0000 Received: from vlm@netli.com by l3-1 with qmail-scanner-0.96 (uvscan: v4.1.40/v4121. . Clean. Processed in 0.174024 secs); 29 Jun 2004 17:07:07 -0000 Received: from unknown (HELO netli.com) (172.17.1.12) by mx01-pal-lan.netli.lan with SMTP; 29 Jun 2004 17:07:07 -0000 Message-ID: <40E1A1F8.90003@netli.com> Date: Tue, 29 Jun 2004 10:08:08 -0700 From: Lev Walkin Organization: Netli, Inc. User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040307 X-Accept-Language: ru, en-us, en MIME-Version: 1.0 To: Ivan Voras References: <40E177DB.6070506@fer.hr> In-Reply-To: <40E177DB.6070506@fer.hr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: hackers@freebsd.org Subject: Re: Peeking BPF X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2004 17:07:25 -0000 Ivan Voras wrote: > > I need to convert this code: > > ret = recvfrom(thisint->sockInt, &resultframe, 1520, MSG_PEEK, 0, 0); > if (ret > 0) return TRUE; > > to use BPF. Essentialy, how to find out if a packet is available over > the BPF interface? try to read() it and read() will hang there until there is data in it. alternatively, use poll() or select() to check for readability event. char resultBuffer[65536]; ret = read(thisint->bpfInt, resultBuffer, sizeof(resultBuffer)); if(ret > 0) return TRUE; -- Lev Walkin vlm@netli.com