how do I direct raw packages to a given socket?

Andreas Schuldei (schuldei@uni-bremen.de)
Tue, 28 Sep 1999 22:33:43 +0200


I got my fieldbus-driver (bitbus) to work. I can hardly
tell how good it felt when it moved its first packages!

Since it is heavyly based on skeleton.c it is gpl: You can get
it at
ftp://ftp.andrive.de/pub/bitio.c.bz2

Of cause I would love to hear from people and get feedback on
my coding style... :o)

But there are questions left:
I would like to direct packages to a given (raw) socket, depending on
a 16-bit (short) number in the package which indicates the
source of the package.

Right now I open a socket in userspace and bind it to the devive and
give it the same protocol as I specified in the kernel-module.
This way I can communicate with the devices on the bitbus.
But I want to do so from several processes. Right now all sockets
could receive all packages. Of cause I can open several raw sockets
with different file descriptors. Can I direct a package to the userspace
socket by specifing something like

skb->sock=filedescriptor;

after I received the package

skb->dev = dev;
skb->len = pkt_len.cpu_order;
skb->mac.raw=skb->data;
skb->protocol=htons(MCAT_PROTO);
skb->pkt_type=PACKET_HOST;
/* 'skb->data' points to the start of sk_buff data area. */
/* *skb->data=pkt_len+8; */
insb(ioaddr, skb->data, pkt_len.cpu_order +1 );

signal_read_from_fifo(ioaddr); /* tell TLCS that we are done */

and decided which socket it should go to before i let go of the skb?

netif_rx(skb);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/