Umm. I need to patch this manually.
I propose the following fix:
-----
/* Preference: reassemble SMPP segments only if this preference is set */
static gboolean reassemble_over_tcp = FALSE;
static guint
get_smpp_pdu_len(tvbuff_t *tvb, int offset)
{
return tvb_get_ntohl(tvb, offset);
}
static void
dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
if (pinfo->ptype == PT_TCP) { /* are we running on top of TCP */
tcp_dissect_pdus(tvb, pinfo, tree,
reassemble_over_tcp, /* Do we try to reassemble */
16, /* Length of fixed header */
get_smpp_pdu_len, /* Function returning PDU len */
dissect_smpp_pdu); /* PDU dissector */
} else { /* no? probably X.25 */
guint32 offset = 0;
while (tvb_reported_length_remaining(tvb, offset) > 0) {
guint16 pdu_len = tvb_get_ntohl(tvb, offset);
gint pdu_real_len = tvb_length_remaining(tvb, offset);
tvbuff_t *pdu_tvb;
if (pdu_real_len <= 0)
return;
if (pdu_real_len > pdu_len)
pdu_real_len = pdu_len;
pdu_tvb = tvb_new_subset(tvb, offset, pdu_real_len, pdu_len);
dissect_smpp_pdu(pdu_tvb, pinfo, tree);
offset += pdu_len;
}
}
}
-----
And then I remove the loop in the former dissect_smpp() method which is now
dissect_smpp_pdu(). I'll add a note in the comments that the tvb must not
contain more than one PDU.
Any comments are welcome!
Regards,
Olivier
| -----Original Message-----
| From: Chris Wilson
|
| On Sun, 18 Jan 2004 04:42:49 -0800
| Guy Harris wrote:
|
| > On Sun, Jan 18, 2004 at 12:16:23PM +0000, Chris Wilson wrote:
| > > Ok - I'll make things work that way.
| >
| > Note that if you make it use "tcp_dissect_pdus()" you'll
| get that for
| > free.
|
| Yep, it's great :)
|
| Lets have another go then, this is much nicer... Attached is
| a patch to packet-smpp.c (version 1.25 - that's before
| Olivier's last commit). It uses tcp_dissect_pdus() if it's
| running on TCP (it checks that pinfo->ptype==PT_TCP - which I
| hope is sensible!).