At 12:59 PM 03/23/2000 +0100, Andreas Rennen wrote:
>i've a programming problem with the struct sk_buff.
>I want to get the values of source and dest if the packet
>is of type 0x6 means tcp.
>
>My code looks like :
>
>unsigned int x;
>if (skb->nh.iph->saddr==6)
>     x=skb->h.th->source;
>
>It seems that i get the first values if the union nh
>and this is of cource the wrong value and i don't know why?

I know squat about skb, but I managed to hack the rshaper 
driver to look only at TCP packets.  The code (for v2.2.x) 
looks like this:

  struct iphdr *ih = (struct iphdr *)(skb->data);
  if (ih->protocol == IPPROTO_TCP) {
    u32 saddr = ih->saddr;
    u32 daddr = ih->daddr;

That (struct iphdr *) cast looks pretty suspect, but it does 
work.  (Maybe only because all my LAN traffic is IP?)
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to