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/.
Holger Freyther gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/4911
mobile: Avoid msg_ref going out of sync
It seemed like msg_ref could go out of sync. In some places we are
using sms->msg_ref in other cases we pass it as parameter (e.g. when
sending the SMS) or we get it out of the gsm411_rp_hdr.
Change-Id: I4bac5f06921b5fd85a98d97770d42d4858ca1c42
---
M src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h
M src/host/layer23/src/mobile/gsm411_sms.c
2 files changed, 6 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/11/4911/1
diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h b/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h
index a94d1aa..0d0578a 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/gsm411_sms.h
@@ -11,7 +11,6 @@
uint8_t ud_hdr_ind;
uint8_t protocol_id;
uint8_t data_coding_scheme;
- uint8_t msg_ref;
char address[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes
* BCD == 20 bytes string */
time_t time;
diff --git a/src/host/layer23/src/mobile/gsm411_sms.c b/src/host/layer23/src/mobile/gsm411_sms.c
index c4d2512..73fad84 100644
--- a/src/host/layer23/src/mobile/gsm411_sms.c
+++ b/src/host/layer23/src/mobile/gsm411_sms.c
@@ -221,7 +221,7 @@
/* process an incoming TPDU (called from RP-DATA)
* return value > 0: RP CAUSE for ERROR; < 0: silent error; 0 = success */
-static int gsm340_rx_tpdu(struct gsm_trans *trans, struct msgb *msg)
+static int gsm340_rx_tpdu(struct gsm_trans *trans, struct msgb *msg, uint8_t msg_ref)
{
uint8_t *smsp = msgb_sms(msg);
struct gsm_sms *gsms;
@@ -296,7 +296,7 @@
LOGP(DLSMS, LOGL_INFO, "RX SMS: MTI: 0x%02x, "
"MR: 0x%02x PID: 0x%02x, DCS: 0x%02x, OA: %s, "
"UserDataLength: 0x%02x, UserData: \"%s\"\n",
- sms_mti, gsms->msg_ref,
+ sms_mti, msg_ref,
gsms->protocol_id, gsms->data_coding_scheme, gsms->address,
gsms->user_data_len,
sms_alphabet == DCS_7BIT_DEFAULT ? gsms->text :
@@ -377,7 +377,7 @@
LOGP(DLSMS, LOGL_INFO, "TPDU(%li,%s)\n", msg->tail-msg->l4h,
osmo_hexdump(msg->l4h, msg->tail-msg->l4h));
- rc = gsm340_rx_tpdu(trans, msg);
+ rc = gsm340_rx_tpdu(trans, msg, rph->msg_ref);
if (rc == 0)
return gsm411_send_rp_ack(trans, rph->msg_ref);
else if (rc > 0)
@@ -528,7 +528,7 @@
/* generate a msgb containing a TPDU derived from struct gsm_sms,
* returns total size of TPDU */
-static int gsm340_gen_tpdu(struct msgb *msg, struct gsm_sms *sms)
+static int gsm340_gen_tpdu(struct msgb *msg, struct gsm_sms *sms, uint8_t msg_ref)
{
uint8_t *smsp;
uint8_t da[12]; /* max len per 03.40 */
@@ -559,7 +559,7 @@
/* generate message ref */
smsp = msgb_put(msg, 1);
- *smsp = sms->msg_ref;
+ *smsp = msg_ref;
/* generate destination address */
if (sms->address[0] == '+')
@@ -688,7 +688,7 @@
rp_ud_len = (uint8_t *)msgb_put(msg, 1);
/* generate the 03.40 TPDU */
- rc = gsm340_gen_tpdu(msg, sms);
+ rc = gsm340_gen_tpdu(msg, sms, msg_ref);
if (rc < 0)
goto error;
*rp_ud_len = rc;
--
To view, visit https://gerrit.osmocom.org/4911
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4bac5f06921b5fd85a98d97770d42d4858ca1c42
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <holger at freyther.de>