Reputation: 13
i am getting this error:‘struct iphdr’ has no member named ‘ip_ttl’ same for other members too but not for protocol feild what is the solution to it?and y does it happen? PS:I saw this on various forums but couldn't get why is it able to access ipHeader->protocol and not others
Upvotes: 1
Views: 237
Reputation: 1867
Assuming you're using Linux, try taking a look at /usr/include/linux/ip.h
. That header file defines the structure:
struct iphdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
__u8 ihl:4,
version:4;
#elif defined (__BIG_ENDIAN_BITFIELD)
__u8 version:4,
ihl:4;
#else
#error "Please fix <asm/byteorder.h>"
#endif
__u8 tos;
__be16 tot_len;
__be16 id;
__be16 frag_off;
__u8 ttl;
__u8 protocol;
__sum16 check;
__be32 saddr;
__be32 daddr;
/*The options start here. */
};
As you can see, the name of the field is ttl
, not ip_ttl
.
Upvotes: 1