LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: The meaning of *portp?

To: "Jytsai" <880579@xxxxxxxxxxx>
Subject: Re: The meaning of *portp?
Cc: <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
From: Stephen Zander <gibreel@xxxxxxxxx>
Date: 03 May 2000 23:08:37 -0700
>>>>> "Jytsai" == Jytsai  <880579@xxxxxxxxxxx> writes:
    Jytsai>         portp = (__u16 *) &( ((char *)iph)[iph->ihl*4] );

    Jytsai>     Doesn't it mean that portp points to "the address" of
    Jytsai> "the value of ip header length"?

No, it points to the address *immediately* after the IP header.
iph->ihl is a value in 32-bit words, hence the multiplication by 4.

portp (if I guess the obvious meaning of __u16) is a pointer to 16bit
values (short ints in most 32-bit C implementations).  The second
16bit value after the IP header is the destination port in either TCP
or UDP.

HTH

-- 
Stephen

"So.. if she weighs the same as a duck.. she's made of wood."  "And
therefore?"  "A witch!"


<Prev in Thread] Current Thread [Next in Thread>