Ethereal-dev: [Ethereal-dev] packet-gsm_sms.c : fixed positions for TP-RP, TP-UDHI, TP-SRR/SR
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Viorel Suman <vsuman@xxxxxxxx>
Date: Wed, 8 Dec 2004 17:56:31 +0200 (EET)
Hello, Attached is a "packet-gsm_sms.c" dissector patch, which fixseveral bugs desribed below. Looking for feedback, comments and suggestions. I suppose it should be checked in.
Bug 1 : ------- Wrong positions of the fields, located within the first octet of the GSM SMS TPDU. According to GSM 03.40 spec these fields have a well defined position in the first byte : 1. TP-RP (Reply Path) field is allways located within bit no 7 of the first octet. 2. TP-UDHI field - located within bit no 6. 3. TP-SRR/SRI/SRQ - located within bit no 5. 4. TP-VPF - located within bits no 3-4. 5. TP-MMS and TP-RD - located within bit no 2. 6. TP-MTI - located within bits no 0-1. Bug 2 : ------- One byte is skipped during RP-ERROR vs. RP-ACK detecting : Offset must be increased only when RP-ERROR is detected in order to avoid one byte skipping. Bug 3 : ------- The improper dissect method is used to dissect SMS-DELIVER-REPORT. pinfo->p2p_dir values may be : a) P2P_DIR_RECV is set for SMS-SUBMIT b) P2P_DIR_SENT is set for SMS-DELIVER c) P2P_DIR_UNKNOWN is set for any SMS-SUBMIT/DELIVER-REPORT Having P2P_DIR_UNKNOWN set for SMS-DELIVER-REPORT the "dis_msg_deliver" is used (which is the BUG) instead of the "dis_msg_deliver_report". Thank you, Viorel Suman Software Developer Avalanche Mobile NV (http://www.avmob.com) Busitel 1, Orlyplein 85 1043 DS Amsterdam The Netherlands Phone: +31 (0) 20 403 74 70 Fax: +31 (0) 20 403 73 10
--- ethereal-0.10.7-original/epan/dissectors/packet-gsm_sms.c 2004-10-21 01:34:59.000000000 +0300 +++ ethereal-0.10.7/epan/dissectors/packet-gsm_sms.c 2004-12-08 16:48:34.198095736 +0200 @@ -1952,11 +1952,11 @@ oct = tvb_get_guint8(tvb, offset); - DIS_FIELD_SRI(tree, 0x20, offset); + DIS_FIELD_RP(tree, 0x80, offset); - DIS_FIELD_UDHI(tree, 0x10, offset, udhi); + DIS_FIELD_UDHI(tree, 0x40, offset, udhi); - DIS_FIELD_RP(tree, 0x08, offset); + DIS_FIELD_SRI(tree, 0x20, offset); DIS_FIELD_MMS(tree, 0x04, offset); @@ -2017,7 +2017,7 @@ oct = tvb_get_guint8(tvb, offset); - DIS_FIELD_UDHI(tree, 0x04, offset, udhi); + DIS_FIELD_UDHI(tree, 0x40, offset, udhi); DIS_FIELD_MTI(tree, 0x03, offset); @@ -2046,9 +2046,9 @@ if (oct & 0x80) { dis_field_fcs(tvb, tree, offset, oct); + offset++; } - offset++; pi = tvb_get_guint8(tvb, offset); dis_field_pi(tvb, tree, offset, pi); @@ -2136,11 +2136,11 @@ oct = tvb_get_guint8(tvb, offset); - DIS_FIELD_SRR(tree, 0x80, offset); + DIS_FIELD_RP(tree, 0x80, offset); DIS_FIELD_UDHI(tree, 0x40, offset, udhi); - DIS_FIELD_RP(tree, 0x20, offset); + DIS_FIELD_SRR(tree, 0x20, offset); DIS_FIELD_VPF(tree, 0x18, offset, &vp_form); @@ -2208,7 +2208,7 @@ oct = tvb_get_guint8(tvb, offset); - DIS_FIELD_UDHI(tree, 0x04, offset, udhi); + DIS_FIELD_UDHI(tree, 0x40, offset, udhi); DIS_FIELD_MTI(tree, 0x03, offset); @@ -2229,9 +2229,9 @@ if (oct & 0x80) { dis_field_fcs(tvb, tree, offset, oct); + offset++; } - offset++; pi = tvb_get_guint8(tvb, offset); dis_field_pi(tvb, tree, offset, pi); @@ -2306,11 +2306,11 @@ oct = tvb_get_guint8(tvb, offset); - DIS_FIELD_SRQ(tree, 0x10, offset); + DIS_FIELD_UDHI(tree, 0x40, offset, udhi); - DIS_FIELD_MMS(tree, 0x08, offset); + DIS_FIELD_SRQ(tree, 0x20, offset); - DIS_FIELD_UDHI(tree, 0x04, offset, udhi); + DIS_FIELD_MMS(tree, 0x04, offset); DIS_FIELD_MTI(tree, 0x03, offset); @@ -2415,7 +2415,7 @@ oct = tvb_get_guint8(tvb, offset); - DIS_FIELD_SRR(tree, 0x08, offset); + DIS_FIELD_SRR(tree, 0x20, offset); DIS_FIELD_UDHI(tree, 0x04, offset, udhi); @@ -2514,7 +2514,18 @@ /* * convert the 2 bit value to one based on direction */ - msg_type |= ((pinfo->p2p_dir == P2P_DIR_RECV) ? 0x04 : 0x00); + if (pinfo->p2p_dir == P2P_DIR_UNKNOWN) + { + // Return Result ... + if (msg_type == 0) // SMS-DELIVER + { + msg_type |= 0x04; // see the msg_type_strings + } + } + else + { + msg_type |= ((pinfo->p2p_dir == P2P_DIR_RECV) ? 0x04 : 0x00); + } str = my_match_strval(msg_type, msg_type_strings, &idx);
- Prev by Date: [Ethereal-dev] Frame Number
- Next by Date: [Ethereal-dev] Need pointers on writing dissector with packet reassembly
- Previous by thread: Re: [Ethereal-dev] Frame Number
- Next by thread: [Ethereal-dev] Need pointers on writing dissector with packet reassembly
- Index(es):