Re: [PATCH] AT2 module UDH decoding
Stipe Tolj <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | tolj.org system architecture |
| Message-ID | <[email protected]> |
Paul Bagyenda wrote:
> Hi people,
>
> Just came across a small discrepancy between how the SMPP module
> decodes MO SMS UDH and how the AT2 module does the same. (To be
> precise, somebody was testing the incoming concatenation patch I posted
> earlier, and tripped on this.)
>
> The short story is that the SMPP module includes the header length in
> the decoded UDH, while the AT2 module does not. The fix is a one- liner
> (not the cleanest I admit, but it works). Attached.
Hi Paul,
yep, confirmed... so this means:
smsc_at.c - decodes PDU into msg struct with pure UDH data in msg->sms.udhdata:
[...]
/* if there is a UDH */
udhlen = 0;
if (udhi && len > 0) {
udhlen = octstr_get_char(pdu, pos);
pos++;
if (udhlen + 1 > len)
goto msg_error;
udh = octstr_copy(pdu, pos, udhlen);
pos += udhlen;
len -= udhlen + 1;
} else if (len <= 0) /* len < 0 is impossible, but sure is sure */
udhi = 0;
[...]
smsc_smpp.c: - decodes PDU into msg struct with lengh byte in front:
[...]
/*
* Encode udh if udhi set
* for reference see GSM03.40, section 9.2.3.24
*/
if (pdu->u.deliver_sm.esm_class & ESM_CLASS_SUBMIT_UDH_INDICATOR) {
int udhl;
udhl = octstr_get_char(msg->sms.msgdata, 0) + 1;
debug("bb.sms.smpp",0,"SMPP[%s]: UDH length read as %d",
octstr_get_cstr(smpp->conn->id), udhl);
if (udhl > octstr_len(msg->sms.msgdata)) {
error(0, "SMPP[%s]: Mallformed UDH length indicator 0x%03x while
message length "
"0x%03lx. Discarding MO message.",
octstr_get_cstr(smpp->conn->id),
udhl, octstr_len(msg->sms.msgdata));
*reason = SMPP_ESME_RINVESMCLASS;
goto error;
}
msg->sms.udhdata = octstr_copy(msg->sms.msgdata, 0, udhl);
octstr_delete(msg->sms.msgdata, 0, udhl);
}
[...]
Now, at least I totally agree that we need to change something here, since the
modules act different, and we expect the msg->sms.udhdata to have the same value
regardless which "smsc type" it used.
So votes please if we should add the length byte in udhdata or not.
I'm +0 on adding the length byte in smsc_at.c code, hence applying Paul's patch.
Stipe
-------------------------------------------------------------------
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany
tolj.org system architecture Kannel Software Foundation (KSF)
http://www.tolj.org/ http://www.kannel.org/
mailto:st_{at}_tolj.org mailto:stolj_{at}_kannel.org
-------------------------------------------------------------------