Hi!
I am programming a layer 3/4 protocol (source is available at
michaelblizek.twilightparadox.com). It does something like this.
static int rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev)
{
char *packet_type_p;
printk(KERN_ERR "rcv 2 %d", (int) skb);
packet_type_p = skb_pull(skb, 1);
printk(KERN_ERR "header %d", (int) packet_type_p);
printk(KERN_ERR "data %d", (int) skb->data);
printk(KERN_ERR "len %d", (int) skb->len);
printk(KERN_ERR "nhdr %d", (int) skb_network_header(skb));
}
static struct packet_type ptype_cor = {
.type = htons(ETH_P_COR),
.dev = 0,
.func = rcv
};
int __init cor_rcv_init(void)
{
BUG_ON(sizeof(struct skb_procstate) > 48);
dev_add_pack(&ptype_cor);
return 0;
}
I know, converting void* to int only works on 32 bit systems. I did this the
ugly way, because it is only for debugging and will be removed anyway.
The output is like this:
rcv 2 164120488
header 161199319
data 161199319
len 68
nhdr 161199318
The interesting part is that skb_network_header is correct and both skb_pull
and skb->data points one byte after the start of the packet. I thought
that skb->data should always point to the start of the packet and that
skb_pull should point to the network header after rcv is called!? ipv4 uses
skb_network_header and runs fine...
The device which sent the packet was the user mode linux switch daemon (see
http://user-mode-linux.sourceforge.net/old/networking.html).
-Michi
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ