Hi!
On 17:33 Sat 03 Oct , Michael Blizek wrote:
> 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));
> }
...
> 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
AAAAAAaaaaaaahhhhhhhhhh - I have found the error. skb_pull increases
skb->data, so the output is fine, except header. I have just missed, that
skb_pull returns the pointer *after* it is increased.
-Michi
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ