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.
> struck me as very odd - none of the protocol headers (IP, TCP,
> UDP) expose the checksum value. Can you explain your rationale
> for this? Whlie this is perhaps uninteresting on the inbound side,
> it is quite interesting on the outbound side.
Sorry - that URL is out of date - the providers I've been using in
testing do provide checksum values.
> 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
> For example, with TCP you mention that it is possible to see if
> invalid flag combinations have been supplied - does this mean
> the TCP header has also not been checksum'd?
I just want to solve IP providers for now - I know there are complications
with the location of the TCP checksum calculation, which I'll eventually
try to solve. :)
> 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
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.
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.
> Adding ipv4_hl (or whatever you want to call it) would also be
> beneficial for people who want to use dtrace to look for packets
> with IP options in them.
Yes, the "ipv4" provider will have args[2]->ipv4_ihl.
> 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.
cheers,
Brendan
--
Brendan
[CA, USA]
_______________________________________________
networking-discuss mailing list
[email protected]