plz help me: Not able to access Linux header union variable...

hari kumar harikumar.83 at gmail.com
Sat Nov 12 05:57:23 MST 2005


Hi,
 I am not able to access an union variables in the following header
file (linux/skbuff.h) .
 given below are the details of the union variable

 union
    {
            struct tcphdr   *th;
            struct udphdr   *uh;
            struct icmphdr  *icmph;
            struct igmphdr  *igmph;
            struct iphdr    *ipiph;
            struct spxhdr   *spxh;
            unsigned char   *raw;
    } h;
 filename : linux /skbuff.h
 structure name where the union is declared : struct sk_buff

 I am not able to access the th/uh/icmph etc pointer objects from
the above union.
 I am working with this module in the KERNEL SPACE.

Here, I have also given the code and output of that file..

src = skb->h.th->source;
src is declared as __u16 variable


when I build the above code, the following error comes. I tried all
options, but the gcc compiler does not allow me to access the source
variable in struct tcphdr. MY kernel version is 2.4.20-8.



sw_in.c: In function `handle_frame':
sw_in.c:20: dereferencing pointer to incomplete type
make: *** [sw_in.o] Error 1

It would be of great help to me, if you can give  me some
information on this regard. Any information or thoughts are welcome on
the same.


Thanks
Regards
Hari



More information about the PLUG mailing list