All of lore.kernel.org
 help / color / mirror / Atom feed
* Problems determining the correct tcp header size
@ 2003-03-19 20:04 qber66
  2003-03-26 15:35 ` Harald Welte
  0 siblings, 1 reply; 4+ messages in thread
From: qber66 @ 2003-03-19 20:04 UTC (permalink / raw)
  To: Netfilter-devel

Hi,

I'm making a new target for iptables, but I'n having a problems with 
determining the correct tcp header lenght in the following function:

static unsigned int ipt_mytarget_target(struct sk_buff **pskb, unsigned 
int hooknum,
        const struct net_device *in, const struct net_device *out,
        const void *targetinfo, void *userinfo)
{
    struct tcphdr *tcph = (struct tcphdr *) (*pskb)->h.th;
    struct iphdr *iph = (struct iphdr *) (*pskb)->nh.iph;

    printk(KERN_WARNING "iphdr lenght: %d, tcphdr lenght: %d\n", 
iph->ihl*4, tcph->doff*4);
}


When I use this rule:

iptables -t mangle -A POSTROUTING -p TCP -j MYTARGET

I get the following output:

iphdr lenght: 20, tcphdr lenght: 0
iphdr lenght: 20, tcphdr lenght: 0
iphdr lenght: 20, tcphdr lenght: 16
iphdr lenght: 20, tcphdr lenght: 0
iphdr lenght: 20, tcphdr lenght: 4
iphdr lenght: 20, tcphdr lenght: 16
iphdr lenght: 20, tcphdr lenght: 16
iphdr lenght: 20, tcphdr lenght: 0
iphdr lenght: 20, tcphdr lenght: 0
iphdr lenght: 20, tcphdr lenght: 4
iphdr lenght: 20, tcphdr lenght: 0
iphdr lenght: 20, tcphdr lenght: 16
iphdr lenght: 20, tcphdr lenght: 4
iphdr lenght: 20, tcphdr lenght: 0
.....

Can any one tell me what I'm doing wrong?

Thanks in advance,
Tim Vandermeersch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-03-28  0:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-19 20:04 Problems determining the correct tcp header size qber66
2003-03-26 15:35 ` Harald Welte
2003-03-27 23:19   ` Tim Vandermeersch
2003-03-28  0:05     ` Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.