LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-10-2010, 02:43 AM   #1
trinity.coder
LQ Newbie
 
Registered: Jan 2010
Posts: 1

Rep: Reputation: 0
how to solve errors like ‘struct iphdr’ has no member named ‘daddr’


I ran a program ( the link is - http://www.security-freak.net/raw-so...r_eth_ip_tcp.c ) in my fedora core 5. On compilation , i get the following errors :

[root@localhost ~]# gcc sniffer_eth_ip_tcp.c
In file included from sniffer_eth_ip_tcp.c:12: /usr/include/linux/ip.h:97: error: expected specifier-qualifier-list before ‘uint8_t’
In file included from /usr/include/linux/tcp.h:21,
from sniffer_eth_ip_tcp.c:13:
/usr/include/asm/byteorder.h:6:2: warning: #warning using private kernel header; include <endian.h> instead!
sniffer_eth_ip_tcp.c: In function ‘ParseIpHeader’:
sniffer_eth_ip_tcp.c:147: error: ‘struct iphdr’ has no member named ‘daddr’
sniffer_eth_ip_tcp.c:148: error: ‘struct iphdr’ has no member named ‘saddr’
sniffer_eth_ip_tcp.c: In function ‘ParseTcpHeader’:
sniffer_eth_ip_tcp.c:185: error: ‘struct iphdr’ has no member named ‘protocol’
sniffer_eth_ip_tcp.c:187: error: ‘struct iphdr’ has no member named ‘ihl’



But , the struct iphdr in the corresponding header file contains the above mentioned data members. I feel the last four errors will be solved if the ones before them are solved.

can anyone please help..
 
Old 01-10-2010, 07:59 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
It looks like a syntax problem prior to your definition of (whatever the variable is) prevents the definition from being parsed properly. Most of the time you should take care of the first error and recompile, and hope the others go away. Additionally, the parts you're seeing in the header might be protected by #ifdefs.
Kevin Barry
 
Old 01-10-2010, 11:36 PM   #3
manavendra
LQ Newbie
 
Registered: May 2009
Location: Bangalore, India
Distribution: Kubuntu 2.6.31-14
Posts: 19

Rep: Reputation: 2
can you list the code of the struct from the file /usr/include/linux/ip.h.

i am using ubuntu and the line 97 of the file /usr/include/linux/ip.h doesn't mentions anything about ‘uint8_t’

Line 85-105:
Code:
 85 struct iphdr {
 86 #if defined(__LITTLE_ENDIAN_BITFIELD)
 87         __u8    ihl:4,
 88                 version:4;
 89 #elif defined (__BIG_ENDIAN_BITFIELD)
 90         __u8    version:4,
 91                 ihl:4;
 92 #else
 93 #error  "Please fix <asm/byteorder.h>"
 94 #endif
 95         __u8    tos;
 96         __be16  tot_len;
 97         __be16  id;
 98         __be16  frag_off;
 99         __u8    ttl;
100         __u8    protocol;
101         __sum16 check;
102         __be32  saddr;
103         __be32  daddr;
104         /*The options start here. */
105 };
 
  


Reply

Tags
capture, headers, packet, sniffer


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
‘struct input_dev’ has no member named ‘private’<--error message when making file the_ultimate_samurai Programming 4 05-05-2009 10:30 AM
error: ‘struct in6_addr’ has no member named ‘in6_u’ deb1513 Programming 1 12-02-2008 06:56 AM
error: 'struct SDL_SysWMinfo' has no member named 'info' TiDjY Linux - Desktop 4 11-24-2008 06:00 AM
error: ‘struct tcphdr’ has no member named ‘th_flags’ nasim751 Linux - Software 0 04-17-2008 05:55 AM
error: ‘struct inode’ has no member named ‘u’ PankajDS Linux - Kernel 0 02-25-2008 11:34 PM


All times are GMT -5. The time now is 07:13 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration