How pointers work in this case?

From: kernel.lover (cranium.2003_at_gmail.com)
Date: 01/30/05


Date: 30 Jan 2005 03:05:38 -0800

Hello,
      By looking into skbuff.h it is clear that paket is stored in
skbuff structure which has also many structures defined for each layer
as union.
Can it be possible to retreive any structure by casting skb->data at
any stage once that struct is push to skbuff structure?
e.g. by looking in eth.c following statement tells it works but how???
struct ethhdr *eth = (struct ethhdr *)skb->data;
Also once a structure is assigned values/pushed it in skbuff structure
can it be possible to change its values at any later stage?
e.g. in above ethernet case does it possible to change eth->h_proto in
ethernet driver file(8390.c)
regards,
cranium



Relevant Pages

  • How pointers work in this case?
    ... skbuff structure which has also many structures defined for each layer ... as union. ... Can it be possible to retreive any structure by casting skb->data at ... ethernet driver file ...
    (comp.os.linux.networking)
  • Re: How pointers work in this case?
    ... > skbuff structure which has also many structures defined for each layer ... A union is a type that can be many types. ... (unless you have upcast a pointer to a subtype). ... If I upcast a struct basic and then dowcast to a struct complex my code ...
    (comp.os.linux.development.system)
  • Re: How pointers work in this case?
    ... > skbuff structure which has also many structures defined for each layer ... A union is a type that can be many types. ... (unless you have upcast a pointer to a subtype). ... If I upcast a struct basic and then dowcast to a struct complex my code ...
    (comp.os.linux.networking)