a problem with netfilter

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

 



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.

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux