aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-12-30 14:17:34 +0100
committerlaforge <laforge@osmocom.org>2021-02-03 08:45:04 +0000
commitf05c5bf6cd83a9c9e0064ccf07944e1107248e1d (patch)
tree5d9d7aa32cb68745f7d3960361b99288506ec25b /src
parentdee13c345f9ba092b4f9374b0d3d25500286db1f (diff)
hnbgw: Use LOGHNB() to add log context information to log lines
So far we don't really have any way of matching a given log message to a specific hNB. Let's use the newly-introduced LOGHNB() macro. Change-Id: Ia16eed4ca5e9ef231259e94c65105f7586f366bc
Diffstat (limited to 'src')
-rw-r--r--src/context_map.c7
-rw-r--r--src/hnbgw.c8
-rw-r--r--src/hnbgw_hnbap.c115
-rw-r--r--src/hnbgw_ranap.c38
-rw-r--r--src/hnbgw_rua.c75
5 files changed, 106 insertions, 137 deletions
diff --git a/src/context_map.c b/src/context_map.c
index dc555bf..f516efe 100644
--- a/src/context_map.c
+++ b/src/context_map.c
@@ -85,11 +85,11 @@ context_map_alloc_by_hnb(struct hnb_context *hnb, uint32_t rua_ctx_id,
}
if (alloc_cn_conn_id(cn_if_new, &new_scu_conn_id) < 0) {
- LOGP(DMAIN, LOGL_ERROR, "Unable to allocate CN connection ID\n");
+ LOGHNB(hnb, DMAIN, LOGL_ERROR, "Unable to allocate CN connection ID\n");
return NULL;
}
- LOGP(DMAIN, LOGL_INFO, "Creating new Mapping RUA CTX %p/%u <-> SCU Conn ID %p/%u\n",
+ LOGHNB(hnb, DMAIN, LOGL_INFO, "Creating new Mapping RUA CTX %p/%u <-> SCU Conn ID %p/%u\n",
hnb, rua_ctx_id, cn_if_new, new_scu_conn_id);
/* alloate a new map entry */
@@ -125,8 +125,7 @@ context_map_by_cn(struct hnbgw_cnlink *cn, uint32_t scu_conn_id)
/* we don't allocate new mappings in the CN->HNB
* direction, as the RUA=SCCP=SUA connections are always
* established from HNB towards CN. */
- LOGP(DMAIN, LOGL_NOTICE, "Unable to resolve map for CN "
- "connection ID %p/%u\n", cn, scu_conn_id);
+ LOGP(DMAIN, LOGL_NOTICE, "Unable to resolve map for CN " "connection ID %p/%u\n", cn, scu_conn_id);
return NULL;
}
diff --git a/src/hnbgw.c b/src/hnbgw.c
index ba8a06f..a6e0d29 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -235,7 +235,7 @@ static int hnb_read_cb(struct osmo_stream_srv *conn)
msgb_free(msg);
return 0;
} else if (rc < 0) {
- LOGP(DMAIN, LOGL_ERROR, "Error during sctp_recvmsg()\n");
+ LOGHNB(hnb, DMAIN, LOGL_ERROR, "Error during sctp_recvmsg()\n");
/* FIXME: clean up after disappeared HNB */
hnb_context_release(hnb);
goto out;
@@ -260,13 +260,11 @@ static int hnb_read_cb(struct osmo_stream_srv *conn)
case IUH_PPI_SABP:
case IUH_PPI_RNA:
case IUH_PPI_PUA:
- LOGP(DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%lu received\n",
- msgb_sctp_ppid(msg));
+ LOGHNB(hnb, DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%lu received\n", msgb_sctp_ppid(msg));
rc = 0;
break;
default:
- LOGP(DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%lu received\n",
- msgb_sctp_ppid(msg));
+ LOGHNB(hnb, DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%lu received\n", msgb_sctp_ppid(msg));
rc = 0;
break;
}
diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c
index c118774..bc503d3 100644
--- a/src/hnbgw_hnbap.c
+++ b/src/hnbgw_hnbap.c
@@ -64,8 +64,8 @@ static int hnbgw_tx_hnb_register_rej(struct hnb_context *ctx)
memset(&reject_out, 0, sizeof(reject_out));
rc = hnbap_encode_hnbregisterrejecties(&reject_out, &reject);
if (rc < 0) {
- LOGP(DHNBAP, LOGL_ERROR, "Failure to encode HNB-REGISTER-REJECT to %s: rc=%d\n",
- ctx->identity_info, rc);
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "Failure to encode HNB-REGISTER-REJECT to %s: rc=%d\n",
+ ctx->identity_info, rc);
return rc;
}
@@ -106,8 +106,8 @@ static int hnbgw_tx_hnb_register_acc(struct hnb_context *ctx)
memset(&accept_out, 0, sizeof(accept_out));
rc = hnbap_encode_hnbregisteraccepties(&accept_out, &accept);
if (rc < 0) {
- LOGP(DHNBAP, LOGL_ERROR, "Failure to encode HNB-REGISTER-ACCEPT to %s: rc=%d\n",
- ctx->identity_info, rc);
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "Failure to encode HNB-REGISTER-ACCEPT to %s: rc=%d\n",
+ ctx->identity_info, rc);
return rc;
}
@@ -119,7 +119,7 @@ static int hnbgw_tx_hnb_register_acc(struct hnb_context *ctx)
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_HNBRegisterAccept, &accept_out);
- LOGP(DHNBAP, LOGL_NOTICE, "Accepting HNB-REGISTER-REQ from %s\n", ctx->identity_info);
+ LOGHNB(ctx, DHNBAP, LOGL_NOTICE, "Accepting HNB-REGISTER-REQ from %s\n", ctx->identity_info);
return hnbgw_hnbap_tx(ctx, msg);
}
@@ -174,20 +174,14 @@ static int hnbgw_tx_ue_register_rej_tmsi(struct hnb_context *hnb, UE_Identity_t
/* Copy the identity over to the reject message */
switch (ue_id->present) {
case UE_Identity_PR_tMSILAI:
- LOGP(DHNBAP, LOGL_DEBUG, "REJ UE_Id tMSI %d %s\n",
- ue_id->choice.tMSILAI.tMSI.size,
- osmo_hexdump(ue_id->choice.tMSILAI.tMSI.buf,
- ue_id->choice.tMSILAI.tMSI.size));
+ LOGHNB(hnb, DHNBAP, LOGL_DEBUG, "REJ UE_Id tMSI %d %s\n", ue_id->choice.tMSILAI.tMSI.size,
+ osmo_hexdump(ue_id->choice.tMSILAI.tMSI.buf, ue_id->choice.tMSILAI.tMSI.size));
- LOGP(DHNBAP, LOGL_DEBUG, "REJ UE_Id pLMNID %d %s\n",
- ue_id->choice.tMSILAI.lAI.pLMNID.size,
- osmo_hexdump(ue_id->choice.tMSILAI.lAI.pLMNID.buf,
- ue_id->choice.tMSILAI.lAI.pLMNID.size));
+ LOGHNB(hnb, DHNBAP, LOGL_DEBUG, "REJ UE_Id pLMNID %d %s\n", ue_id->choice.tMSILAI.lAI.pLMNID.size,
+ osmo_hexdump(ue_id->choice.tMSILAI.lAI.pLMNID.buf, ue_id->choice.tMSILAI.lAI.pLMNID.size));
- LOGP(DHNBAP, LOGL_DEBUG, "REJ UE_Id lAC %d %s\n",
- ue_id->choice.tMSILAI.lAI.lAC.size,
- osmo_hexdump(ue_id->choice.tMSILAI.lAI.lAC.buf,
- ue_id->choice.tMSILAI.lAI.lAC.size));
+ LOGHNB(hnb, DHNBAP, LOGL_DEBUG, "REJ UE_Id lAC %d %s\n", ue_id->choice.tMSILAI.lAI.lAC.size,
+ osmo_hexdump(ue_id->choice.tMSILAI.lAI.lAC.buf, ue_id->choice.tMSILAI.lAI.lAC.size));
BIT_STRING_fromBuf(&reject.uE_Identity.choice.tMSILAI.tMSI,
ue_id->choice.tMSILAI.tMSI.buf,
@@ -202,25 +196,17 @@ static int hnbgw_tx_ue_register_rej_tmsi(struct hnb_context *hnb, UE_Identity_t
break;
case UE_Identity_PR_pTMSIRAI:
- LOGP(DHNBAP, LOGL_DEBUG, "REJ UE_Id pTMSI %d %s\n",
- ue_id->choice.pTMSIRAI.pTMSI.size,
- osmo_hexdump(ue_id->choice.pTMSIRAI.pTMSI.buf,
- ue_id->choice.pTMSIRAI.pTMSI.size));
-
- LOGP(DHNBAP, LOGL_DEBUG, "REJ UE_Id pLMNID %d %s\n",
- ue_id->choice.pTMSIRAI.rAI.lAI.pLMNID.size,
- osmo_hexdump(ue_id->choice.pTMSIRAI.rAI.lAI.pLMNID.buf,
- ue_id->choice.pTMSIRAI.rAI.lAI.pLMNID.size));
-
- LOGP(DHNBAP, LOGL_DEBUG, "REJ UE_Id lAC %d %s\n",
- ue_id->choice.pTMSIRAI.rAI.lAI.lAC.size,
- osmo_hexdump(ue_id->choice.pTMSIRAI.rAI.lAI.lAC.buf,
- ue_id->choice.pTMSIRAI.rAI.lAI.lAC.size));
-
- LOGP(DHNBAP, LOGL_DEBUG, "REJ UE_Id rAC %d %s\n",
- ue_id->choice.pTMSIRAI.rAI.rAC.size,
- osmo_hexdump(ue_id->choice.pTMSIRAI.rAI.rAC.buf,
- ue_id->choice.pTMSIRAI.rAI.rAC.size));
+ LOGHNB(hnb, DHNBAP, LOGL_DEBUG, "REJ UE_Id pTMSI %d %s\n", ue_id->choice.pTMSIRAI.pTMSI.size,
+ osmo_hexdump(ue_id->choice.pTMSIRAI.pTMSI.buf, ue_id->choice.pTMSIRAI.pTMSI.size));
+
+ LOGHNB(hnb, DHNBAP, LOGL_DEBUG, "REJ UE_Id pLMNID %d %s\n", ue_id->choice.pTMSIRAI.rAI.lAI.pLMNID.size,
+ osmo_hexdump(ue_id->choice.pTMSIRAI.rAI.lAI.pLMNID.buf, ue_id->choice.pTMSIRAI.rAI.lAI.pLMNID.size));
+
+ LOGHNB(hnb, DHNBAP, LOGL_DEBUG, "REJ UE_Id lAC %d %s\n", ue_id->choice.pTMSIRAI.rAI.lAI.lAC.size,
+ osmo_hexdump(ue_id->choice.pTMSIRAI.rAI.lAI.lAC.buf, ue_id->choice.pTMSIRAI.rAI.lAI.lAC.size));
+
+ LOGHNB(hnb, DHNBAP, LOGL_DEBUG, "REJ UE_Id rAC %d %s\n", ue_id->choice.pTMSIRAI.rAI.rAC.size,
+ osmo_hexdump(ue_id->choice.pTMSIRAI.rAI.rAC.buf, ue_id->choice.pTMSIRAI.rAI.rAC.size));
BIT_STRING_fromBuf(&reject.uE_Identity.choice.pTMSIRAI.pTMSI,
ue_id->choice.pTMSIRAI.pTMSI.buf,
@@ -238,13 +224,12 @@ static int hnbgw_tx_ue_register_rej_tmsi(struct hnb_context *hnb, UE_Identity_t
break;
default:
- LOGP(DHNBAP, LOGL_ERROR, "Cannot compose UE Register Reject:"
+ LOGHNB(hnb, DHNBAP, LOGL_ERROR, "Cannot compose UE Register Reject:"
" unsupported UE ID (present=%d)\n", ue_id->present);
return -1;
}
- LOGP(DHNBAP, LOGL_ERROR, "Rejecting UE Register Request:"
- " TMSI identity registration is switched off\n");
+ LOGHNB(hnb, DHNBAP, LOGL_ERROR, "Rejecting UE Register Request: TMSI identity registration is switched off\n");
reject.cause.present = Cause_PR_radioNetwork;
reject.cause.choice.radioNetwork = CauseRadioNetwork_invalid_UE_identity;
@@ -337,14 +322,12 @@ static int hnbgw_tx_ue_register_acc_tmsi(struct hnb_context *hnb, UE_Identity_t
break;
default:
- LOGP(DHNBAP, LOGL_ERROR, "Unsupportedccept UE ID (present=%d)\n",
- ue_id->present);
+ LOGHNB(hnb, DHNBAP, LOGL_ERROR, "Unsupportedccept UE ID (present=%d)\n", ue_id->present);
return -1;
}
tmsi = ntohl(tmsi);
- LOGP(DHNBAP, LOGL_DEBUG, "HNBAP register with TMSI %x\n",
- tmsi);
+ LOGHNB(hnb, DHNBAP, LOGL_DEBUG, "HNBAP register with TMSI %x\n", tmsi);
ue = ue_context_by_tmsi(hnb->gw, tmsi);
if (!ue)
@@ -402,8 +385,7 @@ static int hnbgw_rx_hnb_deregister(struct hnb_context *ctx, ANY_t *in)
if (rc < 0)
return rc;
- DEBUGP(DHNBAP, "HNB-DE-REGISTER cause=%s\n",
- hnbap_cause_str(&ies.cause));
+ LOGHNB(ctx, DHNBAP, LOGL_DEBUG, "HNB-DE-REGISTER cause=%s\n", hnbap_cause_str(&ies.cause));
hnbap_free_hnbde_registeries(&ies);
hnb_context_release(ctx);
@@ -419,8 +401,8 @@ static int hnbgw_rx_hnb_register_req(struct hnb_context *ctx, ANY_t *in)
rc = hnbap_decode_hnbregisterrequesties(&ies, in);
if (rc < 0) {
- LOGP(DHNBAP, LOGL_ERROR, "Failure to decode HNB-REGISTER-REQ from %s: rc=%d\n",
- ctx->identity_info, rc);
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "Failure to decode HNB-REGISTER-REQ from %s: rc=%d\n",
+ ctx->identity_info, rc);
return rc;
}
@@ -437,9 +419,9 @@ static int hnbgw_rx_hnb_register_req(struct hnb_context *ctx, ANY_t *in)
if (hnb->hnb_registered && ctx != hnb && memcmp(&ctx->id, &hnb->id, sizeof(ctx->id)) == 0) {
struct osmo_fd *ofd = osmo_stream_srv_get_ofd(ctx->conn);
char *name = osmo_sock_get_name(ctx, ofd->fd);
- LOGP(DHNBAP, LOGL_ERROR, "rejecting HNB-REGISTER-REQ with duplicate cell identity "
- "MCC=%u,MNC=%u,LAC=%u,RAC=%u,SAC=%u,CID=%u from %s\n",
- ctx->id.mcc, ctx->id.mnc, ctx->id.lac, ctx->id.rac, ctx->id.sac, ctx->id.cid, name);
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "rejecting HNB-REGISTER-REQ with duplicate cell identity "
+ "MCC=%u,MNC=%u,LAC=%u,RAC=%u,SAC=%u,CID=%u from %s\n",
+ ctx->id.mcc, ctx->id.mnc, ctx->id.lac, ctx->id.rac, ctx->id.sac, ctx->id.cid, name);
talloc_free(name);
return hnbgw_tx_hnb_register_rej(ctx);
}
@@ -447,7 +429,7 @@ static int hnbgw_rx_hnb_register_req(struct hnb_context *ctx, ANY_t *in)
ctx->hnb_registered = true;
- DEBUGP(DHNBAP, "HNB-REGISTER-REQ from %s\n", ctx->identity_info);
+ LOGHNB(ctx, DHNBAP, LOGL_DEBUG, "HNB-REGISTER-REQ from %s\n", ctx->identity_info);
/* Send HNBRegisterAccept */
rc = hnbgw_tx_hnb_register_acc(ctx);
@@ -489,14 +471,13 @@ static int hnbgw_rx_ue_register_req(struct hnb_context *ctx, ANY_t *in)
hnbap_free_ueregisterrequesties(&ies);
return rc;
default:
- LOGP(DHNBAP, LOGL_NOTICE,
- "UE-REGISTER-REQ with unsupported UE Id type %d\n",
- ies.uE_Identity.present);
+ LOGHNB(ctx, DHNBAP, LOGL_NOTICE, "UE-REGISTER-REQ with unsupported UE Id type %d\n",
+ ies.uE_Identity.present);
hnbap_free_ueregisterrequesties(&ies);
return rc;
}
- DEBUGP(DHNBAP, "UE-REGISTER-REQ ID_type=%d imsi=%s cause=%ld\n",
+ LOGHNB(ctx, DHNBAP, LOGL_DEBUG, "UE-REGISTER-REQ ID_type=%d imsi=%s cause=%ld\n",
ies.uE_Identity.present, imsi, ies.registration_Cause);
ue = ue_context_by_imsi(ctx->gw, imsi);
@@ -521,8 +502,7 @@ static int hnbgw_rx_ue_deregister(struct hnb_context *ctx, ANY_t *in)
ctxid = asn1bitstr_to_u24(&ies.context_ID);
- DEBUGP(DHNBAP, "UE-DE-REGISTER context=%u cause=%s\n",
- ctxid, hnbap_cause_str(&ies.cause));
+ LOGHNB(ctx, DHNBAP, LOGL_DEBUG, "UE-DE-REGISTER context=%u cause=%s\n", ctxid, hnbap_cause_str(&ies.cause));
ue = ue_context_by_id(ctx->gw, ctxid);
if (ue)
@@ -541,8 +521,7 @@ static int hnbgw_rx_err_ind(struct hnb_context *hnb, ANY_t *in)
if (rc < 0)
return rc;
- LOGP(DHNBAP, LOGL_NOTICE, "HNBAP ERROR.ind, cause: %s\n",
- hnbap_cause_str(&ies.cause));
+ LOGHNB(hnb, DHNBAP, LOGL_NOTICE, "HNBAP ERROR.ind, cause: %s\n", hnbap_cause_str(&ies.cause));
hnbap_free_errorindicationies(&ies);
return 0;
@@ -573,12 +552,10 @@ static int hnbgw_rx_initiating_msg(struct hnb_context *hnb, InitiatingMessage_t
case ProcedureCode_id_RelocationComplete: /* 8.11 */
case ProcedureCode_id_U_RNTIQuery: /* 8.12 */
case ProcedureCode_id_privateMessage:
- LOGP(DHNBAP, LOGL_NOTICE, "Unimplemented HNBAP Procedure %ld\n",
- imsg->procedureCode);
+ LOGHNB(hnb, DHNBAP, LOGL_NOTICE, "Unimplemented HNBAP Procedure %ld\n", imsg->procedureCode);
break;
default:
- LOGP(DHNBAP, LOGL_NOTICE, "Unknown HNBAP Procedure %ld\n",
- imsg->procedureCode);
+ LOGHNB(hnb, DHNBAP, LOGL_NOTICE, "Unknown HNBAP Procedure %ld\n", imsg->procedureCode);
break;
}
@@ -594,10 +571,9 @@ static int hnbgw_rx_successful_outcome_msg(struct hnb_context *hnb, SuccessfulOu
static int hnbgw_rx_unsuccessful_outcome_msg(struct hnb_context *hnb, UnsuccessfulOutcome_t *msg)
{
/* We don't care much about HNBAP */
- LOGP(DHNBAP, LOGL_ERROR, "Received Unsuccessful Outcome, procedureCode %ld, criticality %ld,"
- " from '%s', cell mcc %u mnc %u lac %u rac %u sac %u cid %u\n",
- msg->procedureCode, msg->criticality, hnb->identity_info,
- hnb->id.mcc, hnb->id.mnc, hnb->id.lac, hnb->id.rac, hnb->id.sac, hnb->id.cid);
+ LOGHNB(hnb, DHNBAP, LOGL_ERROR, "Received Unsuccessful Outcome, procedureCode %ld, criticality %ld,"
+ " cell mcc %u mnc %u lac %u rac %u sac %u cid %u\n", msg->procedureCode, msg->criticality,
+ hnb->id.mcc, hnb->id.mnc, hnb->id.lac, hnb->id.rac, hnb->id.sac, hnb->id.cid);
return 0;
}
@@ -619,8 +595,7 @@ static int _hnbgw_hnbap_rx(struct hnb_context *hnb, HNBAP_PDU_t *pdu)
rc = hnbgw_rx_unsuccessful_outcome_msg(hnb, &pdu->choice.unsuccessfulOutcome);
break;
default:
- LOGP(DHNBAP, LOGL_NOTICE, "Unknown HNBAP Presence %u\n",
- pdu->present);
+ LOGHNB(hnb, DHNBAP, LOGL_NOTICE, "Unknown HNBAP Presence %u\n", pdu->present);
rc = -1;
}
@@ -639,7 +614,7 @@ int hnbgw_hnbap_rx(struct hnb_context *hnb, struct msgb *msg)
dec_ret = aper_decode(NULL, &asn_DEF_HNBAP_PDU, (void **) &pdu,
msg->data, msgb_length(msg), 0, 0);
if (dec_ret.code != RC_OK) {
- LOGP(DHNBAP, LOGL_ERROR, "Error in ASN.1 decode\n");
+ LOGHNB(hnb, DHNBAP, LOGL_ERROR, "Error in ASN.1 decode\n");
return -1;
}
diff --git a/src/hnbgw_ranap.c b/src/hnbgw_ranap.c
index 6822752..445d463 100644
--- a/src/hnbgw_ranap.c
+++ b/src/hnbgw_ranap.c
@@ -64,7 +64,7 @@ static int ranap_rx_init_reset(struct hnb_context *hnb, ANY_t *in)
if (ies.cN_DomainIndicator == RANAP_CN_DomainIndicator_ps_domain)
is_ps=1;
- LOGP(DRANAP, LOGL_INFO, "Rx RESET.req(%s,%s)\n", is_ps ? "ps" : "cs",
+ LOGHNB(hnb, DRANAP, LOGL_INFO, "Rx RESET.req(%s,%s)\n", is_ps ? "ps" : "cs",
ranap_cause_str(&ies.cause));
/* FIXME: Actually we have to wait for some guard time? */
@@ -84,10 +84,9 @@ static int ranap_rx_error_ind(struct hnb_context *hnb, ANY_t *in)
return rc;
if (ies.presenceMask & ERRORINDICATIONIES_RANAP_CAUSE_PRESENT) {
- LOGP(DRANAP, LOGL_ERROR, "Rx ERROR.ind(%s)\n",
- ranap_cause_str(&ies.cause));
+ LOGHNB(hnb, DRANAP, LOGL_ERROR, "Rx ERROR.ind(%s)\n", ranap_cause_str(&ies.cause));
} else
- LOGP(DRANAP, LOGL_ERROR, "Rx ERROR.ind\n");
+ LOGHNB(hnb, DRANAP, LOGL_ERROR, "Rx ERROR.ind\n");
return 0;
}
@@ -117,12 +116,12 @@ static int ranap_rx_initiating_msg(struct hnb_context *hnb, RANAP_InitiatingMess
case RANAP_ProcedureCode_id_InformationTransfer:
case RANAP_ProcedureCode_id_DirectInformationTransfer:
case RANAP_ProcedureCode_id_UplinkInformationExchange:
- LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP "
- "Procedure %lu from HNB, ignoring\n", imsg->procedureCode);
+ LOGHNB(hnb, DRANAP, LOGL_NOTICE, "Received unsupported RANAP "
+ "Procedure %lu from HNB, ignoring\n", imsg->procedureCode);
break;
default:
- LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP "
- "Procedure %lu from HNB, ignoring\n", imsg->procedureCode);
+ LOGHNB(hnb, DRANAP, LOGL_NOTICE, "Received suspicious RANAP "
+ "Procedure %lu from HNB, ignoring\n", imsg->procedureCode);
break;
}
@@ -145,12 +144,12 @@ static int ranap_rx_successful_msg(struct hnb_context *hnb, RANAP_SuccessfulOutc
case RANAP_ProcedureCode_id_InformationTransfer:
case RANAP_ProcedureCode_id_DirectInformationTransfer:
case RANAP_ProcedureCode_id_UplinkInformationExchange:
- LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP "
- "Procedure %lu from HNB, ignoring\n", imsg->procedureCode);
+ LOGHNB(hnb, DRANAP, LOGL_NOTICE, "Received unsupported RANAP "
+ "Procedure %lu from HNB, ignoring\n", imsg->procedureCode);
break;
default:
- LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP "
- "Procedure %lu from HNB, ignoring\n", imsg->procedureCode);
+ LOGHNB(hnb, DRANAP, LOGL_NOTICE, "Received suspicious RANAP "
+ "Procedure %lu from HNB, ignoring\n", imsg->procedureCode);
break;
}
@@ -171,13 +170,13 @@ static int _hnbgw_ranap_rx(struct hnb_context *hnb, RANAP_RANAP_PDU_t *pdu)
rc = ranap_rx_successful_msg(hnb, &pdu->choice.successfulOutcome);
break;
case RANAP_RANAP_PDU_PR_unsuccessfulOutcome:
- LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP "
- "unsuccessful outcome procedure %lu from HNB, ignoring\n",
- pdu->choice.unsuccessfulOutcome.procedureCode);
+ LOGHNB(hnb, DRANAP, LOGL_NOTICE, "Received unsupported RANAP "
+ "unsuccessful outcome procedure %lu from HNB, ignoring\n",
+ pdu->choice.unsuccessfulOutcome.procedureCode);
break;
default:
- LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP "
- "presence %u from HNB, ignoring\n", pdu->present);
+ LOGHNB(hnb, DRANAP, LOGL_NOTICE, "Received suspicious RANAP "
+ "presence %u from HNB, ignoring\n", pdu->present);
break;
}
@@ -188,6 +187,7 @@ static int _hnbgw_ranap_rx(struct hnb_context *hnb, RANAP_RANAP_PDU_t *pdu)
int hnbgw_ranap_rx(struct msgb *msg, uint8_t *data, size_t len)
{
RANAP_RANAP_PDU_t _pdu, *pdu = &_pdu;
+ struct hnb_context *hnb = msg->dst;
asn_dec_rval_t dec_ret;
int rc;
@@ -195,11 +195,11 @@ int hnbgw_ranap_rx(struct msgb *msg, uint8_t *data, size_t len)
dec_ret = aper_decode(NULL,&asn_DEF_RANAP_RANAP_PDU, (void **) &pdu,
data, len, 0, 0);
if (dec_ret.code != RC_OK) {
- LOGP(DRANAP, LOGL_ERROR, "Error in RANAP ASN.1 decode\n");
+ LOGHNB(hnb, DRANAP, LOGL_ERROR, "Error in RANAP ASN.1 decode\n");
return -1;
}
- rc = _hnbgw_ranap_rx(msg->dst, pdu);
+ rc = _hnbgw_ranap_rx(hnb, pdu);
return rc;
}
diff --git a/src/hnbgw_rua.c b/src/hnbgw_rua.c
index 71c3f8e..5224bf1 100644
--- a/src/hnbgw_rua.c
+++ b/src/hnbgw_rua.c
@@ -86,7 +86,7 @@ int rua_tx_udt(struct hnb_context *hnb, const uint8_t *data, unsigned int len)
&out);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_ConnectionlessTransfer, &out);
- DEBUGP(DRUA, "transmitting RUA payload of %u bytes\n", msgb_length(msg));
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "transmitting RUA payload of %u bytes\n", msgb_length(msg));
return hnbgw_rua_tx(hnb, msg);
}
@@ -122,7 +122,7 @@ int rua_tx_dt(struct hnb_context *hnb, int is_ps, uint32_t context_id,
&out);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_DirectTransfer, &out);
- DEBUGP(DRUA, "transmitting RUA (cn=%s) payload of %u bytes\n",
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "transmitting RUA (cn=%s) payload of %u bytes\n",
is_ps ? "ps" : "cs", msgb_length(msg));
return hnbgw_rua_tx(hnb, msg);
@@ -163,7 +163,7 @@ int rua_tx_disc(struct hnb_context *hnb, int is_ps, uint32_t context_id,
&out);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RUA_Disconnect, &out);
- DEBUGP(DRUA, "transmitting RUA (cn=%s) payload of %u bytes\n",
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "transmitting RUA (cn=%s) payload of %u bytes\n",
is_ps ? "ps" : "cs", msgb_length(msg));
@@ -198,13 +198,12 @@ static int rua_to_scu(struct hnb_context *hnb,
is_ps = true;
break;
default:
- LOGP(DRUA, LOGL_ERROR, "Unsupported Domain %ld\n",
- cN_DomainIndicator);
+ LOGHNB(hnb, DRUA, LOGL_ERROR, "Unsupported Domain %ld\n", cN_DomainIndicator);
return -1;
}
if (!cn) {
- DEBUGP(DRUA, "CN=NULL, discarding message\n");
+ LOGHNB(hnb, DRUA, LOGL_NOTICE, "CN=NULL, discarding message\n");
return 0;
}
@@ -215,17 +214,14 @@ static int rua_to_scu(struct hnb_context *hnb,
switch (type) {
case OSMO_SCU_PRIM_N_UNITDATA:
- DEBUGP(DRUA, "rua_to_scu() %s to %s, rua_ctx_id %u (unitdata, no scu_conn_id)\n",
- cn_domain_indicator_to_str(cN_DomainIndicator),
- osmo_sccp_addr_dump(remote_addr),
- context_id);
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "rua_to_scu() %s to %s, rua_ctx_id %u (unitdata, no scu_conn_id)\n",
+ cn_domain_indicator_to_str(cN_DomainIndicator), osmo_sccp_addr_dump(remote_addr), context_id);
break;
default:
map = context_map_alloc_by_hnb(hnb, context_id, is_ps, cn);
OSMO_ASSERT(map);
- DEBUGP(DRUA, "rua_to_scu() %s to %s, rua_ctx_id %u scu_conn_id %u\n",
- cn_domain_indicator_to_str(cN_DomainIndicator),
- osmo_sccp_addr_dump(remote_addr),
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "rua_to_scu() %s to %s, rua_ctx_id %u scu_conn_id %u\n",
+ cn_domain_indicator_to_str(cN_DomainIndicator), osmo_sccp_addr_dump(remote_addr),
map->rua_ctx_id, map->scu_conn_id);
}
@@ -237,10 +233,10 @@ static int rua_to_scu(struct hnb_context *hnb,
prim->u.connect.sccp_class = 2;
prim->u.connect.conn_id = map->scu_conn_id;
/* Two separate logs because of osmo_sccp_addr_dump(). */
- DEBUGP(DRUA, "RUA to SCCP N_CONNECT: called_addr:%s\n",
- osmo_sccp_addr_dump(&prim->u.connect.called_addr));
- DEBUGP(DRUA, "RUA to SCCP N_CONNECT: calling_addr:%s\n",
- osmo_sccp_addr_dump(&prim->u.connect.calling_addr));
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "RUA to SCCP N_CONNECT: called_addr:%s\n",
+ osmo_sccp_addr_dump(&prim->u.connect.called_addr));
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "RUA to SCCP N_CONNECT: calling_addr:%s\n",
+ osmo_sccp_addr_dump(&prim->u.connect.calling_addr));
break;
case OSMO_SCU_PRIM_N_DATA:
prim->u.data.conn_id = map->scu_conn_id;
@@ -254,10 +250,10 @@ static int rua_to_scu(struct hnb_context *hnb,
prim->u.unitdata.called_addr = *remote_addr;
prim->u.unitdata.calling_addr = cn->gw->sccp.local_addr;
/* Two separate logs because of osmo_sccp_addr_dump(). */
- DEBUGP(DRUA, "RUA to SCCP N_UNITDATA: called_addr:%s\n",
- osmo_sccp_addr_dump(&prim->u.unitdata.called_addr));
- DEBUGP(DRUA, "RUA to SCCP N_UNITDATA: calling_addr:%s\n",
- osmo_sccp_addr_dump(&prim->u.unitdata.calling_addr));
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "RUA to SCCP N_UNITDATA: called_addr:%s\n",
+ osmo_sccp_addr_dump(&prim->u.unitdata.called_addr));
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "RUA to SCCP N_UNITDATA: calling_addr:%s\n",
+ osmo_sccp_addr_dump(&prim->u.unitdata.calling_addr));
break;
default:
return -EINVAL;
@@ -352,11 +348,9 @@ static int rua_rx_init_connect(struct msgb *msg, ANY_t *in)
context_id = asn1bitstr_to_u24(&ies.context_ID);
- DEBUGP(DRUA, "RUA %s Connect.req(ctx=0x%x, %s)\n",
- cn_domain_indicator_to_str(ies.cN_DomainIndicator),
- context_id,
- ies.establishment_Cause == RUA_Establishment_Cause_emergency_call
- ? "emergency" : "normal");
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "RUA %s Connect.req(ctx=0x%x, %s)\n",
+ cn_domain_indicator_to_str(ies.cN_DomainIndicator), context_id,
+ ies.establishment_Cause == RUA_Establishment_Cause_emergency_call ? "emergency" : "normal");
rc = rua_to_scu(hnb, ies.cN_DomainIndicator, OSMO_SCU_PRIM_N_CONNECT,
context_id, 0, ies.ranaP_Message.buf,
@@ -384,7 +378,7 @@ static int rua_rx_init_disconnect(struct msgb *msg, ANY_t *in)
context_id = asn1bitstr_to_u24(&ies.context_ID);
scu_cause = rua_to_scu_cause(&ies.cause);
- DEBUGP(DRUA, "RUA Disconnect.req(ctx=0x%x,cause=%s)\n", context_id,
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "RUA Disconnect.req(ctx=0x%x,cause=%s)\n", context_id,
rua_cause_str(&ies.cause));
if (ies.presenceMask & DISCONNECTIES_RUA_RANAP_MESSAGE_PRESENT) {
@@ -414,7 +408,7 @@ static int rua_rx_init_dt(struct msgb *msg, ANY_t *in)
context_id = asn1bitstr_to_u24(&ies.context_ID);
- DEBUGP(DRUA, "RUA Data.req(ctx=0x%x)\n", context_id);
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "RUA Data.req(ctx=0x%x)\n", context_id);
rc = rua_to_scu(hnb,
ies.cN_DomainIndicator,
@@ -430,13 +424,14 @@ static int rua_rx_init_dt(struct msgb *msg, ANY_t *in)
static int rua_rx_init_udt(struct msgb *msg, ANY_t *in)
{
RUA_ConnectionlessTransferIEs_t ies;
+ struct hnb_context *hnb = msg->dst;
int rc;
rc = rua_decode_connectionlesstransferies(&ies, in);
if (rc < 0)
return rc;
- DEBUGP(DRUA, "RUA UData.req()\n");
+ LOGHNB(hnb, DRUA, LOGL_DEBUG, "RUA UData.req()\n");
/* according tot the spec, we can primarily receive Overload,
* Reset, Reset ACK, Error Indication, reset Resource, Reset
@@ -455,14 +450,14 @@ static int rua_rx_init_udt(struct msgb *msg, ANY_t *in)
static int rua_rx_init_err_ind(struct msgb *msg, ANY_t *in)
{
RUA_ErrorIndicationIEs_t ies;
+ struct hnb_context *hnb = msg->dst;
int rc;
rc = rua_decode_errorindicationies(&ies, in);
if (rc < 0)
return rc;
- LOGP(DRUA, LOGL_ERROR, "RUA UData.ErrorInd(%s)\n",
- rua_cause_str(&ies.cause));
+ LOGHNB(hnb, DRUA, LOGL_ERROR, "RUA UData.ErrorInd(%s)\n", rua_cause_str(&ies.cause));
rua_free_errorindicationies(&ies);
return rc;
@@ -470,6 +465,7 @@ static int rua_rx_init_err_ind(struct msgb *msg, ANY_t *in)
static int rua_rx_initiating_msg(struct msgb *msg, RUA_InitiatingMessage_t *imsg)
{
+ struct hnb_context *hnb = msg->dst;
int rc;
switch (imsg->procedureCode) {
@@ -489,13 +485,11 @@ static int rua_rx_initiating_msg(struct msgb *msg, RUA_InitiatingMessage_t *imsg
rc = rua_rx_init_err_ind(msg, &imsg->value);
break;
case RUA_ProcedureCode_id_privateMessage:
- LOGP(DRUA, LOGL_NOTICE,
- "Unhandled: RUA Initiating Msg: Private Msg\n");
+ LOGHNB(hnb, DRUA, LOGL_NOTICE, "Unhandled: RUA Initiating Msg: Private Msg\n");
rc = 0;
break;
default:
- LOGP(DRUA, LOGL_NOTICE, "Unknown RUA Procedure %lu\n",
- imsg->procedureCode);
+ LOGHNB(hnb, DRUA, LOGL_NOTICE, "Unknown RUA Procedure %lu\n", imsg->procedureCode);
rc = -1;
}
@@ -504,21 +498,24 @@ static int rua_rx_initiating_msg(struct msgb *msg, RUA_InitiatingMessage_t *imsg
static int rua_rx_successful_outcome_msg(struct msgb *msg, RUA_SuccessfulOutcome_t *in)
{
+ struct hnb_context *hnb = msg->dst;
/* FIXME */
- LOGP(DRUA, LOGL_NOTICE, "Unexpected RUA Successful Outcome\n");
+ LOGHNB(hnb, DRUA, LOGL_NOTICE, "Unexpected RUA Successful Outcome\n");
return -1;
}
static int rua_rx_unsuccessful_outcome_msg(struct msgb *msg, RUA_UnsuccessfulOutcome_t *in)
{
+ struct hnb_context *hnb = msg->dst;
/* FIXME */
- LOGP(DRUA, LOGL_NOTICE, "Unexpected RUA Unsucessful Outcome\n");
+ LOGHNB(hnb, DRUA, LOGL_NOTICE, "Unexpected RUA Unsucessful Outcome\n");
return -1;
}
static int _hnbgw_rua_rx(struct msgb *msg, RUA_RUA_PDU_t *pdu)
{
+ struct hnb_context *hnb = msg->dst;
int rc;
/* it's a bit odd that we can't dispatch on procedure code, but
@@ -534,7 +531,7 @@ static int _hnbgw_rua_rx(struct msgb *msg, RUA_RUA_PDU_t *pdu)
rc = rua_rx_unsuccessful_outcome_msg(msg, &pdu->choice.unsuccessfulOutcome);
break;
default:
- LOGP(DRUA, LOGL_NOTICE, "Unknown RUA presence %u\n", pdu->present);
+ LOGHNB(hnb, DRUA, LOGL_NOTICE, "Unknown RUA presence %u\n", pdu->present);
rc = -1;
}
@@ -553,7 +550,7 @@ int hnbgw_rua_rx(struct hnb_context *hnb, struct msgb *msg)
dec_ret = aper_decode(NULL, &asn_DEF_RUA_RUA_PDU, (void **) &pdu,
msg->data, msgb_length(msg), 0, 0);
if (dec_ret.code != RC_OK) {
- LOGP(DRUA, LOGL_ERROR, "Error in ASN.1 decode\n");
+ LOGHNB(hnb, DRUA, LOGL_ERROR, "Error in ASN.1 decode\n");
return -1;
}