Brendan Gregg - Sun Microsystems wrote:

G'Day Darren,

On Mon, Jun 11, 2007 at 08:52:30PM -0700, [EMAIL PROTECTED] wrote:
Brendan,

I had a quick look through the URL you provided and one thing

That URL currently describes "take 1" of the network provider proposal,
and so is out of date. The newer details (IP only) were in the email I
sent, and I'll be updating the URL based on that and the feedback I get.

Ah, I used the URL because it seemed to have better content
than the email ;)


Also, can you explain where the probes for each protocol fit in
relation to the greater processing for the protocol?

Sure, probes fire when packets are sent and received. The actual
location of the probe macros in the kernel TCP/IP code is based on
available information and maintainability. This means that ip
probes may be placed in tcp_send_data() and udp_send_data(), just
as MIB macros for IP statistics appear in tcp.c and udp.c

Saying "when packets are sent and received" is a little bit too
vague.  Does this mean when IP* packets are sent/received
via the mac layer, dls layer, the driver layer or IP layer?  And
how far into each layer?

To compare this with snoop, what we get is more or less understood
to be a copy of the data sent to/from a device driver with anything
above it, so we know it is possible to see corrupt frames, incorrect
checksums, etc.

Having a good understanding of where the probes fit in the
overall architecture will help a lot towards us networking folks
understanding what we can (or cannot) see when using them.


Will tracemem() be told how to walk the packet, so I can the below?
tracemem(args[1]->ip_hdr, args[1]->ip_plength)

...well, that'd also require ip_hdr being added to ipinfo_t.

I don't think ipinfo_t should have ip_hdr; if you are interested in
protocol details, then instead of using the "ip" provider or the generic
ipinfo_t structure, you use the "ipv4" (or "ipv6") protocol specific
provider, which currently provides args[2]->ipv4_hdr as a pointer
to the raw ipha_t.

I think there are two things you may be interested in:

A) dumping the raw header + extended options.

Here is an example from the old prototype "ip" provider,

# dtrace -n 'ip:::send,ip:::receive { tracemem(args[2]->ipv4_hdr, 20); }'
dtrace: description 'ip:::send,ip:::receive ' matched 5 probes
CPU     ID                    FUNCTION:NAME
0 54627 ip_input:receive 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
        0: 45 20 00 98 3b 01 40 00 28 06 e0 c2 45 b5 2e b2  E ..;[EMAIL 
PROTECTED](...E...
       10: c0 a8 01 6d                                      ...m

0 54627 ip_input:receive 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
        0: 45 00 00 58 b6 fe 40 00 3c 06 03 e1 c0 a8 01 03  [EMAIL 
PROTECTED]<.......
       10: c0 a8 01 6d                                      ...m
[...]

So far so good, now need to replace the "20" value with args[2]->ipv4_ihl,

# dtrace -n 'ip:::send,ip:::receive { tracemem(args[2]->ipv4_hdr,
   args[2]->ipv4_ihl); }'
dtrace: invalid probe specifier ip:::send,ip:::receive { 
tracemem(args[2]->ipv4_hdr, args[2]->ipv4_ihl); }: tracemem( ) argument #2 must 
be a non-zero positive integral constant expression

Will ipv4_ihl be the number of bytes or the value as found in
the header? (a count of 4 byte words)

hmm. DTrace is trying to help out by sanity checking args,

       if (dt_node_is_posconst(size) == 0) {
               dnerror(size, D_TRACEMEM_SIZE, "tracemem( ) argument #2 must "
                   "be a non-zero positive integral constant expression\n");
       }

I need to check if there is a sensible way around this... I can think of
a work-around using existing DTrace functionality, but it isn't pretty.

I'm not sure I understand what the problem is here but I'm glad you do :)


B) dumping the payload

It wasn't the initial intent to access the payload easily from DTrace, but enough people have asked that I will check how doable this is (it could
certainly be added as a later feature).

Of course, if you can walk to the data offsets in C, you can tracemem()
them using DTrace (I assume this would need the first mblk pointer,
which would be provided in the protocol providers for such raw debugging).
So there will be at least one way to do this.

It would be nice to do this easily from DTrace, eg,

        tracemem(args[2]->ipv4_payload, args[2]->ipv4_plength)

which might turn into something like,

        tracemblk(args[2]->ipv4_baddr, args[2]->ipv4_plength)

baddr meaning buffer address, and tracemblk() a new function to walk
and dump mblks easily. I'm not yet sure which approach would be best
without trying to code it first.

Ok, dumping the payload is what I was asking about and it seems
like you understand the problem, etc.


For IPv6, how do you see this design evolving to include looking
at extension header data?

Extension header data would only be accessed through the ipv6 provider,
and can be added to the ipv6info_t struct.

For most IPv6 extension headers, there is a limit on them
appearing only once, with the exception being destination
options.  How do you see that being handled?

Darren

_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to