Re: What to do if no protocol family?
Re: What to do if no protocol family?
- Subject: Re: What to do if no protocol family?
- From: Brian Doyle <email@hidden>
- Date: Thu, 2 Mar 2006 11:31:11 -0800
Thanks Josh,
This will be perfect. I tried PF_NDRV and it didn't even attach
(EEXIST) so fortunately that's not something that can even be done in
error.
-b
On Mar 2, 2006, at 10:15 AM, Josh Graessley wrote:
Hi Brian,
You can use a dynamically allocated large value. I believe the best
way to get one of these values is to use kev_vendor_code_find. This
will give you a unique 32bit value that you can use for the
protocol family. There should be a better way to coordinate
protocol families, but there isn't.
The protocol family is just used for intermediate matching. The
packet comes it, is it matched against ethernet demux descriptors.
When it finds one that matches, the protocol family is returned.
The interface then looks for the input function that was registered
for that protocol family, the one you specified when attaching your
protocol to the interface.
Don't use PF_NDRV, that will really screw things up. A specific
protocol family can only attach once, if you use PF_NDRV, that will
prevent everything else that uses PF_NDRV from working.
-josh
On Mar 2, 2006, at 12:56 AM, Brian Doyle wrote:
Hello,
I'm writing a driver that needs to read and write raw ethernet
frames. After reading source code all day I've come to the
conclusion that hooking in to the dlil with ifnet_attach_protocol
() would be great, except that ether_demux() dispatches to
protocol handlers by looking at both the ethernet type field and
the protocol family that was specified when the protocol was
registered. For my purposes I want to send and receive frames
that have a specific ethernet type (IANA registered but non-
standard). There are no registered protocol families for this
type however.
My question is, what should I use for the protocol family (if in
fact hooking in via ifnet_attach_protocol() is the correct thing
to do)? I could use PF_NDRV which seems to be for raw frames, but
if I do I suspect that will conflict with userland processes that
wish to use PF_NDRV at the socket level. I could also just use a
value greater than AF_MAX, but that seems a bit dodgy as it might
collide later with something else.
If I'm thinking about this all wrong I'd love to hear some other
ideas. I *do* need to be in the kernel as I'm interfacing with
other drivers but all I need is to send and receive ethernet
frames with a specific type while not interfering with the rest of
the network stack.
Any help will be greatly appreciated, thanks!!
-b
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden