[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about skbuff



Hi all,

I have a problem while I try to retrieve the pointer of the 
data content (payload) in skbuff (TCP protocol)

And the code is the following.


static struct nf_hook_ops linuxmag_ops = { {NULL, NULL}, hkpt, 
PF_INET, NF_IP_LOCAL_OUT, NF_IP_PRI_FILTER-1};


static struct nf_hook_ops linuxmag_ops2 = { {NULL, NULL}, hkpt, 
PF_INET, NF_IP_LOCAL_IN, NF_IP_PRI_FILTER-1};


static unsigned int hkpt(unsigned int hook, struct sk_buff 
**pskb, const struct net_device *indev, const struct net_device 
*outdev, int(*okfn)(struct sk_buff *))
{
  struct iphdr * ip (*pskb)->nh.iph; 
  struct tcphdr * tcph = (void *) ip + ip->ihl * 4;
  unsigned data * = (unsigned char *)tcph + (tcph->doff * 4)
.
  return NF_ACCEPT;
}


The result is 
data : c7ca7a50
(*pskb)->tail : c7ca7a50
(*pskb)->end : c7ca7a50

Could you correct me please.

Honestly, I'm a newbie in kernel programming.  And if I made 
any stupid mistakes in the above.  Please point me out or give 
some pointer to me that I can look for reference.  Thanks
Thanks a lot.

your sincerely,
marco.


-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/