Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2001 02:49:59 +0100
From:      George Reid <greid@FreeBSD.org>
To:        Wing Tim <twchim1@hotmail.com>
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: Programming on Berkeley Packet Filter (bpf)
Message-ID:  <20010814024959.A64143@FreeBSD.org>
In-Reply-To: <F2025oXibxZxjbP3SIG0000542d@hotmail.com>; from twchim1@hotmail.com on Mon, Aug 13, 2001 at 11:46:10PM %2B0800
References:  <F2025oXibxZxjbP3SIG0000542d@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 13, 2001 at 11:46:10PM +0800, Wing Tim wrote:

> Hi all,
>   From the man page of BPF(4), I found there're lots of useful functions 
> such as BIOCGBLEN, BIOCSBLEN, BIOCGDLT, ... , BIOCGSTATS. I tried to write a 
> should program to use these functions as follows:

Those aren't functions, those are command codes that you can pass to 
ioctl(2) for an opened bpf device.

> main ()
> {
>   printf(BIOCGBLEN);
>   ...
> }

...is nonsense.

>   By the way, how can I specify which interface I want to snoop data on?
>   Could anyone kindly give me a help? Thanks!

I think you need to read a basic UNIX programming guide before you start 
playing around with BPF. However, in answer to your question, the network 
device is specified with the BIOCSETIF ioctl.

-- 
+-------------------+---------------------+
|    George Reid    |  FreeBSD Committer  |
|  +44 7740 197460  |  greid@FreeBSD.org  |
+-------------------+---------------------+

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




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