[PATCH] openbsc[master]: oap_client: move logging to DLOAP logging category

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Dec 9 00:38:27 UTC 2016


Review at  https://gerrit.osmocom.org/1393

oap_client: move logging to DLOAP logging category

libosmocore since recently offers the DLOAP logging category for OAP. Use it.

Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a
---
M openbsc/src/libcommon/oap_client.c
M openbsc/tests/oap/oap_client_test.c
M openbsc/tests/oap/oap_client_test.err
3 files changed, 28 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/93/1393/1

diff --git a/openbsc/src/libcommon/oap_client.c b/openbsc/src/libcommon/oap_client.c
index d6a7043..db09630 100644
--- a/openbsc/src/libcommon/oap_client.c
+++ b/openbsc/src/libcommon/oap_client.c
@@ -37,12 +37,12 @@
 		goto disable;
 
 	if (config->secret_k_present == 0) {
-		LOGP(DGPRS, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n");
+		LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret K missing.\n");
 		goto disable;
 	}
 
 	if (config->secret_opc_present == 0) {
-		LOGP(DGPRS, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n");
+		LOGP(DLOAP, LOGL_NOTICE, "OAP: client ID set, but secret OPC missing.\n");
 		goto disable;
 	}
 
@@ -100,16 +100,16 @@
 	osmo_auth_gen_vec(&vec, &auth, rx_random);
 
 	if (vec.res_len != 8) {
-		LOGP(DGPRS, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n",
+		LOGP(DLOAP, LOGL_ERROR, "OAP: Expected XRES to be 8 octets, got %d\n",
 		     vec.res_len);
 		return -3;
 	}
 
 	if (osmo_constant_time_cmp(vec.autn, rx_autn, sizeof(vec.autn)) != 0) {
-		LOGP(DGPRS, LOGL_ERROR, "OAP: AUTN mismatch!\n");
-		LOGP(DGPRS, LOGL_INFO, "OAP: AUTN from server: %s\n",
+		LOGP(DLOAP, LOGL_ERROR, "OAP: AUTN mismatch!\n");
+		LOGP(DLOAP, LOGL_INFO, "OAP: AUTN from server: %s\n",
 		     osmo_hexdump_nospc(rx_autn, sizeof(vec.autn)));
-		LOGP(DGPRS, LOGL_INFO, "OAP: AUTN expected:    %s\n",
+		LOGP(DLOAP, LOGL_INFO, "OAP: AUTN expected:    %s\n",
 		     osmo_hexdump_nospc(vec.autn, sizeof(vec.autn)));
 		return -2;
 	}
@@ -134,7 +134,7 @@
 	struct osmo_oap_message oap_msg = {0};
 
 	if (client_id < 1) {
-		LOGP(DGPRS, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id);
+		LOGP(DLOAP, LOGL_ERROR, "OAP: Invalid client ID: %d\n", client_id);
 		return NULL;
 	}
 
@@ -174,7 +174,7 @@
 	uint8_t xres[8];
 
 	if (!(oap_rx->rand_present && oap_rx->autn_present)) {
-		LOGP(DGPRS, LOGL_ERROR,
+		LOGP(DLOAP, LOGL_ERROR,
 		     "OAP challenge incomplete (rand_present: %d, autn_present: %d)\n",
 		     oap_rx->rand_present, oap_rx->autn_present);
 		rc = -2;
@@ -217,7 +217,7 @@
 
 	rc = osmo_oap_decode(&oap_msg, data, data_len);
 	if (rc < 0) {
-		LOGP(DGPRS, LOGL_ERROR,
+		LOGP(DLOAP, LOGL_ERROR,
 		     "Decoding OAP message failed with error '%s' (%d)\n",
 		     get_value_string(gsm48_gmm_cause_names, -rc), -rc);
 		return -10;
@@ -233,7 +233,7 @@
 		break;
 
 	case OAP_MSGT_REGISTER_ERROR:
-		LOGP(DGPRS, LOGL_ERROR,
+		LOGP(DLOAP, LOGL_ERROR,
 		     "OAP registration failed\n");
 		state->state = OAP_INITIALIZED;
 		if (state->registration_failures < 3) {
@@ -244,13 +244,13 @@
 
 	case OAP_MSGT_REGISTER_REQUEST:
 	case OAP_MSGT_CHALLENGE_RESULT:
-		LOGP(DGPRS, LOGL_ERROR,
+		LOGP(DLOAP, LOGL_ERROR,
 		     "Received invalid OAP message type for OAP client side: %d\n",
 		     (int)oap_msg.message_type);
 		return -12;
 
 	default:
-		LOGP(DGPRS, LOGL_ERROR,
+		LOGP(DLOAP, LOGL_ERROR,
 		     "Unknown OAP message type: %d\n",
 		     (int)oap_msg.message_type);
 		return -13;
diff --git a/openbsc/tests/oap/oap_client_test.c b/openbsc/tests/oap/oap_client_test.c
index b966c41..8ae92bb 100644
--- a/openbsc/tests/oap/oap_client_test.c
+++ b/openbsc/tests/oap/oap_client_test.c
@@ -213,17 +213,17 @@
 	msgb_free(msg_rx);
 }
 
-static struct log_info_cat gprs_categories[] = {
-	[DGPRS] = {
-		.name = "DGPRS",
-		.description = "GPRS Packet Service",
+static struct log_info_cat oap_client_test_categories[] = {
+	[DLOAP] = {
+		.name = "DLOAP",
+		.description = "Osmocom Authentication Protocol",
 		.enabled = 1, .loglevel = LOGL_DEBUG,
 	},
 };
 
 static struct log_info info = {
-	.cat = gprs_categories,
-	.num_cat = ARRAY_SIZE(gprs_categories),
+	.cat = oap_client_test_categories,
+	.num_cat = ARRAY_SIZE(oap_client_test_categories),
 };
 
 int main(int argc, char **argv)
diff --git a/openbsc/tests/oap/oap_client_test.err b/openbsc/tests/oap/oap_client_test.err
index 3272237..248808e 100644
--- a/openbsc/tests/oap/oap_client_test.err
+++ b/openbsc/tests/oap/oap_client_test.err
@@ -3,26 +3,26 @@
 - reset state
 - only client_id is invalid
 - valid id, but omitted shared_secret (1/2)
-DGPRS OAP: client ID set, but secret K missing.
+DLOAP OAP: client ID set, but secret K missing.
 - valid id, but omitted shared_secret (2/2)
-DGPRS OAP: client ID set, but secret OPC missing.
+DLOAP OAP: client ID set, but secret OPC missing.
 - mint configuration
 - Missing challenge data
-DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 0)
+DLOAP OAP challenge incomplete (rand_present: 0, autn_present: 0)
 - AUTN missing
-DGPRS OAP challenge incomplete (rand_present: 1, autn_present: 0)
+DLOAP OAP challenge incomplete (rand_present: 1, autn_present: 0)
 - RAND missing
-DGPRS OAP challenge incomplete (rand_present: 0, autn_present: 1)
+DLOAP OAP challenge incomplete (rand_present: 0, autn_present: 1)
 - wrong autn (by one bit)
-DGPRS OAP: AUTN mismatch!
-DGPRS OAP: AUTN from server: dec4e3848a33000086781158ca40f136
-DGPRS OAP: AUTN expected:    cec4e3848a33000086781158ca40f136
+DLOAP OAP: AUTN mismatch!
+DLOAP OAP: AUTN from server: dec4e3848a33000086781158ca40f136
+DLOAP OAP: AUTN expected:    cec4e3848a33000086781158ca40f136
 - all data correct
 - but refuse to evaluate in uninitialized state
 - now everything is correct
 - Expect the challenge response in msg_tx
 - Receive registration error for the first time.
-DGPRS OAP registration failed
+DLOAP OAP registration failed
 - Receive registration error for the Nth time.
-DGPRS OAP registration failed
+DLOAP OAP registration failed
 - Registration success

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic765c19381b0d983da90a5d8aee9cd17e31cf34a
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list