aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-27 11:58:04 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-27 12:02:21 +0200
commita8a50a87ea361265b1a212ff5e789975c32a157d (patch)
tree07a5ec7d74f48316992261e87ef614a19fdd0b97
parent54f5352e0777c6407b47b5d7f9ab366f66179e48 (diff)
nat: Also send a Clear Command in case of the USSD Provider dies
-rw-r--r--openbsc/src/nat/bsc_nat.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c
index e1d2f3219..a428e823d 100644
--- a/openbsc/src/nat/bsc_nat.c
+++ b/openbsc/src/nat/bsc_nat.c
@@ -252,6 +252,28 @@ static void nat_send_rlsd_bsc(struct sccp_connections *conn)
bsc_write(conn->bsc, msg, IPAC_PROTO_SCCP);
}
+static void nat_send_clrc_bsc(struct sccp_connections *conn)
+{
+ struct msgb *msg;
+ struct msgb *sccp;
+
+ msg = gsm0808_create_clear_command(0x20);
+ if (!msg) {
+ LOGP(DNAT, LOGL_ERROR, "Failed to allocate clear command.\n");
+ return;
+ }
+
+ sccp = sccp_create_dt1(&conn->real_ref, msg->data, msg->len);
+ if (!sccp) {
+ LOGP(DNAT, LOGL_ERROR, "Failed to allocate SCCP msg.\n");
+ msgb_free(msg);
+ return;
+ }
+
+ msgb_free(msg);
+ bsc_write(conn->bsc, sccp, IPAC_PROTO_SCCP);
+}
+
static void nat_send_rlc(struct bsc_msc_connection *msc_con,
struct sccp_source_reference *src,
struct sccp_source_reference *dst)
@@ -1339,6 +1361,7 @@ int bsc_close_ussd_connections(struct bsc_nat *nat)
if (!con->bsc)
continue;
+ nat_send_clrc_bsc(con);
nat_send_rlsd_bsc(con);
}