From: Bozeanu Andrei <andrei.bozeanu@cert-ro.eu>
To: netfilter-devel@vger.kernel.org
Subject: a problem with netfilter
Date: Wed, 17 Oct 2012 15:34:11 +0300 [thread overview]
Message-ID: <507EA5C3.6020903@cert-ro.eu> (raw)
Hey all,
I am writing a linux firewall kernel module (something a bit specific)
using Netfilter, in C. I extract the
TCP header and the IP header using the functions tcp_hdr() and ip_hdr()
on the skb. I extract the source and
destination IPs without any problem, yet, when I try to see the source
port and the destination port i get wrong
values.
sport = ntohs(tcp_hdr(skb)->source);
dport= ntohs(tcp_hdr(skb)->dest);
I use printk to send the info to the syslog and
printk(KERN_INFO "got data on port %hu from source port %hu\n", dport,
sport);
the result i get is
"got data on port 17680 from port 84"
"got data on port 17680 from port 84"
"got data on port 17680 from port 100"
while netstat shows me that the right values for these ports are dport =
56188 and sport = 22.
I must be doing something wrong or missing something of the bigger
picture, I would apreciate any insight
on why this behavior is generated.
Thank you all,
A.
next reply other threads:[~2012-10-17 12:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-17 12:34 Bozeanu Andrei [this message]
2012-10-18 2:15 ` a problem with netfilter U.Mutlu
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=507EA5C3.6020903@cert-ro.eu \
--to=andrei.bozeanu@cert-ro.eu \
--cc=netfilter-devel@vger.kernel.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.