Source ports at the IP layer

From: Javier Govea
Date: Tue Oct 14 2003 - 16:15:41 EST


Hi guys,

I want to get the source ports of every incomming IP packet at the IP layer, but I'm
having problems.

A print out, in the ip_rcv() function (in ip_input.c), of skb->h.uh->source (for the UDP
source port) and of skb->h.th->source (for the TCP source port) is always displaying 17664
(and i'm sure that is not the real source port). What am i doing wrong?? Is it possilble
at all to get the source ports directly from skb->h.th->source at this early stage, i mean
at the IP layer?? Do i need to do some casting or calling another function before i can
get the ports???

I also tried
struct tcphdr *th = (struct tcphdf *)skb->h.th;
and then printing out th->source...but i'm still getting 17664...any suggestion on how I
can get the ports??? All ideas are very very welcome...

Thanx in advance...
Xavier
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/