* [LARTC] Port number problem
@ 2002-11-06 8:11 Pham Viet Ha
2002-11-06 11:14 ` EGAL Vincent
0 siblings, 1 reply; 2+ messages in thread
From: Pham Viet Ha @ 2002-11-06 8:11 UTC (permalink / raw)
To: lartc
[-- Attachment #1: Type: text/plain, Size: 438 bytes --]
Hello there,
I am just a newbie. I got a bug when modifying CBQ scheduler in Linux Kernel 2.4. I just want to get the soure and destination port number of the packet (TCP/UDP). I used ntohs(skb->h.th->dest) for the destination port number of a TCP packet. It doesn't work. The printed value is not correct (we used FTP, port 21 to test).
Did anyone meet the same issue? Please give me a hand.
Thanks so much in advance.
VietHa
[-- Attachment #2: Type: text/html, Size: 1127 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [LARTC] Port number problem
2002-11-06 8:11 [LARTC] Port number problem Pham Viet Ha
@ 2002-11-06 11:14 ` EGAL Vincent
0 siblings, 0 replies; 2+ messages in thread
From: EGAL Vincent @ 2002-11-06 11:14 UTC (permalink / raw)
To: lartc
Pham Viet Ha wrote:
> Hello there,
>
> I am just a newbie. I got a bug when modifying CBQ scheduler in Linux
> Kernel 2.4. I just want to get the soure and destination port number
> of the packet (TCP/UDP). I used ntohs(skb->h.th->dest) for the
> destination port number of a TCP packet. It doesn't work. The printed
> value is not correct (we used FTP, port 21 to test).
>
> Did anyone meet the same issue? Please give me a hand.
>
> Thanks so much in advance.
>
> VietHa
hi,
should try something like this :
struct iphdr *iph = skb->nh.iph;
struct tcphdr *th;
if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
(iph->protocol = IPPROTO_TCP))
{
th = (struct tcphdr*)(((u32*)iph) + iph->ihl);
if (ntohs(th->dest) = ....
}
--
Vincent EGAL
Email : egal@ipanematech.com
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-11-06 11:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-06 8:11 [LARTC] Port number problem Pham Viet Ha
2002-11-06 11:14 ` EGAL Vincent
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.