Re: NDRV sockets and Protocol Match error
Re: NDRV sockets and Protocol Match error
- Subject: Re: NDRV sockets and Protocol Match error
- From: "Duane Murphy" <email@hidden>
- Date: Fri, 5 Dec 2003 14:19:41 -0800
Thanks Josua, that did it. In my case these are company internal SNAP
based protocols. There is no matching protocol family. I was using
NDRV_DEMUXTYPE_SNAP simply because that's what the example code in
BSDLLCTest does (which is the only example of using NDRV sockets that I
know of).
I am treating these protocols as private and using four character codes
based on our signature for them. Seems to work like a charm.
It would be great if this information was published somehow. I almost
have enough information that I could write an article about raw socket
programming on OS X. (I am quite sure that you do :-). Maybe I'll write
it up sometime and pass it by you for a review. ;-)
Thanks again!
--- At Fri, 5 Dec 2003 13:16:04 -0800, Joshua Graessley wrote:
>
Duane,
>
>
The desc.protocol_family should not be NDRV_DEMUXTYPE_SNAP.
>
desc.protocol_family should be something like PF_INET. It should
>
represent the protocol of the packets you are registering to receive.
>
>
The ndrv_demux_desc structure(s) define what type of packets you are
>
interested in receiving. In the case of Ethernet, the ndrv_demux_desc
>
specifies Ethernet Type 2 frames, SAP, or SNAP protocols. For example,
>
to receive IP related packets, two ndrv_demux_desc structures are used.
>
One of them for the IP packets (ETYPE2 0x0800) and one for ARP (ETYPE2
>
0x0806).
>
>
The ndrv_protocol_desc is basically a header that tells the kernel how
>
many demux descriptors are required and which protocol family these
>
demux descriptors will capture packets for. The primary purpose of the
>
protocol family is to allow protocol filters to filter packets between
>
the interface and that protocol.
>
>
In the case of some protocol that isn't listed in sys/socket.h, things
>
are a little messy. You need to pick a protocol family that is unlikely
>
to be used by anyone else. It may be possible to request a value from
>
DTS, but I'm not sure. An example of this might be 802.1x. 802.1x is a
>
protocol that isn't listed in sys/socket.h. It is possible that someone
>
may want to write an 802.1x client. They could use PF_NDRV to register
>
the demux descriptors to get the 802.1x packets. They would need to
>
pick some protocol family.
>
>
When picking a protocol family, don't use a value less than 255. Socket
>
addresses have an address family field that usually matches up with a
>
protocol family. For example, AF_INET == PF_INET. The socket address
>
family field is only 1 byte long. We'd like to preserve all protocol
>
family values <= 255 for future use in protocols implemented in the
>
kernel.
...Duane
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.