diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-03-30 10:45:48 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-03-30 10:45:48 +0200 |
commit | 22252a98e3a2c094edb9d179db8eddede517e339 (patch) | |
tree | 2353f1c4b628b1dc3b19f52c2a56ba5a70f791d2 /openbsc | |
parent | 957bc93244224124a1fa5576c94953ae09bc984d (diff) |
sccp: Move the destruction of the sccp connection to a new place
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 338b15c40..4ad6b1abf 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 936026041..08e9e8f8b 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 2a9d8411f..995983f91 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; } } |