LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-25-2012, 06:43 AM   #1
Brian Lu
LQ Newbie
 
Registered: May 2008
Location: Taipei
Posts: 9

Rep: Reputation: 0
Smile Compile error with new kernel 2.6.39


Hi All
I've upgraded my kernel from 2.6.17 to 2.6.39,one of the kernel module can't be compiled.
the original code is :

struct iphdr *iph = skb->nh.iph;
struct icmphdr *icmp = (void *)iph + iph->ihl * 4 ;

if(!(iph->protocol == IPPROTO_ICMP))
return ((0) ^ info->invert);

after I searched from google,I modified the code become:

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
struct iphdr *iph = ip_hdr(skb);
#else
struct iphdr *iph = skb->nh.iph;
#endif
struct icmphdr *icmp = (void *)iph + iph->ihl * 4 ;

if(!(iph->protocol == IPPROTO_ICMP))
return ((0) ^ info->invert);

But still can't work.
Error message:
icmpid/xt_icmpid.c: In function 'match':
icmpid/xt_icmpid.c:48:16: error: implicit declaration of function 'ip_hdr'
icmpid/xt_icmpid.c:48:29: warning: initialization makes pointer from integer without a cast
icmpid/xt_icmpid.c:53:43: error: dereferencing pointer to incomplete type
icmpid/xt_icmpid.c:55:13: error: dereferencing pointer to incomplete type

Does anyone know how to modify it? thanks for any help~
 
Old 06-25-2012, 02:09 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Hi,

in order to help you we need some basic information:
- what are your distribution and version?
- why so huge a jump (from 2.6.17 to 2.6.39)? wouldn't it be simpler to upgrade your distribution's version, or to install a newer one?
- do you try to compile a vanilla kernel (coming directly from kernel.org) or an already patched one?
- how did you configure your kernel? Did you re-use an old ".config" and issued a "make oldconfig" or not?
- which kernel module is involved?
- what are the exact error messages you got before modifying the code?

Last edited by Didier Spaier; 06-25-2012 at 02:12 PM.
 
Old 06-25-2012, 08:55 PM   #3
Brian Lu
LQ Newbie
 
Registered: May 2008
Location: Taipei
Posts: 9

Original Poster
Rep: Reputation: 0
- what are your distribution and version?
Fedora 5 to Fedora 14
- why so huge a jump (from 2.6.17 to 2.6.39)? wouldn't it be simpler to upgrade your distribution's version, or to install a newer one?
Install a newer one
- do you try to compile a vanilla kernel (coming directly from kernel.org) or an already patched one?
Coming directly from kernel.org
- how did you configure your kernel? Did you re-use an old ".config" and issued a "make oldconfig" or not?
The problem is caused by kernel 2.6.22 redefined new skbuff.h,all structure were changed.
2.4.x~2.6.22 has an old structure. >2.6.22 has a new structure.
- which kernel module is involved?
No other kernel module is involved.
- what are the exact error messages you got before modifying the code?
46 //#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
47 //struct iphdr *iph = ip_hdr(skb);
48 //#else
49 struct iphdr *iph = skb->nh.iph;
50 //#endif
51 struct icmphdr *icmp = (void *)iph + iph->ihl * 4 ;
52
53 if(!(iph->protocol == IPPROTO_ICMP))
54 return ((0) ^ info->invert);

icmpid/xt_icmpid.c: In function 'match':
icmpid/xt_icmpid.c:49:32: error: 'struct sk_buff' has no member named 'nh'
icmpid/xt_icmpid.c:51:43: error: dereferencing pointer to incomplete type
icmpid/xt_icmpid.c:53:13: error: dereferencing pointer to incomplete type

Last edited by Brian Lu; 06-25-2012 at 08:57 PM.
 
Old 06-25-2012, 09:53 PM   #4
Brian Lu
LQ Newbie
 
Registered: May 2008
Location: Taipei
Posts: 9

Original Poster
Rep: Reputation: 0
I know what caused my problem.
After I included ip.h , all errors were disappear.
 
  


Reply



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
kernel compile error here4linux Linux - Kernel 4 07-26-2008 07:35 AM
Kernel compile error hirts123 Slackware 5 07-14-2006 11:17 AM
Kernel Compile error help? GUIPenguin Linux - General 1 01-23-2005 12:25 AM
kernel compile error draker Linux - Newbie 1 08-14-2003 11:18 AM
kernel compile error! HELP! ReSync Linux - General 1 06-25-2002 08:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:07 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration