All of lore.kernel.org
 help / color / mirror / Atom feed
From: EGAL Vincent <egal@ipanematech.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Port number problem
Date: Wed, 06 Nov 2002 11:14:32 +0000	[thread overview]
Message-ID: <marc-lartc-103658134217291@msgid-missing> (raw)
In-Reply-To: <marc-lartc-103657036108008@msgid-missing>

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/

      reply	other threads:[~2002-11-06 11:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-06  8:11 [LARTC] Port number problem Pham Viet Ha
2002-11-06 11:14 ` EGAL Vincent [this message]

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=marc-lartc-103658134217291@msgid-missing \
    --to=egal@ipanematech.com \
    --cc=lartc@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.