Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-21-2005, 03:25 AM
|
#1
|
Member
Registered: Feb 2005
Posts: 39
Rep:
|
C error "dereferencing pointer to incomplete type"
Hello,
I'm not a very good programmer and I've got a problem with gcc compiler. I make a C file but there's an error. Here there's my code:
printk(KERN_INFO "\n IP source:%d IPdest:%d\n",skb->nh.iph->saddr, skb->nh.iph->saddr);
and here there's the error:
error: dereferencing pointer to incomplete type.
But I don't understand where's my error. What does this error mean?Could you help me?Thanks....lucs
|
|
|
Click here to see the post LQ members have rated as the most helpful post in this thread.
|
02-21-2005, 03:52 AM
|
#2
|
Senior Member
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973
Rep:
|
post the declaration of skb and your includes.
|
|
|
02-21-2005, 05:11 AM
|
#3
|
Member
Registered: Feb 2005
Posts: 39
Original Poster
Rep:
|
skb is a pointer of skbuff structure. Here there's the structure
struct sk_buff {
/* These two members must be first. */
struct sk_buff * next; /* Next buffer in list */
struct sk_buff * prev; /* Previous buffer in list */
struct sk_buff_head * list; /* List we are on */
struct sock *sk; /* Socket we are owned by */
struct timeval stamp; /* Time we arrived */
struct net_device *dev; /* Device we arrived on/are leaving by */
struct net_device *real_dev; /* For support of point to point protocols
(e.g. 802.3ad) over bonding, we must save the
physical device that got the packet before
replacing skb->dev with the virtual device. */
/* Transport layer header */
union
{
struct tcphdr *th;
struct udphdr *uh;
struct icmphdr *icmph;
struct igmphdr *igmph;
struct iphdr *ipiph;
struct spxhdr *spxh;
unsigned char *raw;
} h;
/* Network layer header */
union
{
struct iphdr *iph;
struct ipv6hdr *ipv6h;
struct arphdr *arph;
struct ipxhdr *ipxh;
unsigned char *raw;
} nh;
/* Link layer header */
union
{
struct ethhdr *ethernet;
unsigned char *raw;
} mac;
struct dst_entry *dst;
/*
* This is the control buffer. It is free to use for every
* layer. Please put your private variables there. If you
* want to keep them across layers you have to do a skb_clone()
* first. This is owned by whoever has the skb queued ATM.
*/
char cb[48];
unsigned int len; /* Length of actual data */
unsigned int data_len;
unsigned int csum; /* Checksum */
unsigned char __unused, /* Dead field, may be reused */
cloned, /* head may be cloned (check refcnt to be sure). */
pkt_type, /* Packet class */
ip_summed; /* Driver fed us an IP checksum */
__u32 priority; /* Packet queueing priority */
atomic_t users; /* User count - see datagram.c,tcp.c */
unsigned short protocol; /* Packet protocol from driver. */
unsigned short security; /* Security level of packet */
unsigned int truesize; /* Buffer size */
unsigned char *head; /* Head of buffer */
unsigned char *data; /* Data head pointer */
unsigned char *tail; /* Tail pointer */
unsigned char *end; /* End pointer */
void (*destructor)(struct sk_buff *); /* Destruct function */
#ifdef CONFIG_NETFILTER
/* Can be used for communication between hooks. */
unsigned long nfmark;
/* Cache info */
__u32 nfcache;
/* Associated connection, if any */
struct nf_ct_info *nfct;
#ifdef CONFIG_NETFILTER_DEBUG
unsigned int nf_debug;
#endif
#endif /*CONFIG_NETFILTER*/
#if defined(CONFIG_HIPPI)
union{
__u32 ifield;
} private;
#endif
#ifdef CONFIG_NET_SCHED
__u32 tc_index; /* traffic control index */
#endif
};
|
|
|
02-21-2005, 05:35 AM
|
#4
|
Senior Member
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973
Rep:
|
Quote:
Originally posted by __J
post the declaration of skb and your includes.
|
post the line in your code where skb is being declared ( initialized and allocated)
|
|
|
02-21-2005, 05:47 AM
|
#5
|
Member
Registered: Feb 2005
Posts: 39
Original Poster
Rep:
|
static int transmit(struct sk_buff *skb, struct net_device *dev).....but I don't find where is it iniatialized...I think that mine is a casting problem, what do you think?
|
|
|
02-21-2005, 05:59 AM
|
#6
|
Senior Member
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973
Rep:
|
http://gnumonks.org/ftp/pub/doc/skb-doc.html
look at section 2.2
EDIT: if the pointer is pointing nowhere (i.e. skb does not have memory assigned to it) and the compiler does not catch it ( it did here, but in other instances.....) this could lead to disaster. remember, there are no segmentation faults in kernel programming  . A wild pointer in kernel land that overwrites something like filesystem info in ram could lead to very bad results...
If you're new to all this I'd suggest you set up another partition and install a minimal linux disto on it to do your programming that way a wild bug doesn't damage you're main install ( in application programming you're ok, but kernel is a different story).
Last edited by __J; 02-21-2005 at 06:11 AM.
|
|
|
02-21-2005, 10:33 AM
|
#7
|
Senior Member
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
|
I think this error usually means that the line with the offending code is in a .c file which does NOT have the necessary .h file included. You may have included the necessary file somewhere else, but if it's not ALSO in each and every .c file where it's needed, you'll get this error.
|
|
2 members found this post helpful.
|
All times are GMT -5. The time now is 02:17 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|