From 30865f583beace8fec3c1fe0adc50fe583c39ee0 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Fri, 11 Aug 2017 16:25:42 +0200 Subject: osmo-msc: point codes in human readable form use osmo_sccp_addr_name() instead of osmo_sccp_addr_dump() --- openbsc/src/libmsc/a_iface.c | 29 +++++++++++++++++++++-------- openbsc/src/libmsc/a_iface_bssap.c | 21 +++++++++++++++++---- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/openbsc/src/libmsc/a_iface.c b/openbsc/src/libmsc/a_iface.c index 09d7d1f24..93e8ab5e9 100644 --- a/openbsc/src/libmsc/a_iface.c +++ b/openbsc/src/libmsc/a_iface.c @@ -110,6 +110,7 @@ static bool check_connection_active(uint32_t conn_id) static struct a_reset_ctx *get_reset_ctx_by_sccp_addr(const struct osmo_sccp_addr *addr) { struct bsc_context *bsc_ctx; + struct osmo_ss7_instance *ss7; if (!addr) return NULL; @@ -119,8 +120,10 @@ static struct a_reset_ctx *get_reset_ctx_by_sccp_addr(const struct osmo_sccp_add return bsc_ctx->reset; } + ss7 = osmo_ss7_instance_find(gsm_network->a.cs7_instance); + OSMO_ASSERT(ss7); LOGP(DMSC, LOGL_ERROR, "The calling BSC (%s) is unknown to this MSC ...\n", - osmo_sccp_addr_dump(addr)); + osmo_sccp_addr_name(ss7, addr)); return NULL; } @@ -195,6 +198,7 @@ int a_iface_tx_paging(const char *imsi, uint32_t tmsi, uint16_t lac) struct gsm0808_cell_id_list cil; struct msgb *msg; int page_count = 0; + struct osmo_ss7_instance *ss7; OSMO_ASSERT(imsi); @@ -202,13 +206,16 @@ int a_iface_tx_paging(const char *imsi, uint32_t tmsi, uint16_t lac) cil.id_list_lac[0] = lac; cil.id_list_len = 1; + ss7 = osmo_ss7_instance_find(gsm_network->a.cs7_instance); + OSMO_ASSERT(ss7); + /* Deliver paging request to all known BSCs */ llist_for_each_entry(bsc_ctx, &gsm_network->a.bscs, list) { if (a_reset_conn_ready(bsc_ctx->reset)) { LOGP(DMSC, LOGL_DEBUG, "Passing paging message from MSC %s to BSC %s (imsi=%s, tmsi=0x%08x, lac=%u)\n", - osmo_sccp_addr_dump(&bsc_ctx->msc_addr), - osmo_sccp_addr_dump(&bsc_ctx->bsc_addr), imsi, tmsi, lac); + osmo_sccp_addr_name(ss7, &bsc_ctx->msc_addr), + osmo_sccp_addr_name(ss7, &bsc_ctx->bsc_addr), imsi, tmsi, lac); msg = gsm0808_create_paging(imsi, &tmsi, &cil, NULL); osmo_sccp_tx_unitdata_msg(bsc_ctx->sccp_user, &bsc_ctx->msc_addr, &bsc_ctx->bsc_addr, msg); @@ -216,8 +223,8 @@ int a_iface_tx_paging(const char *imsi, uint32_t tmsi, uint16_t lac) } else { LOGP(DMSC, LOGL_DEBUG, "Connection down, dropping paging from MSC %s to BSC %s (imsi=%s, tmsi=0x%08x, lac=%u)\n", - osmo_sccp_addr_dump(&bsc_ctx->msc_addr), - osmo_sccp_addr_dump(&bsc_ctx->bsc_addr), imsi, tmsi, lac); + osmo_sccp_addr_name(ss7, &bsc_ctx->msc_addr), + osmo_sccp_addr_name(ss7, &bsc_ctx->bsc_addr), imsi, tmsi, lac); } } @@ -421,6 +428,7 @@ static void a_reset_cb(const void *priv) { struct msgb *msg; struct bsc_context *bsc_ctx = (struct bsc_context*) priv; + struct osmo_ss7_instance *ss7; /* Skip if the A interface is not properly initalized yet */ if (!gsm_network) @@ -430,7 +438,9 @@ static void a_reset_cb(const void *priv) a_clear_all(bsc_ctx->sccp_user, &bsc_ctx->bsc_addr); /* Send reset to the remote BSC */ - LOGP(DMSC, LOGL_NOTICE, "Sending RESET to BSC %s\n", osmo_sccp_addr_dump(&bsc_ctx->bsc_addr)); + ss7 = osmo_ss7_instance_find(gsm_network->a.cs7_instance); + OSMO_ASSERT(ss7); + LOGP(DMSC, LOGL_NOTICE, "Sending RESET to BSC %s\n", osmo_sccp_addr_name(ss7, &bsc_ctx->bsc_addr)); msg = gsm0808_create_reset(); osmo_sccp_tx_unitdata_msg(bsc_ctx->sccp_user, &bsc_ctx->msc_addr, &bsc_ctx->bsc_addr, msg); @@ -441,6 +451,7 @@ static void add_bsc(const struct osmo_sccp_addr *msc_addr, const struct osmo_scc struct osmo_sccp_user *scu) { struct bsc_context *bsc_ctx; + struct osmo_ss7_instance *ss7; OSMO_ASSERT(bsc_addr); OSMO_ASSERT(msc_addr); @@ -450,7 +461,9 @@ static void add_bsc(const struct osmo_sccp_addr *msc_addr, const struct osmo_scc if (get_reset_ctx_by_sccp_addr(bsc_addr)) return; - LOGP(DMSC, LOGL_NOTICE, "Adding new BSC connection for BSC %s...\n", osmo_sccp_addr_dump(bsc_addr)); + ss7 = osmo_ss7_instance_find(gsm_network->a.cs7_instance); + OSMO_ASSERT(ss7); + LOGP(DMSC, LOGL_NOTICE, "Adding new BSC connection for BSC %s...\n", osmo_sccp_addr_name(ss7, bsc_addr)); /* Generate and fill up a new bsc context */ bsc_ctx = talloc_zero(gsm_network, struct bsc_context); @@ -461,7 +474,7 @@ static void add_bsc(const struct osmo_sccp_addr *msc_addr, const struct osmo_scc llist_add_tail(&bsc_ctx->list, &gsm_network->a.bscs); /* Start reset procedure to make the new connection active */ - bsc_ctx->reset = a_reset_alloc(bsc_ctx, osmo_sccp_addr_dump(bsc_addr), a_reset_cb, bsc_ctx); + bsc_ctx->reset = a_reset_alloc(bsc_ctx, osmo_sccp_addr_name(ss7, bsc_addr), a_reset_cb, bsc_ctx); } /* Callback function, called by the SSCP stack when data arrives */ diff --git a/openbsc/src/libmsc/a_iface_bssap.c b/openbsc/src/libmsc/a_iface_bssap.c index ac409408c..561ccdeb0 100644 --- a/openbsc/src/libmsc/a_iface_bssap.c +++ b/openbsc/src/libmsc/a_iface_bssap.c @@ -100,7 +100,14 @@ static struct gsm_subscriber_connection *subscr_conn_lookup_a(const struct gsm_n /* Endpoint to handle BSSMAP reset */ static void bssmap_rx_reset(struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { - LOGP(DMSC, LOGL_NOTICE, "Rx RESET from BSC %s, sending RESET ACK\n", osmo_sccp_addr_dump(a_conn_info->bsc_addr)); + struct gsm_network *network = a_conn_info->network; + struct osmo_ss7_instance *ss7; + + ss7 = osmo_ss7_instance_find(network->a.cs7_instance); + OSMO_ASSERT(ss7); + + LOGP(DMSC, LOGL_NOTICE, "Rx RESET from BSC %s, sending RESET ACK\n", + osmo_sccp_addr_name(ss7, a_conn_info->bsc_addr)); osmo_sccp_tx_unitdata_msg(scu, a_conn_info->msc_addr, a_conn_info->bsc_addr, gsm0808_create_reset_ack()); /* Make sure all orphand subscriber connections will be cleard */ @@ -113,14 +120,20 @@ static void bssmap_rx_reset(struct osmo_sccp_user *scu, const struct a_conn_info static void bssmap_rx_reset_ack(const struct osmo_sccp_user *scu, const struct a_conn_info *a_conn_info, struct msgb *msg) { + + struct gsm_network *network = a_conn_info->network; + struct osmo_ss7_instance *ss7; + + ss7 = osmo_ss7_instance_find(network->a.cs7_instance); + OSMO_ASSERT(ss7); + if (a_conn_info->reset == NULL) { LOGP(DMSC, LOGL_ERROR, "Received RESET ACK from an unknown BSC %s, ignoring...\n", - osmo_sccp_addr_dump(a_conn_info->bsc_addr)); + osmo_sccp_addr_name(ss7, a_conn_info->bsc_addr)); goto fail; } - LOGP(DMSC, LOGL_NOTICE, "Received RESET ACK from BSC %s\n", - osmo_sccp_addr_dump(a_conn_info->bsc_addr)); + LOGP(DMSC, LOGL_NOTICE, "Received RESET ACK from BSC %s\n", osmo_sccp_addr_name(ss7, a_conn_info->bsc_addr)); /* Confirm that we managed to get the reset ack message * towards the connection reset logic */ -- cgit v1.2.3