>>>>> "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!"
|