aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-06 17:32:58 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-06 17:44:39 +0200
commit6949db1bd877c84b6c1bef586823b3cf922414e3 (patch)
tree698c34d59489ddca6860d31055d579990a763aef /openbsc
parent8ae0080e21b10df5be3c61b986a460b4265be3b6 (diff)
nat: Send a RLSD to the network for connections belonging to the BSC
Sending a RLSD with SCCP failure makes the MSC free all the resources (MGCP, audio channels), right now we are ignoring the RLC we get from the network and print a unhandled message.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/nat/bsc_nat.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index ded26b01d..500809c63 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -127,6 +127,32 @@ static void send_id_req(struct bsc_connection *bsc)
bsc_write(bsc, id_req, sizeof(id_req));
}
+static void nat_send_rlsd(struct sccp_connections *conn)
+{
+ struct sccp_connection_released *rel;
+ struct msgb *msg;
+
+ msg = msgb_alloc_headroom(4096, 128, "rlsd");
+ if (!msg) {
+ LOGP(DNAT, LOGL_ERROR, "Failed to allocate clear command.\n");
+ return;
+ }
+
+ msg->l2h = msgb_put(msg, sizeof(*rel));
+ rel = (struct sccp_connection_released *) msg->l2h;
+ rel->type = SCCP_MSG_TYPE_RLSD;
+ rel->release_cause = SCCP_RELEASE_CAUSE_SCCP_FAILURE;
+ rel->destination_local_reference = conn->remote_ref;
+ rel->source_local_reference = conn->patched_ref;
+
+ ipaccess_prepend_header(msg, IPAC_PROTO_SCCP);
+
+ if (write_queue_enqueue(&msc_con->write_queue, msg) != 0) {
+ LOGP(DINP, LOGL_ERROR, "Failed to enqueue the write.\n");
+ msgb_free(msg);
+ }
+}
+
static void send_mgcp_reset(struct bsc_connection *bsc)
{
static const u_int8_t mgcp_reset[] = {
@@ -354,7 +380,7 @@ static void remove_bsc_connection(struct bsc_connection *connection)
if (sccp_patch->bsc != connection)
continue;
-#warning "TODO: Send a RLSD to the MSC. Or at least a clear command."
+ nat_send_rlsd(sccp_patch);
sccp_connection_destroy(sccp_patch);
}