aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-02-08 21:46:45 +0100
committerHarald Welte <laforge@gnumonks.org>2019-02-09 09:08:22 +0100
commit893e499e0c66afbaabd9e027506a775b8e76be0c (patch)
treef0503897d4a71b9a7d50ff18577137d391d3f97b
parent3c89e2c36a4c2fe16c569851464533df791cf8f5 (diff)
OML: Return attributes in ACK/NACK messages
As per 3GPP TS 12.21 Section 8.2 "ACK messages shall return all the attributes in the original message". OsmoBTS fails to do so but simply sends no attributes at all in the ACK. TS 12.21 is a bit vague whether or not the attributes shall also be achoed in the NACK. Let's do it and append the CAUSE in this case. Closes: OS#3788 Change-Id: Ifb305fe75f8305bb04872f26492b8b1bb8c27f49
-rw-r--r--src/common/oml.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/common/oml.c b/src/common/oml.c
index ce598651..6952d75c 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -425,26 +425,19 @@ int oml_mo_opstart_nack(struct gsm_abis_mo *mo, uint8_t nack_cause)
* contained in 'msg'. ACK is sent if cause == 0; NACK otherwise */
int oml_fom_ack_nack(struct msgb *old_msg, uint8_t cause)
{
- struct abis_om_hdr *old_oh = msgb_l2(old_msg);
- struct abis_om_fom_hdr *old_foh = msgb_l3(old_msg);
struct msgb *msg;
struct abis_om_fom_hdr *foh;
- int is_manuf = 0;
- msg = oml_msgb_alloc();
+ msg = msgb_copy(old_msg, "OML_fom_ack_nack");
if (!msg)
return -ENOMEM;
- /* make sure to respond with MANUF if request was MANUF */
- if (old_oh->mdisc == ABIS_OM_MDISC_MANUF)
- is_manuf = 1;
+ /* remove any l2/l1 that may be present in copy */
+ msgb_pull_to_l2(msg);
msg->trx = old_msg->trx;
- /* copy over old FOM-Header and later only change the msg_type */
- msg->l3h = msgb_push(msg, sizeof(*foh));
foh = (struct abis_om_fom_hdr *) msg->l3h;
- memcpy(foh, old_foh, sizeof(*foh));
/* alter message type */
if (cause) {
@@ -453,12 +446,16 @@ int oml_fom_ack_nack(struct msgb *old_msg, uint8_t cause)
foh->msg_type += 2; /* nack */
/* add cause */
msgb_tv_put(msg, NM_ATT_NACK_CAUSES, cause);
+ /* update the length as we just made the message larger */
+ struct abis_om_hdr *omh = (struct abis_om_hdr *) msgb_l2(msg);
+ omh->length = msgb_l3len(msg);
} else {
LOGP(DOML, LOGL_DEBUG, "Sending FOM ACK.\n");
foh->msg_type++; /* ack */
}
- return oml_send_msg(msg, is_manuf);
+ /* we cannot use oml_send_msg() as we already have the OML header */
+ return abis_oml_sendmsg(msg);
}
/*