Re: how do I direct raw packages to a given socket?

Alan Cox (alan@lxorguk.ukuu.org.uk)
Tue, 28 Sep 1999 22:30:51 +0100 (BST)


> 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.

That basically implies writing a small AF_FIELDBUS socket layer - it can
do just demux then the kernel will do select/poll/receive and other
grungy bits for you.

> netif_rx(skb);

Demux is expected to be done the other side. So your socket layer rx would do

if(skb->len < MINLEN || ....)
{
kfree_skb(skb);
return 0;
}

sk=fieldbus_which_socket(skb);
if(sk==NULL)
{
kfree...
..
}
skb->sk=sk;
if(sock_queue_rcv_skb(sk, skb)<0)
kfree_skb(skb);
return 0;

or similar.

-
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/