icmp checksum with build_data()s
sandr8 <[email protected]> Fri, 21 May 2004 10:10:03 +0200
| Newsgroups | gmane.comp.security.libnet |
|---|---|
| Message-ID | <[email protected]> |
i jot down the pseudocode for my unlucky program:
8<----------------------------
libnet_init();
for(;;){
~ libnet_build_data(payload_s=len_a);
~ libnet_build_data(payload_s=len_b);
~ libnet_build_data(payload_s=len_c);
~ libnet_build_icmpv4_echo(payload=NULL, payload_s=0);
~ libnet_build_ip();
~ libnet_write();
}
8<----------------------------
i've digged into what's happening and the problem is that the icmp
checksum computed appears wrong.
when it is computed against the icmp pblock, q->h_len is 8, while i'd
really like it to be (8+len_c+len_b+len_a).
i guess this should be the contract with the user programmers, but if
it is done this way on purpose, then how should i do to precompute the
checksum on my own and feed the result to libnet_build_icmpv4_echo()?
is it possible to do it given the three payloads c, b, a without
putting them together? otherwise i should need to join them together
and then i would not even use libnet_build_data but just give the
concatenated buffer to libnet_build_icmpv4_echo(). This would slow me
down a bit, because of a double copy of data instead of the single one
that libnet_pblock_coalesce() would perform when issued by libnet_write().
please also CC me because i haven't been receiving mails from the list
for a very long time.
thank you in advance
sandr8)