I just checked in a fix for unconditional dissection handoff.
Maybe we can add the following for reassembly documentation in case we use
non-TCP reassembly. Comments are welcome!
/* is_fragmented comes from some other part
* within the FOO protocol.
* The data to be reassembled starts at offset,
* and has length FOO_len.
*/
reassembled = FALSE;
try_reassemble = FALSE;
if (is_fragmented && tvb_bytes_exist (tvb, offset, FOO_len) {
try_reassemble = TRUE;
save_fragmented = pinfo->fragmented;
pinfo->fragmented = TRUE;
/* NOTE - Choose a reassembly function depending
* on the needs of the FOO protocol */
fd_FOO = fragment_add_seq_TYPE(...)
if (fd_FOO) {
reassembled = TRUE;
reassembled_in = fd_FOO->reassembled_in;
}
FOO_tvb = process_reassembled_data(tvb, i, pinfo,
"Reassembled Short Message", fd_FOO, &FOO_frag_items,
NULL, FOO_tree);
}
if (! FOO_tvb) {
FOO_tvb = tvb_new_subset(tvb, offset, -1, -1);
}
/* Not sure whether we still have to check that we have
* a new tvbuff_t, as this should have been dealt with
* in the previous steps. */
if (FOO_tvb) {
if (reassembled) {
if(pinfo->fd->num != reassembled_in) {
/* Reassembled, but not in this packet;
* so point to the reassembled packet */
proto_tree_add_uint(tree, hf_FOO_reassembled_in,
tvb, 0, 0, reassembled_in);
} else { /* Reassembled in this packet */
/*
* Call subdissection here!
*/
}
} else {
if (is_fragmented) {
/* Unreassembled */
proto_tree_add_text(FOO_tree, FOO_tvb, 0, -1,
"Unreassembled FOO fragment");
} else { /* Single-packet message */
/*
* Call subdissection here!
*/
}
}
}
if (try_reassemble) {
pinfo->fragmented = save_fragmented;
}
| -----Original Message-----
| From: Guy Harris
|
| On Dec 19, 2003, at 3:50 PM, Guy Harris wrote:
|
| >> | However, that means it treats the packet as reassembled and
| >> | hands it to the WSP dissector.
| >>
| >> I have noticed this; I'd need to prevent this. Does the
| "common code"
| >> provide a means of doing this?
| >
| > No. By the time "process_reassembled_data()" has been called, the
| > damage has already been done.
| >
| > That's why I said
| >
| >> | We should arrange that the aforementioned hack is
| >> | done *ONLY* for 802.11; I'll look at doing that.
| >
| > I.e., the reassembly code needs to be fixed so that the 802.11 code
| > can say "do reassembly with this hack", and reassembly for other
| > protocols using "fragment_add_seq_check()" doesn't do that hack.
|
| I've checked in a change to do that. (Yes, it's ugly, but
| then so are
| 802.11 cards that reassemble frames and supply a non-zero fragment
| number - maybe that lets them shorten the code path a little
| bit in the
| on-card firmware, but it's still ugly....)
|