From 4c683d1215939ee8850f95160f973831e56c8310 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 23 Apr 2010 14:13:27 +0800 Subject: [PATCH] nat: Only close connections that were fully connected Remember that we have seen a CC and have a valid destination local reference now and only send a fake RLC to the MSC when we had connections in this state. --- openbsc/include/openbsc/bsc_nat.h | 1 + openbsc/src/nat/bsc_nat.c | 3 ++- openbsc/src/nat/bsc_sccp.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 4d90ed744..90c263d24 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -110,6 +110,7 @@ struct sccp_connections { struct sccp_source_reference real_ref; struct sccp_source_reference patched_ref; struct sccp_source_reference remote_ref; + int has_remote_ref; /* GSM audio handling. That is 32 * multiplex + ts */ int crcx; diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c index d5ed7515b..52844276c 100644 --- a/openbsc/src/nat/bsc_nat.c +++ b/openbsc/src/nat/bsc_nat.c @@ -444,7 +444,8 @@ static void remove_bsc_connection(struct bsc_connection *connection) if (sccp_patch->bsc != connection) continue; - nat_send_rlsd(sccp_patch); + if (sccp_patch->has_remote_ref) + nat_send_rlsd(sccp_patch); sccp_connection_destroy(sccp_patch); } diff --git a/openbsc/src/nat/bsc_sccp.c b/openbsc/src/nat/bsc_sccp.c index c422cc58c..344953167 100644 --- a/openbsc/src/nat/bsc_sccp.c +++ b/openbsc/src/nat/bsc_sccp.c @@ -141,6 +141,7 @@ int update_sccp_src_ref(struct sccp_connections *sccp, struct bsc_nat_parsed *pa } sccp->remote_ref = *parsed->src_local_ref; + sccp->has_remote_ref = 1; LOGP(DNAT, LOGL_DEBUG, "Updating 0x%x to remote 0x%x on %p\n", sccp_src_ref_to_int(&sccp->patched_ref), sccp_src_ref_to_int(&sccp->remote_ref), sccp->bsc);