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.
This commit is contained in:
Holger Hans Peter Freyther 2010-09-16 06:41:09 +08:00
parent 4fcce9ea19
commit eea5a1bcd6
1 changed files with 2 additions and 1 deletions

View File

@ -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);
}