[MERGED] libosmo-sccp[master]: sccp_user.c: add missing error logging

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jun 26 16:11:53 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: sccp_user.c: add missing error logging
......................................................................


sccp_user.c: add missing error logging

Change-Id: I98e400e297f8fa83037a8e74a936e4ecc137099c
---
M src/sccp_user.c
1 file changed, 12 insertions(+), 4 deletions(-)

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



diff --git a/src/sccp_user.c b/src/sccp_user.c
index 5f89f71..93b03f6 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -74,11 +74,17 @@
 	if (!pc_valid)
 		pc = 0;
 
-	if (sccp_user_find(inst, ssn, pc))
+	scu = sccp_user_find(inst, ssn, pc);
+	if (scu) {
+		LOGP(DLSCCP, LOGL_ERROR,
+		     "Cannot bind user '%s' to SSN=%u PC=%u=%s (pc_valid=%u), this SSN and PC"
+		     " is already bound by '%s'\n",
+		     name, ssn, pc, osmo_ss7_pointcode_print(inst->ss7, pc), pc_valid, scu->name);
 		return NULL;
+	}
 
-	LOGP(DLSCCP, LOGL_INFO, "Binding user '%s' to SSN=%u PC=%u (pc_valid=%u)\n",
-		name, ssn, pc, pc_valid);
+	LOGP(DLSCCP, LOGL_INFO, "Binding user '%s' to SSN=%u PC=%u=%s (pc_valid=%u)\n",
+		name, ssn, pc, osmo_ss7_pointcode_print(inst->ss7, pc), pc_valid);
 
 	scu = talloc_zero(inst, struct osmo_sccp_user);
 	scu->name = talloc_strdup(scu, name);
@@ -247,8 +253,10 @@
 
 	/* allocate + initialize SS7 instance */
 	ss7 = osmo_ss7_instance_find_or_create(ctx, 1);
-	if (!ss7)
+	if (!ss7) {
+		LOGP(DLSCCP, LOGL_ERROR, "Failed to find or create SS7 instance\n");
 		return NULL;
+	}
 	ss7->cfg.primary_pc = pc;
 
 	as_name = talloc_asprintf(ctx, "as-clnt-%s", name);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I98e400e297f8fa83037a8e74a936e4ecc137099c
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list