views:

113

answers:

1

Hi, I have a program that it need get the source address from the struct "skbuff", In the previous kernel version, I can get the "saddr" using the following line:

static __u32
get_src_ip(const struct sk_buff *skb){
    return ntohl(skb->nh.iph->saddr);
}

The following is error message:

error: 'const struct sk_buff' has no member named 'nh'

Who can tell me the right code? thanks!

+2  A: 

sk_buff changed it structure name since Linux 2.6.22 . You should use skb->network_header instead.

Well, you may need to also change lots of member variable names - just reference to the latest manual.

Francis
Can you tell me where I can directlly get the useful manual. Thank you in advance.
Charlie Epps
the patchset is in http://www.linuxhq.com/kernel/v2.6/22/include/linux/skbuff.h. You should check the skbuff.h installed on your system to find the correct structure.
Francis
An up-to-date version is available at http://docs.blackfin.uclinux.org/kernel/generated/networking/re03.html
cartman