From d27c1186fe8f6786bb41de6888f23fa34d8f7705 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 20 Aug 2018 12:37:38 +0200 Subject: debug fu Change-Id: I97190e5f8d4ab2f4b4ae8ff8d9359ddae39b9645 --- src/ipa.c | 8 +++++--- src/sccp_scoc.c | 61 ++++++++++++++++++++++++++++++++++----------------------- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/src/ipa.c b/src/ipa.c index 5e49034..0a40470 100644 --- a/src/ipa.c +++ b/src/ipa.c @@ -262,11 +262,10 @@ static int ipa_rx_msg_sccp(struct osmo_ss7_asp *asp, struct msgb *msg) opc = as->cfg.pc_override.dpc; /* Destination: PC of the routing key */ dpc = as->cfg.routing_key.pc; - - LOGPASP(asp, DLSS7, LOGL_INFO, "Rx message: setting opc=%u dpc=%u\n", - opc, dpc); } + LOGPASP(asp, DLSS7, LOGL_INFO, "Rx message: opc=%u dpc=%u\n", + opc, dpc); /* Second, patch this into the SCCP message */ if (as->cfg.pc_override.sccp_mode == OSMO_SS7_PATCH_BOTH) { msg = patch_sccp_with_pc(asp, msg, &opc, &dpc); @@ -275,12 +274,15 @@ static int ipa_rx_msg_sccp(struct osmo_ss7_asp *asp, struct msgb *msg) return -1; } } + LOGPASP(asp, DLSS7, LOGL_INFO, "Rx message (2): opc=%u dpc=%u\n", + opc, dpc); /* Third, create a MTP3/M3UA label with those point codes */ memset(&data_hdr, 0, sizeof(data_hdr)); data_hdr.si = MTP_SI_SCCP; data_hdr.opc = osmo_htonl(opc); data_hdr.dpc = osmo_htonl(dpc); + LOGPASP(asp, DLSS7, LOGL_INFO, "XXXXX %s %u %u\n", __func__, opc, dpc); /* Create M3UA message in XUA structure */ xua = m3ua_xfer_from_data(&data_hdr, msgb_l2(msg), msgb_l2len(msg)); msgb_free(msg); diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c index 7570764..dfd7d54 100644 --- a/src/sccp_scoc.c +++ b/src/sccp_scoc.c @@ -56,7 +56,7 @@ #include #include -#include +#include #include "xua_internal.h" #include "sccp_internal.h" @@ -168,31 +168,31 @@ enum sccp_scoc_event { static const struct value_string scoc_event_names[] = { /* Primitives from SCCP-User */ - { SCOC_E_SCU_N_CONN_REQ, "N-CONNECT.req" }, - { SCOC_E_SCU_N_CONN_RESP, "N-CONNECT.resp" }, - { SCOC_E_SCU_N_DISC_REQ, "N-DISCONNECT.req" }, - { SCOC_E_SCU_N_DATA_REQ, "N-DATA.req" }, - { SCOC_E_SCU_N_EXP_DATA_REQ, "N-EXPEDITED_DATA.req" }, + OSMO_VALUE_STRING( SCOC_E_SCU_N_CONN_REQ), + OSMO_VALUE_STRING( SCOC_E_SCU_N_CONN_RESP), + OSMO_VALUE_STRING( SCOC_E_SCU_N_DISC_REQ), + OSMO_VALUE_STRING( SCOC_E_SCU_N_DATA_REQ), + OSMO_VALUE_STRING( SCOC_E_SCU_N_EXP_DATA_REQ), /* Events from RCOC (Routing for Connection Oriented) */ - { SCOC_E_RCOC_CONN_IND, "RCOC-CONNECT.ind" }, - { SCOC_E_RCOC_ROUT_FAIL_IND, "RCOC-ROUT_FAIL.ind" }, - { SCOC_E_RCOC_RLSD_IND, "RCOC-RELEASED.ind" }, - { SCOC_E_RCOC_REL_COMPL_IND, "RCOC-RELEASE_COMPLETE.ind" }, - { SCOC_E_RCOC_CREF_IND, "RCOC-CONNECT_REFUSED.ind" }, - { SCOC_E_RCOC_CC_IND, "RCOC-CONNECT_CONFIRM.ind" }, - { SCOC_E_RCOC_DT1_IND, "RCOC-DT1.ind" }, - { SCOC_E_RCOC_DT2_IND, "RCOC-DT2.ind" }, - { SCOC_E_RCOC_IT_IND, "RCOC-IT.ind" }, - { SCOC_E_RCOC_OTHER_NPDU, "RCOC-OTHER_NPDU.ind" }, - { SCOC_E_RCOC_ERROR_IND, "RCOC-ERROR.ind" }, - - { SCOC_E_T_IAR_EXP, "T(iar)_expired" }, - { SCOC_E_T_IAS_EXP, "T(ias)_expired" }, - { SCOC_E_CONN_TMR_EXP, "T(conn)_expired" }, - { SCOC_E_T_REL_EXP, "T(rel)_expired" }, - { SCOC_E_T_INT_EXP, "T(int)_expired" }, - { SCOC_E_T_REP_REL_EXP, "T(rep_rel)_expired" }, + OSMO_VALUE_STRING( SCOC_E_RCOC_CONN_IND), + OSMO_VALUE_STRING( SCOC_E_RCOC_ROUT_FAIL_IND), + OSMO_VALUE_STRING( SCOC_E_RCOC_RLSD_IND), + OSMO_VALUE_STRING( SCOC_E_RCOC_REL_COMPL_IND), + OSMO_VALUE_STRING( SCOC_E_RCOC_CREF_IND), + OSMO_VALUE_STRING( SCOC_E_RCOC_CC_IND), + OSMO_VALUE_STRING( SCOC_E_RCOC_DT1_IND), + OSMO_VALUE_STRING( SCOC_E_RCOC_DT2_IND), + OSMO_VALUE_STRING( SCOC_E_RCOC_IT_IND), + OSMO_VALUE_STRING( SCOC_E_RCOC_OTHER_NPDU), + OSMO_VALUE_STRING( SCOC_E_RCOC_ERROR_IND), + + OSMO_VALUE_STRING( SCOC_E_T_IAR_EXP), + OSMO_VALUE_STRING( SCOC_E_T_IAS_EXP), + OSMO_VALUE_STRING( SCOC_E_CONN_TMR_EXP), + OSMO_VALUE_STRING( SCOC_E_T_REL_EXP), + OSMO_VALUE_STRING( SCOC_E_T_INT_EXP), + OSMO_VALUE_STRING( SCOC_E_T_REP_REL_EXP), { 0, NULL } }; @@ -696,6 +696,8 @@ static int xua_gen_encode_and_send(struct sccp_connection *conn, uint32_t event, /* amend this with point code information; Many CO msgs * includes neither called nor calling party address! */ + LOGP(DLSCCP, LOGL_ERROR, "XXXXX %s conn->remote_pc %u %p %u\n", + __func__, conn->remote_pc, conn, conn->conn_id); xua->mtp.dpc = conn->remote_pc; sccp_scrc_rx_scoc_conn_msg(conn->inst, xua); xua_msg_free(xua); @@ -820,6 +822,12 @@ static void scoc_fsm_idle(struct osmo_fsm_inst *fi, uint32_t event, void *data) uconp = &prim->u.connect; /* copy relevant parameters from prim to conn */ conn->called_addr = uconp->called_addr; + if (conn->called_addr.presence & OSMO_SCCP_ADDR_T_PC) + conn->remote_pc = conn->called_addr.pc; + LOGP(DLSCCP, LOGL_NOTICE, + "XXXXX SCOC_E_SCU_N_CONN_REQ conn->called_addr=%s conn->remote_pc=%u %p %u\n", + osmo_sccp_addr_dump(&conn->called_addr), + conn->remote_pc, conn, conn->conn_id); conn->calling_addr = uconp->calling_addr; conn->sccp_class = uconp->sccp_class; /* generate + send CR PDU to SCRC */ @@ -862,6 +870,11 @@ static void scoc_fsm_idle(struct osmo_fsm_inst *fi, uint32_t event, void *data) * or by default by the OPC in the MTP label, [and the * MTP-SAP instance]) is associated with the incoming * connection section. */ + LOGP(DLSCCP, LOGL_NOTICE, + "XXXXX SCOC_E_RCOC_CONN_IND conn->calling_addr=%s conn->remote_pc=%u %p %u xua->mtp.opc=%u\n", + osmo_sccp_addr_dump(&conn->calling_addr), + conn->remote_pc, conn, conn->conn_id, xua->mtp.opc); + if (conn->calling_addr.presence & OSMO_SCCP_ADDR_T_PC) conn->remote_pc = conn->calling_addr.pc; else { -- cgit v1.2.3