linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Linux sk_buff issues.
@ 2001-07-31  5:43 Paul Schulz
  2001-08-01 22:43 ` Alexey Kuznetsov
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Schulz @ 2001-07-31  5:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: pschulz

Greetings,

In the 2.4.1 kernel..
While looking at the packet classifier code (net/sched/cls_u32.c) and other
ipv4 code that makes use of sk_buf, the following is observed:

-- There exist data structures in sk_buf for the mac layer (mac), net
	header (nh), and transport header (h).

-- These data structures contain explicit labels for the various header
	fields (depending on the protocol used) as well as a 'raw'
	field.

-- Most of the cls_u32 code and packet handling code uses the
	'raw' label in the data-structure.

Using kgdb, and tracing these datastructures, there are cases where the data
looks to be inconsistant. (for example, skb->nh.iph
points to one part of memory and skb->h.tcphdr points to a different part).
Also, the values seem to be different, eg., (struct udphdr *)((char
*)skb->nh.raw + 20)->source != skb->h.udp->source. I am assuming using
skb->nh.raw is the corrent version to use at this point. Is this correct and
are their any guidelines to be aware of?

Thanks,
Paul
--
                       Paul Schulz - Software Engineer
        Foursticks Pty Ltd - 2/259 Glen Osmond Road, Frewville, SA 5063
    Phone: +61 8 8338 5500   Fax: +61 8 8338 5511   Mobile: +61 401 981 301
       Email: pschulz@foursticks.com           Web: www.foursticks.com




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Linux sk_buff issues.
  2001-07-31  5:43 Linux sk_buff issues Paul Schulz
@ 2001-08-01 22:43 ` Alexey Kuznetsov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexey Kuznetsov @ 2001-08-01 22:43 UTC (permalink / raw)
  To: Paul Schulz; +Cc: linux-kernel

Hello!

>							 I am assuming using
> skb->nh.raw is the corrent version to use at this point.

Yes, nh is almost always set to right value, unlike h.

"Almost" is because, it is possible to see it shifted
when packet is sent via raw packet socket with an complicaed MAC header.
Shortly, corresponding pointer is reliable when packet originated
by corresponding part of code. h is reliable, when packet is sourced
by tcp/udp, nh - when it is srourced by a protocol.

The only 100% right way is to parse from skb->data and skip mac header
at el.

Alexey

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-08-01 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-31  5:43 Linux sk_buff issues Paul Schulz
2001-08-01 22:43 ` Alexey Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).