Hi to all in the List,
i figured out that the following code works fine:

if((ntohs(((unsigned int)((struct tcphdr *)(skb->h.th)+1)->source))==20

But!
I can't understand why i have to add the 1 to the Pointer.
Can anyone help me and explain that to me please?

Thank You.

Regards
Andreas Rennen

Andreas Rennen wrote:
>
> if (skb->nh.iph->protocol==6)
>                           ^^^^^           must be ...->protocol
>      x=skb->h.th->source;
>
> I need to fingure out to wich source and destination port a packet goes.
> Thanks to Christoph Mause for his example that can do that:
>
> if (sk->protocol == 6)               //Ist das Transportprotokoll TCP?
> {
>    s_address = sk->saddr;            //Hiermit erhalte die die IP-
> Source Adresse
>    d_address = sk->daddr;            //Hier die IP- Destination Adresse
>    sport     = sk->sport;            //Somit bekommt man den Source Port
>    dport     = sk->dport;            //und so den Destination Port
> }
> else
>    printk(KERN_WARNING "Transportprotokoll ist nicht TCP\n");
>
> My Question is:
> Why is the struct sk_buff h not filled and the pointer of  n.th->source
> points to the wrong adress?
> I found the struct in the file sk_buff.h and there is the union h defined.
> Why is it defined but not used?
> Perhaps i have a wrong kernel-config?
>
> Thank you for further help.
>
> Regards
> Andreas Rennen
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-net" in
> the body of a message to [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to