All of lore.kernel.org
 help / color / mirror / Atom feed
From: qber66 <tim.vandermeersch@pandora.be>
To: Netfilter-devel <netfilter-devel@lists.netfilter.org>
Subject: Problems determining the correct tcp header size
Date: Wed, 19 Mar 2003 20:04:47 +0000 (UTC)
Date: Tue, 25 Mar 2003 18:26:11 +0100	[thread overview]
Message-ID: <3E809133.4050400@pandora.be> (raw)

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.

             reply	other threads:[~2003-03-19 20:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-19 20:04 qber66 [this message]
2003-03-26 15:35 ` Problems determining the correct tcp header size Harald Welte
2003-03-27 23:19   ` Tim Vandermeersch
2003-03-28  0:05     ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E809133.4050400@pandora.be \
    --to=tim.vandermeersch@pandora.be \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.