[MERGED] osmo-msc[master]: a_iface_bssap.c: Use LOGPCONN() whenever possible

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Feb 9 02:25:27 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: a_iface_bssap.c: Use LOGPCONN() whenever possible
......................................................................


a_iface_bssap.c: Use LOGPCONN() whenever possible

Change-Id: Ic1c9d14b892154d51165598338d23a924a772265
---
M include/osmocom/msc/a_iface.h
M src/libmsc/a_iface.c
M src/libmsc/a_iface_bssap.c
3 files changed, 27 insertions(+), 26 deletions(-)

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



diff --git a/include/osmocom/msc/a_iface.h b/include/osmocom/msc/a_iface.h
index 466e70b..9133e1b 100644
--- a/include/osmocom/msc/a_iface.h
+++ b/include/osmocom/msc/a_iface.h
@@ -22,8 +22,17 @@
 
 #include <osmocom/msc/a_reset.h>
 #include <osmocom/msc/transaction.h>
+#include <osmocom/msc/vlr.h>
 #include <osmocom/gsm/protocol/gsm_08_08.h>
 
+#define LOGPCONN(conn, level, fmt, args...) \
+	LOGP(DMSC, level, "(subscr %s, conn_id %d) " fmt, \
+	     vlr_subscr_name(conn ? conn->vsub : NULL), conn ? conn->a.conn_id : -1, \
+	     ## args)
+
+#define LOGPBSCCONN(conn, level, fmt, args...) \
+	LOGP(DMSC, level, "(conn_id %u) " fmt, conn ? conn->conn_id : (uint32_t)(-1), ## args)
+
 /* A struct to keep a context information about the BSCs we are associated with */
 struct bsc_context {
 	struct llist_head list;
diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index 1a4cebc..64036be 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -43,14 +43,6 @@
 
 #include <errno.h>
 
-#define LOGPCONN(conn, level, fmt, args...) \
-	LOGP(DMSC, level, "(subscr %s, conn_id %d) " fmt, \
-	     vlr_subscr_name(conn ? conn->vsub : NULL), conn ? conn->a.conn_id : -1, \
-	     ## args)
-
-#define LOGPBSCCONN(conn, level, fmt, args...) \
-	LOGP(DMSC, level, "(conn_id %u) " fmt, conn ? conn->conn_id : (uint32_t)(-1), ## args)
-
 /* A pointer to the GSM network we work with. By the current paradigm,
  * there can only be one gsm_network per MSC. The pointer is set once
  * when calling a_init() */
diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c
index efae199..f91855a 100644
--- a/src/libmsc/a_iface_bssap.c
+++ b/src/libmsc/a_iface_bssap.c
@@ -69,7 +69,7 @@
 	memcpy(&conn->a.bsc_addr, &a_conn_info->bsc->bsc_addr, sizeof(conn->a.bsc_addr));
 
 	llist_add_tail(&conn->entry, &network->subscr_conns);
-	LOGP(DMSC, LOGL_DEBUG, "A-Interface subscriber connection successfully allocated!\n");
+	LOGPCONN(conn, LOGL_DEBUG, "A-Interface subscriber connection successfully allocated!\n");
 	return conn;
 }
 
@@ -89,7 +89,7 @@
 
 	llist_for_each_entry(conn, &network->subscr_conns, entry) {
 		if (conn->via_ran == RAN_GERAN_A && conn->a.conn_id == conn_id) {
-			DEBUGP(DIUCS, "Found A subscriber for conn_id %i\n", conn_id);
+			LOGPCONN(conn, LOGL_DEBUG, "Found A subscriber for conn_id %i\n", conn_id);
 			return conn;
 		}
 	}
@@ -371,11 +371,11 @@
 	if (!conn)
 		goto fail;
 
-	LOGP(DMSC, LOGL_DEBUG, "BSC sends clasmark update (conn_id=%i)\n", conn->a.conn_id);
+	LOGPCONN(conn, LOGL_DEBUG, "BSC sends clasmark update\n");
 
 	tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, msgb_l3len(msg) - 1, 0, 0);
 	if (!TLVP_PRESENT(&tp, GSM0808_IE_CLASSMARK_INFORMATION_T2)) {
-		LOGP(DMSC, LOGL_ERROR, "Mandatory Classmark Information Type 2 not present -- discarding message!\n");
+		LOGPCONN(conn, LOGL_ERROR, "Mandatory Classmark Information Type 2 not present -- discarding message!\n");
 		goto fail;
 	}
 
@@ -418,7 +418,7 @@
 	if (!conn)
 		goto fail;
 
-	LOGP(DMSC, LOGL_DEBUG, "BSC sends cipher mode complete (conn_id=%i)\n", conn->a.conn_id);
+	LOGPCONN(conn, LOGL_DEBUG, "BSC sends cipher mode complete\n");
 
 	tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, msgb_l3len(msg) - 1, 0, 0);
 
@@ -456,16 +456,16 @@
 	if (!conn)
 		goto fail;
 
-	LOGP(DMSC, LOGL_NOTICE, "BSC sends cipher mode reject (conn_id=%i)\n", conn->a.conn_id);
+	LOGPCONN(conn, LOGL_NOTICE, "BSC sends cipher mode reject\n");
 
 	tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, msgb_l3len(msg) - 1, 0, 0);
 	if (!TLVP_PRESENT(&tp, BSS_MAP_MSG_CIPHER_MODE_REJECT)) {
-		LOGP(DMSC, LOGL_ERROR, "Cause code is missing -- discarding message!\n");
+		LOGPCONN(conn, LOGL_ERROR, "Cause code is missing -- discarding message!\n");
 		goto fail;
 	}
 
 	cause = TLVP_VAL(&tp, BSS_MAP_MSG_CIPHER_MODE_REJECT)[0];
-	LOGP(DMSC, LOGL_NOTICE, "Cipher mode rejection cause: %i\n", cause);
+	LOGPCONN(conn, LOGL_NOTICE, "Cipher mode rejection cause: %i\n", cause);
 
 	/* FIXME: Can we do something meaningful here? e.g. report to the
 	 * msc code somehow that the cipher mode command has failed. */
@@ -491,11 +491,11 @@
 	if (!conn)
 		goto fail;
 
-	LOGP(DMSC, LOGL_NOTICE, "BSC sends assignment failure message (conn_id=%i)\n", conn->a.conn_id);
+	LOGPCONN(conn, LOGL_NOTICE, "BSC sends assignment failure message\n");
 
 	tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, msgb_l3len(msg) - 1, 0, 0);
 	if (!TLVP_PRESENT(&tp, GSM0808_IE_CAUSE)) {
-		LOGP(DMSC, LOGL_ERROR, "Cause code is missing -- discarding message!\n");
+		LOGPCONN(conn, LOGL_ERROR, "Cause code is missing -- discarding message!\n");
 		goto fail;
 	}
 	cause = TLVP_VAL(&tp, GSM0808_IE_CAUSE)[0];
@@ -534,20 +534,20 @@
 	if (!conn)
 		goto fail;
 
-	LOGP(DMSC, LOGL_NOTICE, "BSC sends sapi \"n\" reject message (conn_id=%i)\n", conn->a.conn_id);
+	LOGPCONN(conn, LOGL_NOTICE, "BSC sends sapi \"n\" reject message\n");
 
 	/* Note: The MSC code seems not to care about the cause code, but by
 	 * the specification it is mandatory, so we check its presence. See
 	 * also 3GPP TS 48.008 3.2.1.34 SAPI "n" REJECT */
 	tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, msgb_l3len(msg) - 1, 0, 0);
 	if (!TLVP_PRESENT(&tp, GSM0808_IE_CAUSE)) {
-		LOGP(DMSC, LOGL_ERROR, "Cause code is missing -- discarding message!\n");
+		LOGPCONN(conn, LOGL_ERROR, "Cause code is missing -- discarding message!\n");
 		goto fail;
 	}
 
 	tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, msgb_l3len(msg) - 1, 0, 0);
 	if (!TLVP_PRESENT(&tp, GSM0808_IE_DLCI)) {
-		LOGP(DMSC, LOGL_ERROR, "DLCI is missing -- discarding message!\n");
+		LOGPCONN(conn, LOGL_ERROR, "DLCI is missing -- discarding message!\n");
 		goto fail;
 	}
 	dlci = TLVP_VAL(&tp, GSM0808_IE_DLCI)[0];
@@ -581,12 +581,12 @@
 	mgcp = conn->network->mgw.client;
 	OSMO_ASSERT(mgcp);
 
-	LOGP(DMSC, LOGL_INFO, "BSC sends assignment complete message (conn_id=%i)\n", conn->a.conn_id);
+	LOGPCONN(conn, LOGL_INFO, "BSC sends assignment complete message\n");
 
 	tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, msgb_l3len(msg) - 1, 0, 0);
 
 	if (!TLVP_PRESENT(&tp, GSM0808_IE_AOIP_TRASP_ADDR)) {
-		LOGP(DMSC, LOGL_ERROR, "AoIP transport identifier missing -- discarding message!\n");
+		LOGPCONN(conn, LOGL_ERROR, "AoIP transport identifier missing -- discarding message!\n");
 		goto fail;
 	}
 
@@ -594,7 +594,7 @@
 	rc = gsm0808_dec_aoip_trasp_addr(&rtp_addr, TLVP_VAL(&tp, GSM0808_IE_AOIP_TRASP_ADDR),
 					 TLVP_LEN(&tp, GSM0808_IE_AOIP_TRASP_ADDR));
 	if (rc < 0) {
-		LOGP(DMSC, LOGL_ERROR, "Unable to decode aoip transport address.\n");
+		LOGPCONN(conn, LOGL_ERROR, "Unable to decode aoip transport address.\n");
 		goto fail;
 	}
 
@@ -604,7 +604,7 @@
 		rtp_addr_in = (struct sockaddr_in *)&rtp_addr;
 		msc_mgcp_ass_complete(conn, osmo_ntohs(rtp_addr_in->sin_port), inet_ntoa(rtp_addr_in->sin_addr));
 	} else {
-		LOGP(DMSC, LOGL_ERROR, "Unsopported addressing scheme. (supports only IPV4)\n");
+		LOGPCONN(conn, LOGL_ERROR, "Unsopported addressing scheme. (supports only IPV4)\n");
 		goto fail;
 	}
 
@@ -679,7 +679,7 @@
 		return -EINVAL;
 	}
 
-	LOGP(DMSC, LOGL_DEBUG, "BSC sends layer 3 dtap (conn_id=%i)\n", conn->a.conn_id);
+	LOGPCONN(conn, LOGL_DEBUG, "BSC sends layer 3 dtap\n");
 
 	/* msc_dtap expects the dtap payload in l3h */
 	msg->l3h = msg->l2h + 3;

-- 
To view, visit https://gerrit.osmocom.org/6331
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic1c9d14b892154d51165598338d23a924a772265
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list