Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Oct 1998 17:32:43 -0600
From:      Wes Peters <wes@softweyr.com>
To:        "Juan L. Freniche" <jlfreniche@acm.org>, FreeBSD Net <freebsd-net@FreeBSD.ORG>
Subject:   Re: ZNYX and writing/reading LL frames
Message-ID:  <3614111B.730F432@softweyr.com>
References:  <36132F32.2D81@acm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Juan L. Freniche wrote:
> 
> 
> 5 How to write link-layer frames? The application will write the
>   complete frame, including the first 14 bytes.
> ---> Still Open
> 
> 6 How to read, in an exclusive way, link-layer frames? By exclusive I
>   mean that the application will receive the frame and that, given the
>   non-standard header (in particular, the EtherType), that frame must
>   not be passed to the network stack.
> ---> Still Open

You can read and write raw network frames using the bpf (Berkeley Packet
Filter) device as outlined in another response.  There are a few caveats,
though.  The bpf device is a shared-read device; if you don't want your
custom frames getting handed up the network stack, you'd better use an
EtherType that is not recognized by the networking code.

You will probably want to look into the read-filtering capabilities to 
cut down on the number of read packets your code has to process.  If you
pick an unused EtherType and stick with it, it should be simple to filter
out your packets from any others on the system, and to guarantee they will
not be mistaken for IP (or IPX, or XNS, etc) packets.

I'm working on a program that does something much like this right now.
If you like, once I've got it tested (probably tomorrow or Monday) I
can send you the source so you can see how the bpf related code works.

-- 
             Where am I, and what am I doing in this handbasket?

Wes Peters                                                      +1.801.915.2061
Softweyr LLC                                                   wes@softweyr.com

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3614111B.730F432>