netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* a problem with netfilter
@ 2012-10-17 12:34 Bozeanu Andrei
  2012-10-18  2:15 ` U.Mutlu
  0 siblings, 1 reply; 2+ messages in thread
From: Bozeanu Andrei @ 2012-10-17 12:34 UTC (permalink / raw)
  To: netfilter-devel

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.


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

end of thread, other threads:[~2012-10-18  2:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-17 12:34 a problem with netfilter Bozeanu Andrei
2012-10-18  2:15 ` U.Mutlu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).