From eea5a1bcd6f520a2a01544e25417bf54e4c50d70 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 16 Sep 2010 06:41:09 +0800 Subject: nat: Fix a crash when a BSC disconnects while a rejected IMSI When we reject the IMSI we do not have the msc_con set on the SCCP connection, but we do have a remote_ref. So the nat_send_rlsd will end up with a crash due the msc_con being zero. Fix the crash by only sending a released to the MSC when the connection is not local. --- openbsc/src/nat/bsc_nat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'openbsc') diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c index dde9196f3..23b811117 100644 --- a/openbsc/src/nat/bsc_nat.c +++ b/openbsc/src/nat/bsc_nat.c @@ -329,6 +329,7 @@ static void bsc_send_con_release(struct bsc_connection *bsc, struct sccp_connect queue_for_msc(con->msc_con, rlsd); } con->con_local = 1; + con->msc_con = NULL; /* 2. release the BSC side */ if (con->con_type == NAT_CON_TYPE_LU) { @@ -676,7 +677,7 @@ void bsc_close_connection(struct bsc_connection *connection) if (ctr) rate_ctr_inc(ctr); - if (sccp_patch->has_remote_ref) + if (sccp_patch->has_remote_ref && !sccp_patch->con_local) nat_send_rlsd(sccp_patch); sccp_connection_destroy(sccp_patch); } -- cgit v1.2.3