Change in osmo-bsc[master]: bsc: Set subscr log context during complete_layer3

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed Dec 12 00:08:10 UTC 2018


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/12253 )

Change subject: bsc: Set subscr log context during complete_layer3
......................................................................

bsc: Set subscr log context during complete_layer3

Change-Id: I162a474f711248a3f64a0438967fa6f8a9a3e686
---
M src/osmo-bsc/gsm_08_08.c
1 file changed, 16 insertions(+), 10 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index a3e8b30..c3c5000 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -433,12 +433,14 @@
 	enum bsc_con ret;
 	struct gsm0808_speech_codec_list scl;
 
+	log_set_context(LOG_CTX_BSC_SUBSCR, conn->bsub);
+
 	/* Check the filter */
 	rc = bsc_filter_initial(msc->network->bsc_data, msc, conn, msg,
 				&imsi, &con_type, &lu_cause);
 	if (rc < 0) {
 		bsc_maybe_lu_reject(conn, con_type, lu_cause);
-		return false;
+		goto early_fail;
 	}
 
 	/* allocate resource for a new connection */
@@ -450,8 +452,7 @@
 			bsc_send_ussd_no_srv(conn, msg, msc->ussd_msc_lost_txt);
 		else if (ret == BSC_CON_REJECT_RF_GRACE)
 			bsc_send_ussd_no_srv(conn, msg, msc->ussd_grace_txt);
-
-		return false;
+		goto early_fail;
 	}
 
 	/* TODO: also extract TMSI. We get an IMSI only when an initial L3 Complete comes in that
@@ -460,15 +461,18 @@
 	if (imsi) {
 		conn->filter_state.imsi = talloc_steal(conn, imsi);
 		if (conn->bsub) {
+			log_set_context(LOG_CTX_BSC_SUBSCR, conn->bsub);
 			/* Already a subscriber on L3 Complete? Should never happen... */
 			if (conn->bsub->imsi[0]
 			    && strcmp(conn->bsub->imsi, imsi))
 				LOGP(DMSC, LOGL_ERROR, "Subscriber's IMSI changes from %s to %s\n",
 				     conn->bsub->imsi, imsi);
 			bsc_subscr_set_imsi(conn->bsub, imsi);
-		} else
+		} else {
 			conn->bsub = bsc_subscr_find_or_create_by_imsi(msc->network->bsc_subscribers,
 								       imsi);
+			log_set_context(LOG_CTX_BSC_SUBSCR, conn->bsub);
+		}
 		gscon_update_id(conn);
 	}
 	conn->filter_state.con_type = con_type;
@@ -493,14 +497,16 @@
 	} else
 		resp = gsm0808_create_layer3_2(msg, cgi_for_msc(conn->sccp.msc, conn_get_bts(conn)), NULL);
 
-	if (!resp) {
+	if (resp)
+		osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_CONN_REQ, resp);
+	else
 		LOGP(DMSC, LOGL_DEBUG, "Failed to create layer3 message.\n");
-		return false;
-	}
 
-	osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_CONN_REQ, resp);
-
-	return true;
+	log_set_context(LOG_CTX_BSC_SUBSCR, NULL);
+	return !!resp;
+early_fail:
+	log_set_context(LOG_CTX_BSC_SUBSCR, NULL);
+	return false;
 }
 
 /*

-- 
To view, visit https://gerrit.osmocom.org/12253
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I162a474f711248a3f64a0438967fa6f8a9a3e686
Gerrit-Change-Number: 12253
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181212/87857817/attachment.htm>


More information about the gerrit-log mailing list