diff options
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/include/openbsc/bsc_nat.h | 1 | ||||
-rw-r--r-- | openbsc/src/nat/bsc_nat.c | 3 | ||||
-rw-r--r-- | openbsc/src/nat/bsc_nat_utils.c | 11 | ||||
-rw-r--r-- | openbsc/src/nat/bsc_sccp.c | 6 |
4 files changed, 14 insertions, 7 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index f3548426a..bdea43492 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -139,6 +139,7 @@ struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num); struct bsc_nat *bsc_nat_alloc(void); struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat); +void sccp_connection_destroy(struct sccp_connections *); /** * parse the given message into the above structure diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c index 7d9cd899e..c7c6c4135 100644 --- a/openbsc/src/nat/bsc_nat.c +++ b/openbsc/src/nat/bsc_nat.c @@ -334,8 +334,7 @@ static void remove_bsc_connection(struct bsc_connection *connection) continue; #warning "TODO: Send a RLSD to the MSC. Or at least a clear command." - llist_del(&sccp_patch->list_entry); - talloc_free(sccp_patch); + sccp_connection_destroy(sccp_patch); } talloc_free(connection); diff --git a/openbsc/src/nat/bsc_nat_utils.c b/openbsc/src/nat/bsc_nat_utils.c index bbbc6e2aa..3e44193a6 100644 --- a/openbsc/src/nat/bsc_nat_utils.c +++ b/openbsc/src/nat/bsc_nat_utils.c @@ -30,6 +30,8 @@ #include <osmocore/linuxlist.h> #include <osmocore/talloc.h> +#include <sccp/sccp.h> + #include <netinet/in.h> #include <arpa/inet.h> @@ -72,6 +74,15 @@ struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token, unsi return conf; } +void sccp_connection_destroy(struct sccp_connections *conn) +{ + LOGP(DNAT, LOGL_DEBUG, "Destroy 0x%x <-> 0x%x mapping for con %p\n", + sccp_src_ref_to_int(&conn->real_ref), + sccp_src_ref_to_int(&conn->patched_ref), conn->bsc); + llist_del(&conn->list_entry); + talloc_free(conn); +} + struct bsc_connection *bsc_nat_find_bsc(struct bsc_nat *nat, struct msgb *msg) { struct bsc_connection *bsc; diff --git a/openbsc/src/nat/bsc_sccp.c b/openbsc/src/nat/bsc_sccp.c index 5f0809d77..40676b37c 100644 --- a/openbsc/src/nat/bsc_sccp.c +++ b/openbsc/src/nat/bsc_sccp.c @@ -135,11 +135,7 @@ void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bs if (bsc != conn->bsc) continue; - LOGP(DNAT, LOGL_DEBUG, "Destroy 0x%x <-> 0x%x mapping for con %p\n", - sccp_src_ref_to_int(&conn->real_ref), - sccp_src_ref_to_int(&conn->patched_ref), bsc); - llist_del(&conn->list_entry); - talloc_free(conn); + sccp_connection_destroy(conn); return; } } |