[MERGED] osmo-msc[master]: libmsc: Fix wrong handling of user_message_reference parameter

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sun Aug 27 00:34:47 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: libmsc: Fix wrong handling of user_message_reference parameter
......................................................................


libmsc: Fix wrong handling of user_message_reference parameter

libsmpp34 already converts received TLV integer values to native
endianess in libsmpp34_(un)pack.

Converting them again at receive time swaps the 2 bytes of
user_message_reference, then using a wrong value. As GSM03.40 spec
uses only 1 byte for the id, then only the high byte of the initial
value is used and eventually sent back to the ESME. Again, at that time,
htons() is not needed because libsmpp34 already handles that part.

See OS-#2429 for more details.

Change-Id: If748548a4a223e529a1110c89e483b599b406e8b
---
M src/libmsc/smpp_openbsc.c
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Neels Hofmeyr: Looks good to me, approved



diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index ec14898..431cb4d 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -121,7 +121,7 @@
 			}
 			break;
 		case TLVID_user_message_reference:
-			msg_ref = ntohs(t->value.val16);
+			msg_ref = t->value.val16;
 			break;
 		default:
 			break;
@@ -437,7 +437,7 @@
 	memset(&tlv, 0, sizeof(tlv));
 	tlv.tag = tag;
 	tlv.length = 2;
-	tlv.value.val16 = htons(val);
+	tlv.value.val16 = val;
 	build_tlv(req_tlv, &tlv);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/3669
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If748548a4a223e529a1110c89e483b599b406e8b
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list